Variable power usage

Place to get help with not working mods / modding interface.
Post Reply
wahming
Fast Inserter
Fast Inserter
Posts: 190
Joined: Sun May 17, 2015 8:30 pm
Contact:

Variable power usage

Post by wahming »

Is there any way to change the amount of energy being used by a building?

FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: Variable power usage

Post by FishSandwich »

entities.lua

Code: Select all

energy_usage = "150kW",
"for example".

wahming
Fast Inserter
Fast Inserter
Posts: 190
Joined: Sun May 17, 2015 8:30 pm
Contact:

Re: Variable power usage

Post by wahming »

FishSandwich wrote:entities.lua

Code: Select all

energy_usage = "150kW",
"for example".
Oh sorry, I wasn't clear enough. Is there any way to change the energy usage dynamically, ingame?

Incinirate
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sun May 03, 2015 9:50 pm
Contact:

Re: Variable power usage

Post by Incinirate »

wahming wrote:
FishSandwich wrote:entities.lua

Code: Select all

energy_usage = "150kW",
"for example".
Oh sorry, I wasn't clear enough. Is there any way to change the energy usage dynamically, ingame?
Quoting from the wiki here, (https://forums.factorio.com/wiki/inde ... g_overview)

Changing existing definitions:

Code: Select all

data.raw.ammo["piercing-bullet-magazine"].magazine_size = 20
Or in your case, something like this?

Code: Select all

data.raw.assembling-machine["assembling-machine-2"].energy_usage = "300kW"

wahming
Fast Inserter
Fast Inserter
Posts: 190
Joined: Sun May 17, 2015 8:30 pm
Contact:

Re: Variable power usage

Post by wahming »

Incinirate wrote: Quoting from the wiki here, (https://forums.factorio.com/wiki/inde ... g_overview)

Changing existing definitions:

Code: Select all

data.raw.ammo["piercing-bullet-magazine"].magazine_size = 20
Or in your case, something like this?

Code: Select all

data.raw.assembling-machine["assembling-machine-2"].energy_usage = "300kW"
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
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sun May 03, 2015 9:50 pm
Contact:

Re: Variable power usage

Post by Incinirate »

wahming wrote:
Incinirate wrote: Quoting from the wiki here, (https://forums.factorio.com/wiki/inde ... g_overview)

Changing existing definitions:

Code: Select all

data.raw.ammo["piercing-bullet-magazine"].magazine_size = 20
Or in your case, something like this?

Code: Select all

data.raw.assembling-machine["assembling-machine-2"].energy_usage = "300kW"
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.
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.

Wyrm
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Fri Jan 30, 2015 3:56 am
Contact:

Re: Variable power usage

Post by Wyrm »

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.

Post Reply

Return to “Modding help”