LuaEntityPrototype::max_power_production read

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 579
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

LuaEntityPrototype::max_power_production read

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

Thanks!
Don't forget, you're here forever.
Helfima
Fast Inserter
Fast Inserter
Posts: 200
Joined: Tue Jun 28, 2016 11:40 am
Contact:

Re: LuaEntityPrototype::max_power_production read

Post by Helfima »

hello

+1

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
LuaEntityPrototype.max_power_output

some helper mods need read this value.
PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: LuaEntityPrototype::max_power_production read

Post 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)
Bilka
Factorio Staff
Factorio Staff
Posts: 3309
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: LuaEntityPrototype::max_power_production read

Post by Bilka »

LuaEntityPrototype::max_energy_production read was added for 1.1 and LuaEntityPrototype::production was removed.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Implemented mod requests”