Page 1 of 1

Mod migration not enabling tech

Posted: Thu Feb 27, 2020 1:27 pm
by evandy
I am completely new to modding factorio, so please be kind...

I am working on an update to angels and have everything working except the migration from an old save. There are a couple of disabled technologies that need to be enabled and I haven’t yet figured out how to make that work. Everything is good on a new save, so I am pretty certain this is just a migration problem.

Current migration Lua:

Code: Select all

 game.reload_script()

 for index, force in pairs(game.forces) do
	force.reset_recipes()
	force.reset_technology_effects()
end 
Is there an API reference somewhere I can search? Or just a pointer to how I can trigger three disabled techs to enable themselves. Thanks.

Re: Mod migration not enabling tech

Posted: Thu Feb 27, 2020 1:52 pm
by Pi-C
I've manually reset the technologies:

Code: Select all

local technologies = {
    "automobilism",
    "water_transport",
}

for _, force in pairs(game.forces) do
    for _, tech in ipairs(technologies) do
        if force.technologies[tech] and force.technologies[tech].researched then
            force.technologies[tech].researched = false
            force.technologies[tech].researched = true
        end
    end
end
Seems to work. :-)

Re: Mod migration not enabling tech

Posted: Thu Feb 27, 2020 2:17 pm
by evandy
I will go try it out tonight when home. Thanks

Re: Mod migration not enabling tech

Posted: Fri Feb 28, 2020 2:29 am
by evandy
Since I had to enable disabled techs I had to make a couple minor tweaks, but that worked just fine.

Thanks so much.

Re: Mod migration not enabling tech

Posted: Fri Feb 28, 2020 7:25 am
by Pi-C
Glad I could help! :-)