Page 1 of 1
reset_recipes and reset_technologies question
Posted: Wed Jun 22, 2016 6:47 am
by DRY411S
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
Re: reset_recipes and reset_technologies question
Posted: Wed Jun 22, 2016 7:51 am
by Rseding91
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.
Re: reset_recipes and reset_technologies question
Posted: Wed Jun 22, 2016 8:03 am
by bobingabout
Rseding91 wrote:It's also called automatically ... or a version changes.
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.)
Re: reset_recipes and reset_technologies question
Posted: Wed Jun 22, 2016 8:08 am
by Rseding91
bobingabout wrote:Rseding91 wrote:It's also called automatically ... or a version changes.
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.)
It was added at some point mid 0.12. I believe it's in the changelog but I'm not 100% sure on that.
Re: reset_recipes and reset_technologies question
Posted: Wed Jun 22, 2016 8:49 am
by DRY411S
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>
But recipe ingredients are read-only in everything except the data stage? So you cannot change them?
Re: reset_recipes and reset_technologies question
Posted: Wed Jun 22, 2016 9:19 am
by Rseding91
DRY411S wrote: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>
But recipe ingredients are read-only in everything except the data stage? So you cannot change them?
Correct. The original plan (and still now for 0.14) is to allow changing recipes runtime.
Re: reset_recipes and reset_technologies question
Posted: Wed Jun 22, 2016 10:06 am
by DRY411S
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.