Page 1 of 1

[0.16.39] ingredient_count not enforced universally

Posted: Wed May 02, 2018 9:44 am
by daydev
It seems that the ingredient_count restriction on what recipes a machine can make is only enforced for some machines and/or categories.
Steps to reproduce: declare a recipe in the crafting category "chemistry" or in a new custom category with more ingredients that the corresponding machine is supposed to support by its ingredient_count definition, and the machine will still be able to craft the recipe.

Some examples.

Code: Select all

data:extend({
	{
    type = "recipe",
    name = "engine-unit2",
    energy_required = 10,
    category = "chemistry",
    ingredients =
    {
      {"steel-plate", 1},
      {"iron-gear-wheel", 1},
      {"pipe", 2},
      {"oil-refinery", 10},
      {"iron-plate", 30}
    },
    result = "engine-unit",
    enabled = true
	}
})
Chemical plant has ingredient_count = 4, but will still craft this recipe, i.e. not enforced.

Code: Select all

data:extend({
	{
    type = "recipe",
    name = "engine-unit3",
    energy_required = 10,
    category = "centrifuging",
    ingredients =
    {
      {"steel-plate", 1},
      {"iron-gear-wheel", 1},
      {"pipe", 2},
      {"oil-refinery", 10},
      {"iron-plate", 30}
    },
    result = "engine-unit",
    enabled = true
	}
})
Centrifuge has ingredient_count = 2, and will NOT craft this recipe, i.e. properly enforced.

Code: Select all

data:extend({
	{
    type = "recipe",
    name = "engine-unit4",
    energy_required = 10,
    category = "customing",
    ingredients =
    {
      {"steel-plate", 1},
      {"iron-gear-wheel", 1},
      {"pipe", 2},
      {"oil-refinery", 10},
      {"iron-plate", 30}
    },
    result = "engine-unit",
    enabled = true
	},
{
    type = "recipe-category",
    name = "customing"
}})

data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories = {"customing"}

Assembling machine 1 has ingredient_count = 2 and will NOT craft this recipe, i.e. properly enforced.

Code: Select all

data:extend({
	{
    type = "recipe",
    name = "engine-unit5",
    energy_required = 10,
    category = "customing",
    ingredients =
    {
      {"steel-plate", 1},
      {"iron-gear-wheel", 1},
      {"pipe", 2},
      {"oil-refinery", 10},
      {"iron-plate", 30}
    },
    result = "engine-unit",
    enabled = true
	},
{
    type = "recipe-category",
    name = "customing"
}})

data.raw["assembling-machine"]["chemical-plant"].crafting_categories = {"customing"}

Chemical plant has ingredient_count = 4, but will still craft this recipe, i.e. not enforced.

It also doesn't seem to be enforced for any custom assembling-machine definition.

So it seems the ingredient_count restriction is enforced for the assembling machines 1, 2 and 3, and the centrifuge, but not the chemical plant or any custom assemblers.

Re: [0.16.39] ingredient_count not enforced universally

Posted: Wed May 02, 2018 10:35 am
by darkfrei
May be that maximal amount of (#ingredients) is same as (ingredient_count + 1)?

So if you have ingredient_count = 4 then you can have up to 5 ingredients?

Re: [0.16.39] ingredient_count not enforced universally

Posted: Wed May 02, 2018 11:06 am
by daydev
darkfrei wrote:May be that maximal amount of (#ingredients) is same as (ingredient_count + 1)?

So if you have ingredient_count = 4 then you can have up to 5 ingredients?
I tried more examples and that's not it, but there seems to be some truth to it. The centrifuge won't accept anything above 2, neither 5, nor 4, nor 3. The chemical plant will accept recipes with 5 or 6 ingredients, but not 7. I thought maybe it's related to the fluid inputs, like the actual number of ingredients is ingredient_count + number of "always on" fluid inputs (even if all of the ingredients in the recipe are actually solid). But I tried to transplant fluid inputs/outputs from the chemical plant onto the centrifuge, it still won't accept more than 2 ingredients.

Re: [0.16.39] ingredient_count not enforced universally

Posted: Wed May 02, 2018 11:29 am
by daydev
I'm sorry, I think I figured it out, it's just that the fluid ingredients are not counted towards the ingredient_count limit. Please delete the topic.

Re: [0.16.39] ingredient_count not enforced universally

Posted: Wed May 02, 2018 12:36 pm
by kovarex
daydev wrote:I'm sorry, I think I figured it out, it's just that the fluid ingredients are not counted towards the ingredient_count limit. Please delete the topic.
Oh, thanks for the findings.
I will not delete it, but move it to not a bug, as it might help someone in the future realize that too.

Re: [0.16.39] ingredient_count not enforced universally

Posted: Tue May 08, 2018 10:23 am
by mexmer
daydev wrote:I'm sorry, I think I figured it out, it's just that the fluid ingredients are not counted towards the ingredient_count limit. Please delete the topic.
just sidenote

you can see same behavior with assemblers

assembler can craft 2/4/6 items recipes respectively, but they have one fluid input, so you can make 4 item + 1 liquid recipe, and it will craft in blue assembler (4 item recipe), or 2+1 and it will craft in white.

@kovarex while this is not bug per se, more like unintentional feature, not much modders know about this. might be worth mentioning in wiki.