Variable power usage
Variable power usage
Is there any way to change the amount of energy being used by a building?
-
- Smart Inserter
- Posts: 1847
- Joined: Sun Feb 23, 2014 3:37 pm
- Contact:
Re: Variable power usage
entities.lua
"for example".
Code: Select all
energy_usage = "150kW",
Re: Variable power usage
Oh sorry, I wasn't clear enough. Is there any way to change the energy usage dynamically, ingame?FishSandwich wrote:entities.lua"for example".Code: Select all
energy_usage = "150kW",
-
- Burner Inserter
- Posts: 18
- Joined: Sun May 03, 2015 9:50 pm
- Contact:
Re: Variable power usage
Quoting from the wiki here, (https://forums.factorio.com/wiki/inde ... g_overview)wahming wrote:Oh sorry, I wasn't clear enough. Is there any way to change the energy usage dynamically, ingame?FishSandwich wrote:entities.lua"for example".Code: Select all
energy_usage = "150kW",
Changing existing definitions:
Code: Select all
data.raw.ammo["piercing-bullet-magazine"].magazine_size = 20
Code: Select all
data.raw.assembling-machine["assembling-machine-2"].energy_usage = "300kW"
Re: Variable power usage
I've never been able to get that piece of code to work in control.lua or the console. Somebody told me in another thread that it's only valid if processed at game startup. Please let me know if it works for you, and how.Incinirate wrote: Quoting from the wiki here, (https://forums.factorio.com/wiki/inde ... g_overview)
Changing existing definitions:Or in your case, something like this?Code: Select all
data.raw.ammo["piercing-bullet-magazine"].magazine_size = 20
Code: Select all
data.raw.assembling-machine["assembling-machine-2"].energy_usage = "300kW"
-
- Burner Inserter
- Posts: 18
- Joined: Sun May 03, 2015 9:50 pm
- Contact:
Re: Variable power usage
Yeah, I guess that makes sense since all the prototypes are loaded at game startup and all their properties are stored in a C construct. Hmm, it's so frustrating that we don't have any type of interface to work with the existing prototypes, I had this same problem attempting to change a recipe at runtime.wahming wrote:I've never been able to get that piece of code to work in control.lua or the console. Somebody told me in another thread that it's only valid if processed at game startup. Please let me know if it works for you, and how.Incinirate wrote: Quoting from the wiki here, (https://forums.factorio.com/wiki/inde ... g_overview)
Changing existing definitions:Or in your case, something like this?Code: Select all
data.raw.ammo["piercing-bullet-magazine"].magazine_size = 20
Code: Select all
data.raw.assembling-machine["assembling-machine-2"].energy_usage = "300kW"
Re: Variable power usage
Did you remember to pass your energy consumption change function to an event handler? Just asking, because code that is to be run in mods are triggered during events.