Hi all, could some one tell me how would i lock a recipe from another mod where the line reads "enable = true" (i want to lock it from start and enable it trough technology research witch i already done with the following line
table.insert(data.raw["technology"]["electric-machinery"].effects,{type = "unlock-recipe",recipe = "electric-stone-furnace"})
now i need to disable it from the very beginning of the game,i can achieve this by editing the mod directly but i would like to create my own set of tweaks in my mod with "table.insert" if possible to edit that specific line where it reads "enabled = true" to "enabled = false" i am using data-updates.lua to do this
[SOLVED][Help] Lock item
[SOLVED][Help] Lock item
Last edited by dtoxic on Wed Jan 25, 2023 3:06 pm, edited 1 time in total.
Re: [Help] Lock item
so i manages to do it like this
if (mods or script.active_mods)["Electric Furnaces"] then
data:extend{
{
type = "recipe",
name = "electric-stone-furnace",
ingredients = {nil}, -- if leave it like this then no materials are required to craft this,if i put the default required materials then i get conflict with other mods on start
result = "electric-stone-furnace",
enabled = false, ----this is the only property i would like to change for this particular item in another mod from True to False
}
}
end
So any wizards here,please do cast your spells
if (mods or script.active_mods)["Electric Furnaces"] then
data:extend{
{
type = "recipe",
name = "electric-stone-furnace",
ingredients = {nil}, -- if leave it like this then no materials are required to craft this,if i put the default required materials then i get conflict with other mods on start
result = "electric-stone-furnace",
enabled = false, ----this is the only property i would like to change for this particular item in another mod from True to False
}
}
end
So any wizards here,please do cast your spells
-
- Fast Inserter
- Posts: 214
- Joined: Fri Oct 05, 2018 4:34 pm
- Contact:
Re: [Help] Lock item
You can access the tables of existing prototypes through data.raw. If I'm not mistaken then something like
should do what you want to achieve.
Code: Select all
data.raw["recipe"]["electronic-stone-furnace"].enabled = false
Re: [Help] Lock item
thx for the input but this does not seem to work,and i belive this will not work since this is not a vanilla item it's from another mod...so the question is how access a item prototype data from another mod
Error ModManager.cpp Failed to load mod "Misc Tweaks": __Misc Tweaks__/data-final-fixes.lua:3: attempt to index field 'recipe' (a nil value)
Error ModManager.cpp Failed to load mod "Misc Tweaks": __Misc Tweaks__/data-final-fixes.lua:3: attempt to index field 'recipe' (a nil value)
Re: [Help] Lock item
Hornwitser is right, that should work. Data.raw is shared between all the mods, so as long as the other mod has added their prototypes first, your mod can change them. Post your code that produced the error so we can help find where the issue is.
My mods: Multiple Unit Train Control, Smart Artillery Wagons
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Re: [Help] Lock item
Is the recipe called "electronic-stone-funrace" or "electric-stone-furnace"? There seems to be inconsitency between previous posts in this thread.
I think Hornwizter misspelled the recipe and with the right spelling it should work.
I think Hornwizter misspelled the recipe and with the right spelling it should work.
Re: [Help] Lock item
Yeap...i am blind officially! that was it...and here i was reading over tons of documentation to find what was wrong and the most simplest mistake goes unseen....hahahaah
Thx for noticing this you saved me from going insane!
Thx for noticing this you saved me from going insane!
Re: [Help] Lock item
So here is now the working code if anyone else is in need of locking recipes for other mods
This one locks 2 items in the Electric Furnaces mod and moves them further down in the tech tree to a technology used by another mod called Early Extensions
Thanks guys for all the help and @ichVII for your eyes
This one locks 2 items in the Electric Furnaces mod and moves them further down in the tech tree to a technology used by another mod called Early Extensions
Code: Select all
table.insert(data.raw["technology"]["electric-machinery"].effects,{type = "unlock-recipe",recipe = "electric-stone-furnace"})
table.insert(data.raw["technology"]["electric-machinery"].effects,{type = "unlock-recipe",recipe = "electric-boiler"})
data.raw["recipe"]["electric-stone-furnace"].enabled = false
data.raw["recipe"]["electric-boiler"].enabled = false