Page 1 of 1

Oddities around disabling vanilla recipes

Posted: Thu Mar 15, 2018 7:50 pm
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.

Re: Oddities around disabling vanilla recipes

Posted: Thu Mar 15, 2018 8:15 pm
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

Re: Oddities around disabling vanilla recipes

Posted: Thu Mar 15, 2018 8:20 pm
by Deadlock989
*facepalm*

Thank you.