Page 1 of 1

Question about RecipePrototype

Posted: Fri Feb 21, 2020 8:13 pm
by loggik
Hi,

i am new to factorio modding and was trying to create a recipe with cacalysts and run into the following error:

Failed to load mods: Error while loading recipe prototype "testrecipe-stone" (recipe): Key "icon" not found in property tree at ROOT.recipe.testrecipe-stone

As far as i understand the property "icon" is optional and i don't undestand why factorio tries to find an icon.
This is how my code looks like:

Code: Select all

data:extend({
  {
    ingredients = {
      { type= "item", name= "stone", amount=1.0, catalyst_amount=1.0}
    },
    name = "testrecipe-stone",
    results = {
      {type= "item", name = "copper-cable", probability=0.5, amount_min=1, amount_max=1},
      {type= "item", name = "stone", amount=1.0, catalyst_amount= 1.0}
    },
    type = "recipe",
    enabled = true,
  }
})
It works without the second result, so if i use this code it works:

Code: Select all

data:extend({
  {
    ingredients = {
      { type= "item", name= "stone", amount=1.0, catalyst_amount=1.0}
    },
    name = "testrecipe-stone",
    results = {
      {type= "item", name = "copper-cable", probability=0.5, amount_min=1, amount_max=1}
    },
    type = "recipe",
    enabled = true,
  }
})
This doesn't make any sense to me. It would be great if someone could explain this to me.

Thanks

Re: Question about RecipePrototype

Posted: Fri Feb 21, 2020 8:20 pm
by eradicator
The engine does some smart-assing in the background. If a recipe only has one result it uses the icon of that, but if a recipe has more than one result it doesn't know which one to use. You can either specify the icon or try using main_product='copper-cable'.

Re: Question about RecipePrototype

Posted: Fri Feb 21, 2020 8:37 pm
by loggik
Using main_product='copper-cable' works for me. Thank you for your help.