I've been asked if my mod for Recycling could be changed so that it can be added to previously saved worlds.
I think that means that I have to write a migration script, or an on_load script.
All my code is in the data phase and modifies (adds to) data.raw
I know the on_load doesn't expose data.raw. I think migrations phase doesn't either.
Is it possible in migrations or on_load to add to game.player.recipes (for example) or has it become read-only by then?
[SOLVED] Migrations
[SOLVED] Migrations
Last edited by DRY411S on Fri Jun 17, 2016 8:16 pm, edited 1 time in total.
Re: Migrations
Take a look at bobslogistics mod migration.
They are doing exactly what you need - there is a techa nd recipe reset to make sure recipes and tech costs are updated and new ones are added in.
There is also section that checks for already researched technologies and enables recipes as needed.
They are doing exactly what you need - there is a techa nd recipe reset to make sure recipes and tech costs are updated and new ones are added in.
There is also section that checks for already researched technologies and enables recipes as needed.
Re: Migrations
Thanks I had looked at mods like that. I've found lots of examples of reset_recipes and reset_technologies. Do these force factorio to reload from all the mod data.luas? The documentation and wiki aren't clear about this. Or at least they aren't clear to me.orzelek wrote:Take a look at bobslogistics mod migration.
They are doing exactly what you need - there is a techa nd recipe reset to make sure recipes and tech costs are updated and new ones are added in.
There is also section that checks for already researched technologies and enables recipes as needed.

Re: Migrations
Thats correct. Techs and recipes are stored in save so they need to be refreshed if data.raw has been changed by mods.DRY411S wrote:Thanks I had looked at mods like that. I've found lots of examples of reset_recipes and reset_technologies. Do these force factorio to reload from all the mod data.luas? The documentation and wiki aren't clear about this. Or at least they aren't clear to me.orzelek wrote:Take a look at bobslogistics mod migration.
They are doing exactly what you need - there is a techa nd recipe reset to make sure recipes and tech costs are updated and new ones are added in.
There is also section that checks for already researched technologies and enables recipes as needed.
Re: Migrations
Got it. Thanks.orzelek wrote: Thats correct. Techs and recipes are stored in save so they need to be refreshed if data.raw has been changed by mods.
