Page 1 of 1

[0.16.39][Modding] Disabling recipe electric-mining-drill

Posted: Tue May 01, 2018 7:18 pm
by lovely_santa
Hi,

I'm trying to disable the electric mining drill recipe in the prototyping stage by:

Code: Select all

data.raw["recipe"]["electric-mining-drill"].enabled = false
When entering a (new) game, even with only this line of code in a blanco mod, it will still show the recipe in the crafting menu.

Greetings,
lovely_santa

Re: [0.16.39][Modding] Disabling recipe electric-mining-drill

Posted: Tue May 01, 2018 7:24 pm
by Deadlock989
Had similar issues and asked here for help in the past, enabled is part of the difficulty settings for some reason, so if expensive and normal are defined, you have to check those. So annoying, but not a bug.

Code: Select all

-- thanks to Bilka
local function disable_recipe(recipe)
   if not data.raw.recipe[recipe] then return end
   if data.raw.recipe[recipe].normal then
      data.raw.recipe[recipe].normal.enabled = false
      data.raw.recipe[recipe].expensive.enabled = false
   else
      data.raw.recipe[recipe].enabled = false
   end
end

Re: [0.16.39][Modding] Disabling recipe electric-mining-drill

Posted: Tue May 01, 2018 7:42 pm
by Bilka
To prevent further confusion in the future: Everything in the recipe data section here is part of normal/expensive property if those exist: https://wiki.factorio.com/Prototype/Recipe

Re: [0.16.39][Modding] Disabling recipe electric-mining-drill

Posted: Wed May 02, 2018 5:28 am
by lovely_santa
Time to mine that data out of the wiki, thanks bilka