How to cope with new mods on existing map

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

How to cope with new mods on existing map

Post by DRY411S »

Sorry if this has been asked before, but searches I have done have confused me.

I'm trying to understand how to deal with new mods on an existing map, that aren't my mod, but which have caused my mod to produce new recipes when factorio is initially started, or restarted when players update/add/delete mods.

As I understand it:
  1. Launch factorio
  2. Mods can alter data.raw tables in 3 separate phases
  3. factorio loads data.raw into (mostly) read-only storage
  4. user starts new game or loads saved game
  5. If the user has added a mod previously unused in the saved game, or a mod has been updated, then the mod's migration script runs. The migration script can force rebuilding of some data.raw structures, by calling built-in functions like reset_recipes for example.
Hope that's right. Here's my questions.
  1. How can my mod, which looks for all installed mods at the data stage and builds recycling recipes for those mods, add any new recipes into the saved game if a user has just started using a new mod? My mod hasn't changed, so my migration script won't run.
  2. It looks as I could use this: http://lua-api.factorio.com/latest/LuaB ... on_changed but if I create a function, when is my function called in the bootstrap please?
  3. Is it really going to be as easy as having a function that just calls reset_recipes?
Rseding91
Factorio Staff
Factorio Staff
Posts: 16016
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: How to cope with new mods on existing map

Post by Rseding91 »

You don't ever need to call "reset recipes" -> it's done automatically any time anything changes mod wise. Just pretend like it doesn't exist.

All you need to do is setup your recipes in the data.lua stage and you're done.
If you want to get ahold of me I'm almost always on Discord.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: How to cope with new mods on existing map

Post by DRY411S »

Rseding91 wrote:You don't ever need to call "reset recipes" -> it's done automatically any time anything changes mod wise. Just pretend like it doesn't exist.

All you need to do is setup your recipes in the data.lua stage and you're done.
OK, but what people are telling me is that if they have started a map with my mod, and then they add another mod, then my mod does not produce 'recycling recipes' for the other mod that they've started using.

When they start factorio after adding the new mod, then my mod will produce the recycling recipes, so the recycling recipes are on any new game/map, but they don't get added to any existing saves where they want to use the new mod that they are using.

Or are they wrong/confused? Because I sure am. :)
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to cope with new mods on existing map

Post by DaveMcW »

Please attach:

1. A save created with only your mod.
2. Your mod
3. Another mod that fails when added to the save.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: How to cope with new mods on existing map

Post by DRY411S »

DaveMcW wrote:Please attach:

1. A save created with only your mod.
2. Your mod
3. Another mod that fails when added to the save.
  1. afk but will do Asap
  2. Its Recycling Machines on the mod portal
  3. im being advised that every mod that is added to a saved game after mine has previously been added, is not recognised by my mod. To be clear, the other mods are not failing, MY MOD is failing in the sense that users cannot recycle anything that the added mod can assemble. Discussed at viewtopic.php?f=93&t=31692#p290535
Edit: I am now failing to reproduce this problem that is being reported to me, and seeing the behaviour described by Rseding above, so maybe there is no problem to solve.

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

Re: How to cope with new mods on existing map

Post by bobingabout »

DRY411S wrote:
DaveMcW wrote:Please attach:

1. A save created with only your mod.
2. Your mod
3. Another mod that fails when added to the save.
  1. afk but will do Asap
  2. Its Recycling Machines on the mod portal
  3. im being advised that every mod that is added to a saved game after mine has previously been added, is not recognised by my mod. To be clear, the other mods are not failing, MY MOD is failing in the sense that users cannot recycle anything that the added mod can assemble. Discussed at viewtopic.php?f=93&t=31692#p290535
Edit: I am now failing to reproduce this problem that is being reported to me, and seeing the behaviour described by Rseding above, so maybe there is no problem to solve.

Stand By.....
there was a relatively recent change that made this trigger more often too. That would likely have fixed any of these issues.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: How to cope with new mods on existing map

Post by DRY411S »

bobingabout wrote:there was a relatively recent change that made this trigger more often too. That would likely have fixed any of these issues.
That would explain it. Gosh, I hate it when I'm asked to find and fix a problem that doesn't exist. I almost hope that it does, but it's looking less likely. I've asked the most recent reporter of the problem for details of exact mods that are showing this behaviour. I cannot find one.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: How to cope with new mods on existing map

Post by DRY411S »

Can mods please close and/or delete this topic. It is a non-issue. The behaviour that I describe in the first post is not correct, and therefore the questions I ask are invalid.

Apologies for wasting anybody's time.
Post Reply

Return to “Modding help”