Page 1 of 1

LuaEntityPrototype::max_power_production read

Posted: Fri Aug 21, 2020 11:23 pm
by raiguard
Currently there is no way (that I've been able to find) to read the maximum power production of a generator. You can read the maximum power output of a solar panel, but that field returns nil for generators. I would like to request a way to read this property so I can incorporate it into my Rate Calculator mod.


Re: LuaEntityPrototype::max_power_production read

Posted: Wed Nov 04, 2020 6:08 am
by Helfima


can you expose the max_power_output for generator?

use the existing attribute
LuaEntityPrototype.production: The max production this solar panel prototype produces or nil.
or create new

some helper mods need read this value.

Re: LuaEntityPrototype::max_power_production read

Posted: Wed Nov 04, 2020 8:07 am
by PFQNiet
There's no easy way to calculate this at the moment.

Generators consume a fixed amount of fluid per tick, and the power produced is a function of that consumption and the fluid's temperature and heat capacity.

If the generator's fluid box is suitably locked down (filtered to a single fluid, and locked to a particular temperature) then it is possible to calculate a generator's max power output. This is fine for the vanilla generator, but for the general case of modded generators there's no reasonable way to calculate it as it will change depending on what fluid/temperature is fed into it.

(I do want to +1 this suggestion though. It seems Generators are saddled with ancient ways of doing things that can't really be changed at this point, but I had to hack together a custom "generator" using a storage tank and electric-energy-interface so that I could have a fixed power output with variable fluid consumption, rather than a fixed fluid consumption for variable power output)

Re: LuaEntityPrototype::max_power_production read

Posted: Mon Nov 16, 2020 1:14 pm
by Bilka
LuaEntityPrototype::max_energy_production read was added for 1.1 and LuaEntityPrototype::production was removed.