Page 1 of 1

Migration script for a mod disabling technologies

Posted: Fri Jun 19, 2020 4:40 pm
by Pleykorn
Hi,

I don't know programming but love the game and tried to do some little mods by finding mods doing sufficiently similar things and adapting it for me with the (huge) help of the Factorio wiki and I usually get to where I want.

My issue is with a mod that disable military technologies (for alienless runs): SPM No Military Science

The changes don't apply to an old save. From what I read it's actually expected since the tree tech is not generated each load so I learnt that I had to do a migration script. Reading stuff here and there (but very scarce, I found very little infos about migration scripts), it appeared to me that I had to do a reset_technologies() in the script, so copying from another mod I created a 'migrations' folder and put a lua file into it with the following code:

Code: Select all

for i, force in pairs(game.forces) do 
  force.reset_recipes()
  force.reset_technologies()
end
But when I load an old save of a game started wihtout this mod with the mod active, it doesn't change anything. Since this is something I barely understand, I'm starting to feel in a dead end and would greatly appreciate some help! :ugeek: