Space Engineers

Space Engineers

110 ratings
BlueG_Radar (stable; see description for news)
   
Award
Favorite
Favorited
Unfavorite
Type: Mod
Mod category: Script
File Size
Posted
Updated
409.217 KB
4 Jan, 2015 @ 4:23pm
29 Jan, 2015 @ 1:54am
18 Change Notes ( view )

Subscribe to download
BlueG_Radar (stable; see description for news)

Description
This version is now considered stable and won't change unless a major bug is found. I am planning the next version and have begun a discussion thread on Keen's forums to gather input for it. The address is: http://forums.keenswh.com/post/next-version-of-bluegradar-comments-and-suggestions-7341887?pid=1286594646#post1286594646

*** Update 1/29/2015: The options for Detect Players and Detect Floating objects now work as expected (detecting players and floating objects respectively). This wasn't done previously for historical reasons. Before Keen added "Detect Friendlies, etc." I was using those settings to determine whether to detect friendlies/enemies (which I thought was more useful than players/floating objects), but hopefully no one is still using it that way. And now that someone has presented me with a use case for it (a way that they plan to use it), I was motivated to change it. ***

*** Update 1/29/2015: You can now have the sensor report GPS coordinates. Use the [radarg] tag on the sensor instead of [radar]. If used with the "+" flag, then the "g" flag should appear first. The "g" and "s" flags can not be used at the same time. You can also add the "g" flag to the radar (beacon) itself. This will cause its GPS coordinates to be reported on the beacon (instead of the sensor). Oh, and minor change: you can also put parenthesis around the "g", "s" and "+" flags, so you can use [radar(g+)] instead of [radarg+], but you don't have to. ***

Special thanks to midspace. His (her?) answering my question on the forums helped me figure out a problem I was having with floating objects.

I have posted an example of how to use this mod to create a homing missile at http://steamproxy.net/sharedfiles/filedetails/?id=373595045. Also, checkout cookiehunter's work. He posted a working torpedo under the How Do You Use discussion. Whereas my torpedo was kept very simple as an example to understand how this mod works and the basis for creating a torpedo, his torpedo is more complete and better behaved.

Key Features

  • Long range *
  • Detects both asteroids and ships
  • Distinguishes enemy ships from friendly or neutral
  • Result can be accessed from script
  • Can select up to 20 closest targets matching criteria (with multiple sensors or by changing settings through script)
  • Built on the beacon, so it requires a working block and power proporitonal to its range (for those who want at least some realism)

* The radar can detect any object that has been loaded by the game within the beacon's range. The game, however, only loads objects within the range determined by the View Distance setting under Advance Settings for the world. The radar can not detect what isn't there (what the game hasn't loaded).

About

Allows beacons to be used together with one or more sensors to form a radar system.

This mod is in alpha. It is feature complete (for its current release) and has been tested, but may still have a few bugs.

How to Use

The beacon must have the tag [radar] in its name, be functional (built) and enabled (turned on). Its position and range will be used as the radar's position and range. This way, power consumption varies with range.

The sensor must also have the tag [radar] in its name and be functional (built), but does not need to be enabled (does not need to be turned on). Only sensors that are friendly to the beacon will be updated. That is, the sensor must be owned by the same player as the beacon or shared through a faction.

The items selected for detection by the sensor will be reported to that sensor, with the exception of the player and floating object options. This includes the Detect Owner, Detect Friendly, Detect Neutral, and Detect Enemy settings.

Sensors normally report the nearest item that matches their criteria. You can use [radar1] to skip the closest item, [radar2] to skip the two closest items, and so on, all the way up [radar19], which will skip 19 items. In this way, you can get the 20 closest items, if you really want to.

Normally, the sensor updates its targets once a second. This can change what object is selected as closest, 2nd closest, and so on. If you'd like it to keep tracking the same object, use [radar+], [radar+1], [radar+2], etc.

When a radar sensor has a match, a vector will be appended to its name that gives the coordinates of the item found. These coordinates are relative to the sensor. Space Engineers uses a right handed coordinate system. The positive X axis is to the right, the positive Y axis is up, and the positive Z axis is backwards. These are all relative to the direction the sensor is facing. So, if the sensor is facing the object detected, it will have a negative Z coordinate (see the picture above).

If you prefer, you can get spherical coordinates. Put an "s" immediately after the word "radar" in the sensor's tag. So, [radar] would become [radars] and [radar+1] would become [radars+1]. The coordinates will be reported as <distance, yaw, pitch>. Yaw is positive if the object is to the right and pitch is positive if the object is up. Both are given in degrees. These may be easier to use both when looking at the coordinates visually and when writing scripts.

Currently, the system is designed to work properly with only one radar antenna per cube grid. Otherwise, all radar antennas will try to set all radar sensors (probably at different times too).This may be fine in some scenarios (if it doesn't matter which antenna sets the sensors).

Sample Code for Programmable Block

Here is some code that can be used in a programmable block to retrieve the coordinates reported by the radar system (in this example, the sensor was named "Sensor [radar]" before it was modified). You can also look at the example world that I made. The miner in that world has a programmable block that uses the radar system.

string sensorBaseName = "Sensor [radar]"; System.Text.RegularExpressions.Regex rxVector = new System.Text.RegularExpressions.Regex( @"\<([+-]?[0-9]+(?:\.[0-9]*)?),([+-]?[0-9]+(?:\.[0-9]*)?),([+-]?[0-9]+(?:\.[0-9]*)?)\>" ); List<IMyTerminalBlock> buffer = new List<IMyTerminalBlock>( 1 ); void Main() { GridTerminalSystem.GetBlocksOfType<IMySensorBlock>( buffer, IsRadarSensor ); if( buffer.Count > 0 ) { var match = rxVector.Match( buffer[0].CustomName ); if( match.Success ) { float x = Single.Parse( match.Groups[1].Value ); float y = Single.Parse( match.Groups[2].Value ); float z = Single.Parse( match.Groups[3].Value ); // do what you want with the coordinates } else { // the radar didn't find anything } } } bool IsRadarSensor(IMyTerminalBlock block) { return block.CustomName.StartsWith( sensorBaseName ); }

License

The BlueG_Radar Mod is the product of Bradley Regula.

(c)2015 by Bradley A. Regula

BlueG_Radar Mod by Bradley Regula is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.

This is in addition to rights and licenses resulting from the publication of the BlueG_Radar Mod on Steam's Workshop.

By the way, I'd love to know how you use this mod. It will help me plan new features or future mods. ^^
Popular Discussions View All (4)
17
13 Nov, 2015 @ 9:42am
Desired Features
BlueGM
9
12 Sep, 2015 @ 12:33pm
How Do You Use This Mod?
BlueGM
4
31 Jan, 2015 @ 3:32am
How to Use
BlueGM
94 Comments
BlueGM  [author] 16 Sep, 2020 @ 3:53pm 
I haven't touched this in a long time, so to the question of whether or not it still works, probably not. There have been numerous updates to the Mod API since I wrote this. I've thought several times of updating it, but right now that isn't possible. As of yesterday, I don't have a computer capable of running Space Engineers at the moment. I have been playing Space Engineers again, so maybe I'll look at it again in another month when I have the required hardware again.
ThePropheticWarrior 14 Sep, 2020 @ 6:29pm 
I would love to use multiple (perhaps 4 or 5) sensors on a rotating rotor and/or rotating dish, like in real world! It would also be awesome to have the option of selecting one directional sector at a time (different radar consoles looking at different sectors, like Fighters use) - and main for (all sectors) general viewing, as well as passive/active modes - like in the real world! It would also be nice to implement this in planet/wall maps! I'm going to also suggest this in the other radar mods - perhaps some cooperation can be done between the Modders - and the Community!
RobinHorn 1 Feb, 2017 @ 6:05pm 
Does this still work? It doesnt seem to do anything. I have a sensor with [radar] in the name and a beacon with [radar] in the name as well. Any thing else that I am supposed to do?
RazersEdge 17 Jan, 2017 @ 11:26am 
Any chance that we could get an update that is optimized for the new updates to the game? I tend to get crashes when we run this mod on our server. Even though it makes life SO much easier on everyone because then you can find hostiles.
Grindstone 2 Aug, 2016 @ 7:26pm 
Is this mod dead?
imivi 18 Jan, 2016 @ 4:07pm 
To BlueG:
The latest SE update seems to have broken this script because the MyRelationsBetweenPlayerAndBlock enum got moved to VRage.Game. If you want to update the script, this is fixed by just adding "using VRage.Game;".
BlueGM  [author] 25 Oct, 2015 @ 3:02pm 
Side Note: I haven't played SE in months now. Been too busy with work and school. So I've forgetten some the details of how this mod works. However, my homing missile example uses relative coordinates to home in on its target, so you might want to check that out.
BlueGM  [author] 25 Oct, 2015 @ 3:00pm 
@tom: I assume you mean that the radar is on the battleship. The 'g' tag gets the position of the target (not the ship it is on) using the game's built-in coordinate system. So, if you move the ship, it won't affect the position reported for static objects such as stations and asteroids. If you remove the 'g' part of the tag on the sensor, then you will get the coordinates of the target relative to the sensor on the ship.
tom.gaertner 25 Oct, 2015 @ 10:40am 
I tried to build a Battle ship, got it all working if the ship stays on its position. When I moved the ship I discovered, that the relative positions to static targets wil not be updated. I used [radarg] to get the positions for GFCS. Is your mod just created for stations or what could I have done wrong ?
Exelsiar 17 Oct, 2015 @ 9:04pm 
Hi I've a small issue, the sensors only detect neutrals when their set to detect friendly too.