Page 1 of 1

[0.17.33] main_product mandatory when using results?

Posted: Thu Apr 25, 2019 12:34 pm
by mrudat
Is main_product now mandatory if you define the (singular) result of a recipe using results?
What did you do?
To make my code simpler, I normalised the definitions of any recipes I'm about to process, for example:

This is the original recipe:

Code: Select all

data:extend{
  {
    ingredients = {
      {
        "wood",
        2
      }
    },
    name = "wooden-chest",
    result = "wooden-chest",
    type = "recipe"
  }
}
After converting to the more explicit results/ingredients style:

Code: Select all

data:extend{
  {
    ingredients = {
      {
        amount = 2,
        name = "wood",
        type = "item"
      }
    },
--    main_product = "wooden-chest",
    name = "wooden-chest",
    results = {
      {
        amount = 1,
        name = "wooden-chest",
        type = "item"
      }
    },
    type = "recipe"
  }
}
What happened?
Failed to generate prototype because icon not defined, despite icon only being mandatory if there is more than one result, and main_product is not specified.
What did you expect to happen instead?
The documentation for main_product implies that it only needs to be supplied for the case where there is more than one entry in the results table, (and I suspect that the code that parses the recipe definition is happy), but the code that does icon lookup doesn't seem to cope with what should be a transformation that doesn't change the semantics of the recipe definition.

For the moment, I've added a redundant main_product to the transformed recipe data.

Re: [0.17.33] main_product mandatory when using results?

Posted: Thu Apr 25, 2019 5:29 pm
by Rseding91
Thanks for the report hwoever main_product is not mandatory when using results with a singular item. In fact I can paste your recipe definition into the base game and it loads without any problem.

What ever problem you're having is not in the code you've provided.