reset_recipes and reset_technologies question

Place to get help with not working mods / modding interface.
Post Reply
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

reset_recipes and reset_technologies question

Post 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

Rseding91
Factorio Staff
Factorio Staff
Posts: 13267
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: reset_recipes and reset_technologies question

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: reset_recipes and reset_technologies question

Post 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.)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13267
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: reset_recipes and reset_technologies question

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: reset_recipes and reset_technologies question

Post 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?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13267
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: reset_recipes and reset_technologies question

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: reset_recipes and reset_technologies question

Post 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.

Post Reply

Return to “Modding help”