Page 1 of 1

get_energy_ratio()

Posted: Mon Apr 20, 2020 9:45 pm
by Mylon
There are some cases where I need to check if an entity is fully powered. get_energy_ratio() would simplify the check to simplify a comparison like this:

Code: Select all

if entity.prototype.electric_energy_source_prototype then
 if entity.energy == entity.prototype.electric_energy_source_prototype.buffer_capacity then...
get_energy_ratio() would also work for void sources (always return 1), and burner sources.