get_energy_ratio()
Posted: Mon Apr 20, 2020 9:45 pm
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:
get_energy_ratio() would also work for void sources (always return 1), and burner sources.
Code: Select all
if entity.prototype.electric_energy_source_prototype then
if entity.energy == entity.prototype.electric_energy_source_prototype.buffer_capacity then...