Mod migration not enabling tech

Place to get help with not working mods / modding interface.
evandy
Fast Inserter
Fast Inserter
Posts: 241
Joined: Mon Apr 15, 2019 2:54 am
Contact:

Mod migration not enabling tech

Post 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.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1760
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Mod migration not enabling tech

Post 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. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
evandy
Fast Inserter
Fast Inserter
Posts: 241
Joined: Mon Apr 15, 2019 2:54 am
Contact:

Re: Mod migration not enabling tech

Post by evandy »

I will go try it out tonight when home. Thanks
evandy
Fast Inserter
Fast Inserter
Posts: 241
Joined: Mon Apr 15, 2019 2:54 am
Contact:

Re: Mod migration not enabling tech

Post 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.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1760
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Mod migration not enabling tech

Post by Pi-C »

Glad I could help! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”