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!
How to draw a light only when target entity is powered
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: How to draw a light only when target entity is powered
Spawning extra lamps is way cheaper than on_tick scanning every roboport all the time just to see if it has power. Because that's the only thing you could do.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: How to draw a light only when target entity is powered
Just as i thought... i'll probably go the lamp entity wayeradicator wrote: ↑Thu Jun 06, 2019 4:42 pm Spawning extra lamps is way cheaper than on_tick scanning every roboport all the time just to see if it has power. Because that's the only thing you could do.
Thanks