Change solar panel efficiency through modding API
Change solar panel efficiency through modding API
I'm trying to change the efficiency of solar panels depending on the pollution in a tile at runtime from within a mod. However, I can't find any way to influence the efficiency of a solar panel. Is there a way to change the efficiency of an electric source at runtime rather than changing the prototype directly?
Re: Change solar panel efficiency through modding API
You must add new prototype entities and replace all old withe new. I don't know why, something with optimization.
Last edited by darkfrei on Thu May 18, 2017 10:06 pm, edited 1 time in total.
Re: Change solar panel efficiency through modding API
I can't seem to change the power output even for solar panels I'm creating through code.
I also tried power_production='10kW', but that didn't work either.
Code: Select all
/c game.player.surface.create_entity({name='solar-panel',position=game.player.position,force=game.player.force,electric_output_flow_limit='10kW'})
Re: Change solar panel efficiency through modding API
Impossible. You can only change efficiency in data.lua.Xalos wrote:at runtime
The best you can do at runtime is replace it with a different version that you defined in data.lua.
Re: Change solar panel efficiency through modding API
So there's no way to change the efficiency linearly according to the current pollution? Darn.