Page 1 of 1

[Solved]Recipe with enabled=false still available from start

Posted: Mon Feb 26, 2018 6:21 pm
by Impatient
Hi,

I modded a custom recipe and locked it behind a vanilla technology. The lua script looks like this:

Code: Select all

data:extend{
  {
    type = "recipe",
    name = "recipe-electronic-circuit-plastic-bar",
    enabled = false,
    normal =
    {
      ingredients =
      {
        {"plastic-bar", 1},
        {"copper-cable", 3}
      },
      results={{type="item", name="electronic-circuit", amount=1}},
      main_product= "",
    },
    expensive =
    {
      ingredients =
      {
        {"plastic-bar", 2},
        {"copper-cable", 10}
      },
      results={{type="item", name="electronic-circuit", amount=1}},
      main_product= "",
    },
    subgroup = "intermediate-product",
    order = "electronic-circuit-9",
    icon = "__Electronic_Circuit_Plastic_Bar__/graphics/icons/recipe/electronic-circuit-plastic-bar.png",
    icon_size = 32,
  }
}

table.insert(data.raw.technology["plastics"].effects, {type = "unlock-recipe", recipe = "recipe-electronic-circuit-plastic-bar"})

As you can see in the recipe definition "enabled" is set to "false". In game, in the technology window, at the technology "plastics" the recipe shows up correctly as "effect" of the completed research. But still it is available from the start of the game.

How can I fix this?

Re: Recipe with enabled=false still available from start

Posted: Mon Feb 26, 2018 6:41 pm
by Arch666Angel
The enabled tag has to be in the normal/expensive definition, as well as crafting time.

Re: Recipe with enabled=false still available from start

Posted: Mon Feb 26, 2018 7:27 pm
by Impatient
Thanks Arch666Angel. Putting "enabled=false" inside "normal" and "expensive" definition did the trick. Setting "energy_required" was not required for it to work.

Re: [Solved]Recipe with enabled=false still available from start

Posted: Mon Feb 26, 2018 9:36 pm
by Arch666Angel
Everything you dont put in or in the wrong place will drop to the default values.

Re: [Solved]Recipe with enabled=false still available from start

Posted: Tue Feb 27, 2018 9:58 pm
by Impatient
@Arch666Angel:
Can you please take a look at this question: viewtopic.php?f=25&t=58253

It is related.

Re: [Solved]Recipe with enabled=false still available from start

Posted: Wed Apr 18, 2018 7:57 pm
by M.Colcko
I put it in both normal and expensive but its still available at the start.

Code: Select all

data:extend({
{
    type = "recipe",
    name = "electric-mining-drill-mk2",
	normal =
    {
		enabled = false,
		energy_required = 4,
		ingredients =
		{
			{"speed-module-2", 2},
			{"steel-plate", 20},
			{"processing-unit", 5},
			{"electronic-circuit", 20}
		},
		result = "electric-mining-drill-mk2"
    },
    expensive =
    {
		enabled = false,
		energy_required = 4,
		ingredients =
		{
			{"speed-module-2", 2},
			{"steel-plate", 20},
			{"processing-unit", 5},
			{"electronic-circuit", 20}
		},
		result = "electric-mining-drill-mk2"
    }
}
})

Re: [Solved]Recipe with enabled=false still available from start

Posted: Thu Apr 19, 2018 8:09 am
by Impatient
The following worked for me:

Code: Select all

                data:extend{
                        {
                                type = "recipe",
                                name = "recipe__ElectronicCircuit__PlasticBar",
                                normal =
                                {
                                        enabled = false,
                                        energy_required = 1,
                                        ingredients =
                                        {
                                                {"plastic-bar", 1},
                                                {"copper-cable", 6}
                                        },
                                        results={{type="item", name="electronic-circuit", amount=2}},
                                        main_product= "",
                                },
                                expensive =
                                {
                                        enabled = false,
                                        energy_required = 2,
                                        ingredients =
                                        {
                                                {"plastic-bar", 2},
                                                {"copper-cable", 20}
                                        },
                                        results={{type="item", name="electronic-circuit", amount=2}},
                                        main_product= "",
                                },
                                subgroup = "intermediate-products-WIP-EC-PX",
                                order = "c2",
                                icon = "__ImpatientsECP__/graphics/icons/recipe/recipe__ElectronicCircuit__PlasticBar.png",
                                icon_size = 32,
                        },
                }
The mod:
viewtopic.php?t=58342