Modding radar areas - how to change active area

Place to get help with not working mods / modding interface.
Post Reply
xBlizzDevious
Fast Inserter
Fast Inserter
Posts: 108
Joined: Mon Feb 02, 2015 10:15 pm
Contact:

Modding radar areas - how to change active area

Post by xBlizzDevious »

Hello!

I was in the process of choosing which mods to use and which mods not to use - and what works - on a multiplayer map.

Then all of a sudden, my friend and I decided to mod some stuff of our own. So... I've created a simple mod that adds a tier 2 and tier 3 radar, each scans a larger area but draws significantly more power (300kW for base, 900kW for MkII, 5MW for MkIII).

Unfortunately, the area that the radar scans constantly and allows you to see all active entities within, does not increase and I cannot find anything within the base game files to do with how wide an area the radar can see... So how would I go about modding that area?

Thanks!

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Modding radar areas - how to change active area

Post by FreeER »

xBlizzDevious wrote:Unfortunately, the area that the radar scans constantly and allows you to see all active entities within, does not increase and I cannot find anything within the base game files to do with how wide an area the radar can see... So how would I go about modding that area?
Unfortunately that is currently hard coded in C++ as 3 chunks around the radar.

hm, what could be done, with some work, is to add another radar with a small sector area (1, or maybe 0), a transparent image, and no collision box, and in control.lua during the onbuiltentity event place those around the main radar with game.createentity. The problem with that is the code placed radars would still need energy (even if it is just a small amount) so you'd either need to store them in a table (you'd want to do so anyways so you could destroy them when the main radar is destroyed) and manually add energy or also place some more entities to provide power to them (modded accumulators with large storage and a pole with a small radius for example)...

It's not the easiest thing to do but it can be done.

xBlizzDevious
Fast Inserter
Fast Inserter
Posts: 108
Joined: Mon Feb 02, 2015 10:15 pm
Contact:

Re: Modding radar areas - how to change active area

Post by xBlizzDevious »

FreeER wrote:
xBlizzDevious wrote:Unfortunately, the area that the radar scans constantly and allows you to see all active entities within, does not increase and I cannot find anything within the base game files to do with how wide an area the radar can see... So how would I go about modding that area?
Unfortunately that is currently hard coded in C++ as 3 chunks around the radar.

hm, what could be done, with some work, is to add another radar with a small sector area (1, or maybe 0), a transparent image, and no collision box, and in control.lua during the onbuiltentity event place those around the main radar with game.createentity. The problem with that is the code placed radars would still need energy (even if it is just a small amount) so you'd either need to store them in a table (you'd want to do so anyways so you could destroy them when the main radar is destroyed) and manually add energy or also place some more entities to provide power to them (modded accumulators with large storage and a pole with a small radius for example)...

It's not the easiest thing to do but it can be done.
Aww damn. That kinda ruins the point of them. A huge area radar that only uncovers in the first place just isn't the same as one that can show a huge area all of the time.

Would it be possible to reduce the energy needed per sector scan to something miniscule (1kJ, for example) and then feed it with 5MW of power to scan; would that kinda do the same thing? It would make the radar fill in all sectors very fast, though.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Modding radar areas - how to change active area

Post by FreeER »

xBlizzDevious wrote:A huge area radar that only uncovers in the first place
It wouldn't be just the first place if you used the ontick event to add energy or setup some other way for them to continuously receive power.
xBlizzDevious wrote:Would it be possible to reduce the energy needed per sector scan to something miniscule (1kJ, for example) and then feed it with 5MW of power to scan; would that kinda do the same thing? It would make the radar fill in all sectors very fast, though.
you can lower the energy per sector, however there is a limit on the amount of energy an entity can hold, which for radars, I believe, that would be at least partially based on the energy per sector so it wouldn't really help.
basic code

SirRichie
Fast Inserter
Fast Inserter
Posts: 244
Joined: Wed Feb 25, 2015 4:50 pm
Contact:

Re: Modding radar areas - how to change active area

Post by SirRichie »

This thread is over a month old, but you may still find this useful:
I'm not sure since when, but radars do now have a property max_distance_of_nearby_sector_revealed which is the number of chunks that remain revealed.
If you create your own radar and set this to a high number like... 32, you will even see how the map is very quickly revealed in that area.

Post Reply

Return to “Modding help”