Continually updating data.lua values?
-
- Inserter
- Posts: 36
- Joined: Thu Apr 14, 2016 2:01 am
- Contact:
Continually updating data.lua values?
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?
Re: Continually updating data.lua values?
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
See also: https://wiki.factorio.com/index.php?tit ... _Lifecycle
-
- Inserter
- Posts: 36
- Joined: Thu Apr 14, 2016 2:01 am
- Contact:
Re: Continually updating data.lua values?
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