Page 1 of 1
[Solved] How to delete a recipe defined in the base mod?
Posted: Tue Feb 27, 2018 9:46 pm
by Impatient
I would like to remove the base mod's recipe for electronic circuits.
I tried this
(data.lua)
Code: Select all
data.raw.recipe["electronic-circuit"].enabled = false
data.raw.recipe["electronic-circuit"].normal.enabled = false
data.raw.recipe["electronic-circuit"].expensive.enabled = false
but this has no effect. I also put it in data-final-fixes.lua, - no effect.
I also dared to do this
(data.lua)
Code: Select all
data.raw.recipe["electronic-circuit"] = nil
which resuited in this error
viewtopic.php?f=25&t=58196 .
I found out that using the console command
Code: Select all
/c game.player.force.recipes["electronic-circuit"].enabled=false
will disable the recipe for me in-game. So, it should be possible to disable it via control.lua in on_init() and on_load() for the play session globally (for all forces and players). Correct? Does anyone know the correct commands and where to put them?
Any other ideas how i can achieve the removal of a recipe from the base mod?
Re: [0.16.26] How to delete a recipe defined in the base mod?
Posted: Tue Feb 27, 2018 10:49 pm
by DaveMcW
It seems impossible. There are 6 recipes that cannot be disabled.
Code: Select all
for _,recipe in pairs(data.raw.recipe) do
recipe.enabled = false
end
- crafting.jpg (31.78 KiB) Viewed 4501 times
Re: [0.16.26] How to delete a recipe defined in the base mod?
Posted: Tue Feb 27, 2018 11:05 pm
by Bilka
DaveMcW wrote:It seems impossible. There are 6 recipes that cannot be disabled.
58203
Re: [0.16.26] How to delete a recipe defined in the base mod?
Posted: Tue Feb 27, 2018 11:09 pm
by eradicator
If brute forcing doesn't work. Maybe use a more
expensive hammer?
Code: Select all
for _,recipe in pairs(data.raw.recipe) do
recipe.enabled = false
if recipe.normal then
recipe.normal.enabled = false
end
if recipe.expensive then
recipe.expensive.enabled = false
end
end
Re: [0.16.26] How to delete a recipe defined in the base mod?
Posted: Tue Feb 27, 2018 11:37 pm
by DaveMcW
Ok that does work. What a terrible design.
Re: [0.16.26] How to delete a recipe defined in the base mod?
Posted: Tue Feb 27, 2018 11:44 pm
by Impatient
Bilka wrote:DaveMcW wrote:It seems impossible. There are 6 recipes that cannot be disabled.
58203
This a link to another question I asked. But this seems to work only for custom recipes. Not for the ones from the base mod.
Re: [0.16.26] How to delete a recipe defined in the base mod?
Posted: Tue Feb 27, 2018 11:53 pm
by Impatient
DaveMcW wrote:Ok that does work. What a terrible design.
hey, that is unfair, i put this into data-final-fixes.lua but all it does is to remove the custom recipes, not the base ones. where do i need to put this code? Thanks!
Re: [0.16.26] How to delete a recipe defined in the base mod?
Posted: Wed Feb 28, 2018 12:02 am
by Impatient
OMG!
I tested all the solutions, including my own, initial code with a savegame all the time. (quadruple facepalm).
When I start a new game, the recipe(s) is/are removed properly. My own code from 3.5 hours ago works as well. ... (facepalm)
Re: [Solved] How to delete a recipe defined in the base mod?
Posted: Wed Feb 28, 2018 1:03 am
by Impatient
Thank you a lot for your help, so I finally could figure out what is going on.
I posted a follow up question (
viewtopic.php?f=25&t=58259 ). Mentioning it, in case you are interested in the learning journey of a modding rookie - meaning, maybe you can help with that one as well?
Thanks a bunch!
Re: [Solved] How to delete a recipe defined in the base mod?
Posted: Wed Feb 28, 2018 8:10 pm
by Arch666Angel
If a recipe has normal/expensive defined, you need to set the value for both modes. Setting base game item/recipes/techs/entities in general is a bad idea, because everyone is expecting stuff to be there, so if you want to make it unusable use the hidden = true tag, so it will stay in but is not selectable, this might still cause issues you have to solve, but it at least wont let your game implode.