[LUA REQUEST] Dynamically adjustable reactor/burner
Posted: Mon Jun 03, 2024 4:51 am
Hi there.
I was recently trying to add some new functionality to the RealisticReactors mod and have noticed that they use a rather ugly hack to dynamically set the reactor efficiency and the power: they create 250 reactor prototypes with power output from 1 to 250 MW and then replace the reactor every time its power output has to change. For efficiency it is even worse: a fake fuel cell with some enormous energy content is used and the remaining fuel is added or removed to the actual fuel cell depending on whether the reactor is running above or below 100% efficiency.
I think it would be more elegant, not to say more efficient, if factorio supported power and efficiency tweaking natively.
The settings that control the Nuclear Reactor specifically are Prototype/Reactor/consumption and Prototype/Reactor/energy_source/effectivity. Neither of these values are accessible from the LUA. For a flexibility sake it might be better to grant access not at the reactor level, but, say, at the burner level.
It would, of course, be slightly easier with Factorio2 because we'll be able to dynamically create a prototype with required efficiency and power settings, but it will still be ugly because the reactor entity will have to be replaced every few ticks.
I was recently trying to add some new functionality to the RealisticReactors mod and have noticed that they use a rather ugly hack to dynamically set the reactor efficiency and the power: they create 250 reactor prototypes with power output from 1 to 250 MW and then replace the reactor every time its power output has to change. For efficiency it is even worse: a fake fuel cell with some enormous energy content is used and the remaining fuel is added or removed to the actual fuel cell depending on whether the reactor is running above or below 100% efficiency.
I think it would be more elegant, not to say more efficient, if factorio supported power and efficiency tweaking natively.
The settings that control the Nuclear Reactor specifically are Prototype/Reactor/consumption and Prototype/Reactor/energy_source/effectivity. Neither of these values are accessible from the LUA. For a flexibility sake it might be better to grant access not at the reactor level, but, say, at the burner level.
It would, of course, be slightly easier with Factorio2 because we'll be able to dynamically create a prototype with required efficiency and power settings, but it will still be ugly because the reactor entity will have to be replaced every few ticks.