I downloaded a burner pump mod and added it to an existing game. The item is researched with fluid handling. I have already researched fluid handling and the item is not unlocked unless I start a new game.
My question is, is there a way for me to unlock the burner pump without starting a new game or disabling my achievements?
BTW this is a multiplayer game.
Modded Item Not Unlocked
Re: Modded Item Not Unlocked
This is what I get when I try to fix. I don't want to disable achievements.
2021-11-14 12:50:17 [WARNING] Player <server> tried using the command "game.player.force.technologies['fluid-handling'].researched=false".
2021-11-14 12:50:17 [WARNING] Using Lua console commands will disable achievements. Please repeat the command to proceed.
2021-11-14 12:50:17 [WARNING] Player <server> tried using the command "game.player.force.technologies['fluid-handling'].researched=false".
2021-11-14 12:50:17 [WARNING] Using Lua console commands will disable achievements. Please repeat the command to proceed.
Re: Modded Item Not Unlocked
I also thought about modding the mod..
I found some info about control.lua and on_init or on_configuration_changed, but don't know what to try. If I use on_init and remove and re-add the mod, will it run?
Also, where do you say "on_init"? This is the code snippet I wanted to try:
I found some info about control.lua and on_init or on_configuration_changed, but don't know what to try. If I use on_init and remove and re-add the mod, will it run?
Also, where do you say "on_init"? This is the code snippet I wanted to try:
Code: Select all
for _, force in pairs(game.forces) do
if force.technologies["some-technology"].researched then
force.recipes["my-recipe"].enabled = true
end
end
Re: Modded Item Not Unlocked
The mod is missing a migration to enable the recipe. They go into a folder named 'migrations'. For example, for my Alternate Recipes mod, the migration for it is 'Alternate_Recipes_1.1.0\migrations\enable-recipes2.lua'
The following code should handle it if put into the migrations folder.
You can name the file whatever you want, it just has to be in the migrations folder and end in '.lua'.
The following code should handle it if put into the migrations folder.
Code: Select all
for index, force in pairs(game.forces) do
local technologies = force.technologies
local recipes = force.recipes
for nindex, effect in pairs(technologies["fluid-handling"].effects) do
--Set the recipe as researched if fluid-handling is.
if effect.type == "unlock-recipe" then
recipes[effect.recipe].enabled = technologies["fluid-handling"].researched
end
end
end
Re: Modded Item Not Unlocked
Nice! Worked like a charm. Thank you!
Re: Modded Item Not Unlocked
In this case, where it's just about applying effects to already researched technologies again, I'd even consider running the code from on_configuration_changed instead of a migration file. Reason: Other mods be may added/removed after your mod's migration script has run (each migration script is applied at most once per game), and if they add new prerequisites to your tech, you may want to un-research it again.Silari wrote: Sun Nov 14, 2021 7:25 pm The mod is missing a migration to enable the recipe. […]
You can name the file whatever you want, it just has to be in the migrations folder and end in '.lua'.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!