[Solved] How to delete a recipe defined in the base mod?

Place to get help with not working mods / modding interface.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

[Solved] How to delete a recipe defined in the base mod?

Post 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?
Last edited by Impatient on Wed Feb 28, 2018 12:04 am, edited 1 time in total.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3725
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: [0.16.26] How to delete a recipe defined in the base mod?

Post 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
crafting.jpg (31.78 KiB) Viewed 4504 times
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.16.26] How to delete a recipe defined in the base mod?

Post by Bilka »

DaveMcW wrote:It seems impossible. There are 6 recipes that cannot be disabled.
58203
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.16.26] How to delete a recipe defined in the base mod?

Post 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
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3725
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: [0.16.26] How to delete a recipe defined in the base mod?

Post by DaveMcW »

Ok that does work. What a terrible design.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: [0.16.26] How to delete a recipe defined in the base mod?

Post 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.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: [0.16.26] How to delete a recipe defined in the base mod?

Post 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!
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: [0.16.26] How to delete a recipe defined in the base mod?

Post 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)
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: [Solved] How to delete a recipe defined in the base mod?

Post 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!
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [Solved] How to delete a recipe defined in the base mod?

Post 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.
Post Reply

Return to “Modding help”