Question about RecipePrototype

Place to get help with not working mods / modding interface.
loggik
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Feb 21, 2020 7:56 pm
Contact:

Question about RecipePrototype

Post 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
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Question about RecipePrototype

Post 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'.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
loggik
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Feb 21, 2020 7:56 pm
Contact:

Re: Question about RecipePrototype

Post by loggik »

Using main_product='copper-cable' works for me. Thank you for your help.
Post Reply

Return to “Modding help”