How to draw a light only when target entity is powered
Posted: Wed Jun 05, 2019 1:28 am
Hello!
In my mod I'm adding a technology that makes roboports emit light during the night. To achieve this, I'm using rendering.draw_light() with minimum_darkness = 0.5
Now I need them to stop emitting light if they get disconnected from power. I'm already tracking the ID of the light associated with the roboport, but I have no clue about how to react to a change in their power status (powered to unpowered and vice versa).
Is there a way to do this?
Another idea i have is to use a dummy invisible lamp entity placed over the roboport so I can leverage the lamp logic, but I'm wondering if there's another way that doesn't require spawning an additional entity for each roboport on the map...
Any suggestion?
Thanks!
In my mod I'm adding a technology that makes roboports emit light during the night. To achieve this, I'm using rendering.draw_light() with minimum_darkness = 0.5
Now I need them to stop emitting light if they get disconnected from power. I'm already tracking the ID of the light associated with the roboport, but I have no clue about how to react to a change in their power status (powered to unpowered and vice versa).
Is there a way to do this?
Another idea i have is to use a dummy invisible lamp entity placed over the roboport so I can leverage the lamp logic, but I'm wondering if there's another way that doesn't require spawning an additional entity for each roboport on the map...
Any suggestion?
Thanks!