Page 1 of 1
runtime access to fusion reactor/generator properties
Posted: Fri Jun 06, 2025 6:21 am
by SWeini
I'd like to have access to these properties in runtime stage:
Fusion Reactor:
https://lua-api.factorio.com/latest/pro ... onnectable
https://lua-api.factorio.com/latest/pro ... bour_bonus (can probably use the existing reactor-only property)
https://lua-api.factorio.com/latest/pro ... ower_input
https://lua-api.factorio.com/latest/pro ... luid_usage (probably as get_...(quality) method)
Fusion Generator:
https://lua-api.factorio.com/latest/pro ... luid_usage (probably as get_...(quality) method)
these are needed to calculate the production rates of fusion reactors and fusion generators (I think that is all, but I might be missing something)
Re: runtime access to fusion reactor/generator properties
Posted: Fri Jun 06, 2025 3:36 pm
by SWeini
Re: runtime access to fusion reactor/generator properties
Posted: Wed Jun 11, 2025 1:44 pm
by Rseding91
I've added the missing ones for the next release.
Re: runtime access to fusion reactor/generator properties
Posted: Thu Jun 19, 2025 8:18 pm
by SWeini
Rseding91 wrote: Wed Jun 11, 2025 1:44 pm
I've added the missing ones for the next release.
I still can't find these properties:
-
FusionReactorPrototype.neighbour_connectable
-
FusionReactorPrototype.max_fluid_usage
Re: runtime access to fusion reactor/generator properties
Posted: Fri Jun 20, 2025 12:38 am
by Rseding91
Fluid usage is here:
https://lua-api.factorio.com/latest/cla ... e_per_tick
Neighbor connectable I didn't include - what's the point in having it?
Re: runtime access to fusion reactor/generator properties
Posted: Fri Jun 20, 2025 5:35 am
by SWeini
Fluid usage works for fusion
generator (even though the documentation doesn't say so) but always returns nil for fusion
reactor (even though the documentation says it is available)
The connectables are needed to calculate max neighbour bonus (especially for ghosts and entities marked for upgrade)
LuaEntity::neighbours does not work for those cases, and LuaEntity::neighbour_bonus would not help, even if it did work for fusion reactors
It's actually quite a lot of code to calculate whether two entities connect. I could also use a function like this if it existed:
are_connected(prototype_a, position_a, orientation_a, prototype_b, position_b, orientation_b) → boolean
but I doubt you want to add such a function
Re: runtime access to fusion reactor/generator properties
Posted: Sun Jun 22, 2025 7:28 pm
by Rseding91
Ok, I added it for the next release.
Re: runtime access to fusion reactor/generator properties
Posted: Tue Jun 24, 2025 4:22 am
by SWeini
Rseding91 wrote: Sun Jun 22, 2025 7:28 pm
Ok, I added it for the next release.
Thanks for adding neighbour_connectable. Unfortunately I still don't have access to fluid usage of fusion reactors, see my last post. Bug or feature request?
Re: runtime access to fusion reactor/generator properties
Posted: Tue Jun 24, 2025 8:15 am
by Rseding91
https://lua-api.factorio.com/latest/cla ... e_per_tick It is there in the experimental version.
Correction, it will be there for the next release.