Adds a new kind of signal controller called "Networked Radar" that you can place down next to radars that reports the total number of found enemy and friendly units in its permanent coverage area (not the random sector scans).
Here's how you make it work:
1. Research the Networked Radar technology.
2. Create one and place it right next to a radar, on any side of it.
3. Feed it a signal through a wire of the letter "R" with a value greater than zero (any value).
4. It will feed you two signals out, the green and red radar symbols, with values from zero to how many units it finds.
The signal is only updated every 4 seconds.
Note that the signals are output per-radar. So if you want to know how many friendly or enemy units are inside your total radar coverage, you will need to sum them yourself.
If it's not connected to anything, it will not output any value, so connect it to something before you mouse over it or hold down Alt to see the values.
The radars scan per force/faction of the player who places it, so it should work perfectly in multiplayer. But I have not tested it.
Here's what it detects from the base game: small-biter, medium-biter, big-biter, behemoth-biter, small-spitter, medium-spitter, big-spitter, and behemoth-spitter.
Note that it does not detect players, enemy structures, turrets, vehicles, or destroyer/defender capsules, and similar items. It only detects the internal data type that is "unit".
This mod was made to be compatible wiht any kind of structure that registers as a radar. So it works perfectly with the "Big Brother" mod, for example. There are some mods that register radar-type buildings with 0-range detection; it tries to ignore them.
It was also made with the "Robot Army" mod in mind. The robots from this mod are "unit" types, and will be detected. Using these two in combination, you can auto-deploy hunter/guard squadrons as needed based on how many are alive inside the radar coverage.
I have not noticed any problems so far, but my base is not that big. The code is quite well optimized and does not produce needless data or perform any operations when it doesn't need to.
Please feel free (obviously) to look at the code, but also engage me in conversation about it if you want - I am entirely open to criticism.
Help me please!
This is my second mod, and I do not really have a feel for the game yet. I'm quite sure that a few things should be tuned, for example:
- The cost of researching the technology
- The cost of producing the item (recipe)
- I welcome help in making the lightbulb on the ground (which does nothing now) light up under any condition
- I welcome a better icon for the item, it's just something I made quickly and does not look good :-P
Any kind of suggestions or ideas you have, please write in the comment section. Thank you!
Thanks to justarandomgeek for his SCAMMER addon and to the authors of Robot Army and Big Brother. All these 3 mods inspired me to write this.
Also thanks to sparr and his factorio-mod-expose-data-raw for showing how to read data.raw in the control context.
0.1.4: Update for 0.16.
0.1.3: Update for 0.15.10.
0.1.2: Update for 0.15.
0.1.1: Fixed nil reference error
0.1.0: Initial release