Energy satisfaction

Place to get help with not working mods / modding interface.
Kexík
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Mon Dec 01, 2014 12:52 pm
Contact:

Energy satisfaction

Post by Kexík »

Hi, me again. Is there any way how to get energy satisfaction of entity in script?
For example if my small pump needs 100kW to work but my electrict network is bad and i can provide only 10kW, can i get somehow this information so i would slow down stuff i am doing in script?
User avatar
Xecutor
Filter Inserter
Filter Inserter
Posts: 260
Joined: Mon Jun 23, 2014 10:15 am
Contact:

Re: Energy satisfaction

Post by Xecutor »

AFAIK:
Entity have 'energy' property.
The game tries to fill it according to entity demand from definition.
If you want to perform some custom actions not derived from base entity, you need
to decrease energy every tick.
If your entity want 60kw/sec then every tick the game will try to fill energy property with 1000w.
So if it's 1000, then you can perform your actions at 100% speed, if it's 500 then 50% speed and so on.
But don't forget to set energy to 0 on every tick when work was performed.
Kexík
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Mon Dec 01, 2014 12:52 pm
Contact:

Re: Energy satisfaction

Post by Kexík »

thanks i will try that
Post Reply

Return to “Modding help”