Page 1 of 1

Energy state awareness events

Posted: Mon Jul 14, 2014 5:12 pm
by Dark
Basically this comes to two new events - onpoweredup and onpowereddown, both provide entity object that was turned on or off and the tick value to track how many objects to process per tick from lua.
Bonus points if events will come in order of increasing distance from power source, for a nice cascading effect.

And one additional event if possible - onpowerdelta - triggered when amount of available energy changes, ex. when an inserter receives less energy than required for full operation at full speed.
This can also be done by extending onpoweredup, onpowereddown with delta value, and call them every time when available energy changes.

I searched this forum a lot and unless I missing something big here the only way to track such thing as "powered" state is to build list of entities an iterate over this list every tick (or few ticks with fragmentation), not only this complex and error prone but it's also very performance hungry if you have a lot of objects to track.

Thanks for reading.