Page 1 of 1

Recipe.main_product, is everything right on the wiki?

Posted: Thu Jun 04, 2020 6:55 pm
by hhrhhr
https://wiki.factorio.com/Prototype/Recipe#main_product wrote:main_product
Type: string
Optional.

For recipes with more than one product: This defines of which result the icon, subgroup and name is used. If it is not set and the recipe has more than 1 result the recipe will use the recipe-name and recipe-description locale and its own subgroup and icon.

For recipes with 1 result: The recipe uses the icon, subgroup and name of the result by default. If set this property is set to an empty string, the recipe will use the properties of the recipe instead of the result.
Recipe "solid-fuel-from-petroleum-gas" for example:

Code: Select all

{
    type = "recipe",
    name = "solid-fuel-from-petroleum-gas",
--
    results = { [1] = {type="item", name="solid-fuel", amount=1} },
    icon = "__base__/graphics/icons/solid-fuel-from-petroleum-gas.png",
    icon_size = 64, icon_mipmaps = 4,
    subgroup = "fluid-recipes",
    enabled = false,
    order = "b[fluid-chemistry]-d[solid-fuel-from-petroleum-gas]",
--
}
There is no main_product defined, so main_product=nil; -- nil ~= "" (empty string). Recipe have only one product, so "The recipe uses the icon, subgroup and name of the result by default" should be used. But in real this recipe used "the properties of the recipe instead of the result".

Whats wrong?

Re: Recipe.main_product, is everything right on the wiki?

Posted: Thu Jun 04, 2020 9:27 pm
by hhrhhr
Second example:

Code: Select all

{
      type = "recipe",
      name = "sulfuric-acid",
      results = { [1] = { type = "fluid", name = "sulfuric-acid", amount = 50 } },
      subgroup = "fluid-recipes", -- !!! subgroup present
-- cutted
}
Recipe have only one product and no main_product is defined. So icon(s) taken from product, but subgroup taken from recipe...

What is the actual order of definition for the icons, subgroup and localized name?

Re: Recipe.main_product, is everything right on the wiki?

Posted: Mon Jul 03, 2023 2:36 pm
by Bilka
Thank you for pointing this out. Icon, localised_name and subgroup on the recipe overwrite the icon, localised_name and subgroup of the main product/only product. I have corrected the wiki page, thank you to Honktown for getting started on making the main_product explanation clearer and more correct.