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

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]Recipe with enabled=false still available from start

Post 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?
Last edited by Impatient on Mon Feb 26, 2018 7:28 pm, edited 1 time in total.
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: Recipe with enabled=false still available from start

Post by Arch666Angel »

The enabled tag has to be in the normal/expensive definition, as well as crafting time.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Recipe with enabled=false still available from start

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

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

Post by Arch666Angel »

Everything you dont put in or in the wrong place will drop to the default values.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

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

Post by Impatient »

@Arch666Angel:
Can you please take a look at this question: viewtopic.php?f=25&t=58253

It is related.
M.Colcko
Inserter
Inserter
Posts: 21
Joined: Sun Dec 04, 2016 7:23 am
Contact:

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

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

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

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

Return to “Modding help”