Continually updating data.lua values?

Place to get help with not working mods / modding interface.
catalyst518
Inserter
Inserter
Posts: 36
Joined: Thu Apr 14, 2016 2:01 am
Contact:

Continually updating data.lua values?

Post by catalyst518 »

I'm trying to create a mod that continually updates some object parameters found in data.raw as different events happen in game. Since data.lua values are only read on game loads, it seems the only way to increase a parameter over time would be to create a bunch of new nearly identical entities each representing one of the increments of the targeted parameter. Then, once an event is triggered, all affected entities are replaced with the next higher up entity. Is there any alternative way to get a similar result?
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Continually updating data.lua values?

Post by daniel34 »

No, data.lua parameters can only be loaded on game launches. Like you said, only several entities already defined in data.lua with varying parameters and replacing them in-game could do that.

See also: https://wiki.factorio.com/index.php?tit ... _Lifecycle
quick links: log file | graphical issues | wiki
catalyst518
Inserter
Inserter
Posts: 36
Joined: Thu Apr 14, 2016 2:01 am
Contact:

Re: Continually updating data.lua values?

Post by catalyst518 »

Thanks. I at least figured out an efficient method to define all the new entities. Rather than typing out a bunch of new entity definitions and then having a bunch of if, thens in control.lua, I used a couple for loops to define and update the entities. Here it is in action for anyone looking for an example: viewtopic.php?f=93&t=23704
Post Reply

Return to “Modding help”