Page 1 of 1

Is it possible to check if entity has enough power?

Posted: Thu Oct 03, 2019 7:22 am
by Romner_set
And is it possible to check if it has 100% power? (Modded electric energy interface)

Re: Is it possible to check if entity has enough power?

Posted: Fri Oct 11, 2019 8:30 am
by Arcitos
You might use the "energy" property of the electric interface to check for this: If its > 0, the interface is at least somewhat powered.

If you want to check whether a certain treshold is reached (e.g. "at least 60% of energy demand provided"), your calculation could take the "power_usage" into account: energy / power_usage is the ratio of available energy to energy demand (e.g.: if its > 0.6, your threshold is reached). But I didn't test this beforehand. Please note, that "power_usage" is using energy standard units like "kW" and needs to be converted to Joule beforehand.