Recipe.main_product, is everything right on the wiki?

Post Reply
User avatar
hhrhhr
Inserter
Inserter
Posts: 36
Joined: Mon Feb 18, 2019 11:02 pm
Contact:

Recipe.main_product, is everything right on the wiki?

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

User avatar
hhrhhr
Inserter
Inserter
Posts: 36
Joined: Mon Feb 18, 2019 11:02 pm
Contact:

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

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

Bilka
Factorio Staff
Factorio Staff
Posts: 3130
Joined: Sat Aug 13, 2016 9:20 am
Contact:

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

Post 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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Resolved Requests”