Oddities around disabling vanilla recipes

Place to get help with not working mods / modding interface.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Oddities around disabling vanilla recipes

Post by Deadlock989 »

Searched for this but can't sort out signal from noise.

I'm finding that some specific recipes seem to have their "enabled" flag overridden on game load. I've searched and I can't find the culprit. I thought it might be the freeplay scenario but don't see any calls to recipes there.

Essentially if you do things like this in data-final-fixes:

Code: Select all

data.raw.recipe["wood"].enabled = false
data.raw.recipe["iron-chest"].enabled = false
data.raw.recipe["stone-brick"].enabled = false
data.raw.recipe["electronic-circuit"].enabled = false
then it works for the first three but not electronic circuits. So far I've found the following items seem to "come back to life" no matter what:

electronic-circuit
pipe (but not pipe-to-ground)
small-electric-pole
steam-engine (but not boiler)
electric-mining-drill

Everything else (tested so far) is disabled as you'd expect.

What am I missing?

If this is hard-coded somewhere, what's the workaround? I can't do it in control.lua.
Bilka
Factorio Staff
Factorio Staff
Posts: 3470
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Oddities around disabling vanilla recipes

Post by Bilka »

You are missing that recipes can have difficulty, and that if they do you have to enable/disable them inside the recipe definition for that difficulty.

Code: Select all

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
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
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Oddities around disabling vanilla recipes

Post by Deadlock989 »

*facepalm*

Thank you.
Post Reply

Return to “Modding help”