If my mod makes a reset_recipes and reset_technologies call, does this cause the 'data' stage for ALL mods to run or just mine?
Sometimes when I ask these types of questions, I think there must be a way of finding out without debug statements in code, by inspecting log files, switching on logging or something
reset_recipes and reset_technologies question
Re: reset_recipes and reset_technologies question
reset recipes and reset technologies doesn't cause the data stage to run ever. It simply re-loads the runtime definitions of the associated object for the force you run it against.
So, if you had a recipe with 1 wooden chest and 1 iron plate and you changed it, reset recipes would cause the recipe in-game to change to the new one instead of keeping the old.
It's also called automatically when ever a mod is added, removed, or a version changes.
So, if you had a recipe with 1 wooden chest and 1 iron plate and you changed it, reset recipes would cause the recipe in-game to change to the new one instead of keeping the old.
It's also called automatically when ever a mod is added, removed, or a version changes.
If you want to get ahold of me I'm almost always on Discord.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: reset_recipes and reset_technologies question
Is that a new one? I recall having to add these lines to the top of basically every migration script I do, in fact some are pretty much nothing but these 2 lines. (in a for pairs loop to do it for every force.)Rseding91 wrote:It's also called automatically ... or a version changes.
Re: reset_recipes and reset_technologies question
It was added at some point mid 0.12. I believe it's in the changelog but I'm not 100% sure on that.bobingabout wrote:Is that a new one? I recall having to add these lines to the top of basically every migration script I do, in fact some are pretty much nothing but these 2 lines. (in a for pairs loop to do it for every force.)Rseding91 wrote:It's also called automatically ... or a version changes.
If you want to get ahold of me I'm almost always on Discord.
Re: reset_recipes and reset_technologies question
But recipe ingredients are read-only in everything except the data stage? So you cannot change them?Rseding91 wrote:<snip>So, if you had a recipe with 1 wooden chest and 1 iron plate and you changed it, reset recipes would cause the recipe in-game to change to the new one instead of keeping the old.<snip>
Re: reset_recipes and reset_technologies question
Correct. The original plan (and still now for 0.14) is to allow changing recipes runtime.DRY411S wrote:But recipe ingredients are read-only in everything except the data stage? So you cannot change them?Rseding91 wrote:<snip>So, if you had a recipe with 1 wooden chest and 1 iron plate and you changed it, reset recipes would cause the recipe in-game to change to the new one instead of keeping the old.<snip>
If you want to get ahold of me I'm almost always on Discord.
Re: reset_recipes and reset_technologies question
Sorry quite new to this modding malarkey. What do you mean by 'runtime'? Runtime to me means after the data stage and on_init. My understanding was that after that, you cannot change recipes other than the 'enabled' property.
http://lua-api.factorio.com/0.12.35/LuaRecipe.html
My question relates to 0.12.x, are you replying for 0.13.x and above?
If I understand what you say about the reset_recipes and reset_technologies NEVER causing the data stages to re-rerun, then essentially these calls just resets the enabled property to whatever it was at the beginning of the game world.
http://lua-api.factorio.com/0.12.35/LuaRecipe.html
My question relates to 0.12.x, are you replying for 0.13.x and above?
If I understand what you say about the reset_recipes and reset_technologies NEVER causing the data stages to re-rerun, then essentially these calls just resets the enabled property to whatever it was at the beginning of the game world.