Including new recipe on vanilla tech when it's already researched

Topics and discussion about specific mods
Chess
Inserter
Inserter
Posts: 35
Joined: Thu Sep 17, 2015 9:08 pm
Contact:

Including new recipe on vanilla tech when it's already researched

Post by Chess »

I'm creating a mod with a new combinator that interacts with trains and I'd like to unlock it with the vanilla "circuit-network" technology. This is how I do it:

technology.lua

Code: Select all

table.insert(data.raw["technology"]["circuit-network"].effects, {type = "unlock-recipe",recipe = "train-requests-reader"})
But it doesn't work in saves that already researched that technology. How can I fix that?

Thank you.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Including new recipe on vanilla tech when it's already researched

Post by Pi-C »

Chess wrote: Sun Jul 18, 2021 9:56 pm I'm creating a mod with a new combinator that interacts with trains and I'd like to unlock it with the vanilla "circuit-network" technology. …
But it doesn't work in saves that already researched that technology. How can I fix that?
If your mod was added to an existing game, script.on_init will be triggered for your mod. Just add this to your event handler:

Code: Select all

for _, force in pairs(game.forces) do
  force.reset_technology_effects()
end
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Chess
Inserter
Inserter
Posts: 35
Joined: Thu Sep 17, 2015 9:08 pm
Contact:

Re: Including new recipe on vanilla tech when it's already researched

Post by Chess »

It worked, thank you! :D
Post Reply

Return to “Mods”