I'm wanting to have an existing technology unlock an item/recipe I have added. Is there a way to extend an existing technology to also unlock my recipes?
Thank you.
Technology/Research Unlocks
Re: Technology/Research Unlocks
Yes, you'd want to do that in the data.lua (or other staged variant).
This would add the recipe unlock "compression-chest" to the "logistics-3" research:
Keep in mind, this doesn't retroactively unlock the recipe if you load the mod into a game where logistics-3 has already been researched.
To fix that you'd need to read FreeER's reply below
This would add the recipe unlock "compression-chest" to the "logistics-3" research:
Code: Select all
table.insert(data.raw["technology"]["logistics-3"].effects,{type="unlock-recipe",recipe="compression-chest"})
To fix that you'd need to read FreeER's reply below
Last edited by Rseding91 on Mon Feb 09, 2015 9:19 pm, edited 1 time in total.
If you want to get ahold of me I'm almost always on Discord.
Re: Technology/Research Unlocks
the other staged variants are data-updates.lua and data-final-fixes.lua (loaded in that order, they mostly allow not specifying as many optional dependencies for other mods). Also you'd want to make sure that if someone adds the mod to an already started save that it unlocks the recipe as desired The best way to do that is a migration script, create a folder called "migrations" and add a .lua file inside (name is usually mod-version and/or date or just something relevant) and use this codeRseding91 wrote:Yes, you'd want to do that in the data.lua (or other staged variant).
Code: Select all
for _, force in pairs(game.forces) do
force.resetrecipes()
force.resettechnologies()
-- create tech/recipe table once
local techs = force.technologies
local recipes = force.recipes
if techs["logistics-3"].researched then
recipes["compression-chest"].enabled = true
end
end
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me
Or drop into #factorio on irc.esper.net
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me
Or drop into #factorio on irc.esper.net
Re: Technology/Research Unlocks
Ah yes, that's what I was looking for. Thanks.FreeER wrote:Rseding91 you should see this post by kovarex
If you want to get ahold of me I'm almost always on Discord.
Re: Technology/Research Unlocks
Thank you both so much I should be able to publish it today.
I spent about 20 minutes searching the forums and wiki for an answer but apparently I can't search worth crap.
I spent about 20 minutes searching the forums and wiki for an answer but apparently I can't search worth crap.