get_energy_ratio()

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

get_energy_ratio()

Post 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.

Post Reply

Return to “Modding interface requests”