Hi all,
I need some hints for which keyword I have to look into.
Background:
I updated my first mod in the last days MathCoProcessor
I had a sandoxbox save but also another player has observed the behavior in the normal game.
Steps I have done:
- The recipe in my mod 0.17.0 unlocked 3 items
- Then I added more items to the same recipe
- The uploaded mod 0.17.1 recipe should have 7 items but still only the old 3 items can be crafted. In the tech window 7 items are shown.
Workaround:
resetting the research and re-unlock all technologies bring all items in the craft window.
Must be there an update script within the mod?
Thx in advance
[SOLVED] Missing new added items after updating mod
[SOLVED] Missing new added items after updating mod
Last edited by Cobaltur on Fri Sep 20, 2019 7:59 am, edited 1 time in total.
Re: Missing new added items after updating mod
You're on the right track, have a look at migration scripts! Your script could be as simple as this:
Code: Select all
for _, force in pairs(game.forces) do
force.reset_recipes()
force.reset_technologies()
end
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: Missing new added items after updating mod
thanks a lot.
my migrations script
my migrations script
Code: Select all
for index, force in pairs(game.forces) do
local technologies = force.technologies
local recipes = force.recipes
if technologies["math-combinators-2"].researched then
local names = {"avg-combinator","med-combinator", "sum-combinator", "cnt-combinator" }
for i, name in ipairs(names) do
recipes[name].enabled = true
recipes[name].reload()
end
end
end
Re: Missing new added items after updating mod
You're welcome!
I can't see anything wrong with it on a quick glance-over, perhaps somebody else will …my migrations script
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: [SOLVED] Missing new added items after updating mod
I don't like the reset_recipes and reset_technologies, they are disable already enabled recipes.
Re: [SOLVED] Missing new added items after updating mod
Are you sure? I think I tried it and kept researched recipes. May be that was with Creative Mod enabled (can't tell exactly anymore), but I remember being wary of X_reset() because all changes would be lost while it actually reloaded everything (including changes to recipes/technologies by mods).
Needless to say, reloading just specific recipies is more accurate then a global reset -- my example was meant to show the easiest way (from a modder's perspective -- writing a single command is easier than iterating through a list of recipes and executing a command on each entry), which also happens to be the most radical way.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [SOLVED] Missing new added items after updating mod
They're sledgehammers that will destroy all "manual" changes made by mods, like unlocking recipes for exploring the map (like in seablock etc). BUT, they exist in the API. They're easy to use. And lots of mods do use them, and i think even vanilla uses them sometimes. So as a mod author you can not rely on them not being called. If a mod wants to do manual changes there's no way around dealing with the fallout of those sledgehammers.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- BlueTemplar
- Smart Inserter
- Posts: 3147
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: [SOLVED] Missing new added items after updating mod
Is there no way for these mods to extend these commands to include manual changes ?
BobDiggity (mod-scenario-pack)
Re: [SOLVED] Missing new added items after updating mod
Enabling hidden technologies?BlueTemplar wrote: ↑Tue Sep 24, 2019 11:31 am Is there no way for these mods to extend these commands to include manual changes ?
- BlueTemplar
- Smart Inserter
- Posts: 3147
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: [SOLVED] Missing new added items after updating mod
Relevant discussion about this category of issue in this thread :
viewtopic.php?p=454026#p454026
viewtopic.php?p=454026#p454026
BobDiggity (mod-scenario-pack)