[Solved] Naming a custom recipe

Place to get help with not working mods / modding interface.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 884
Joined: Sun Mar 20, 2016 2:51 am
Contact:

[Solved] Naming a custom recipe

Post by Impatient »

Hi,

I would like to name a recipe in my mod. Currently the engine seems to draw the recipes name from the name of the recipe result.

The recipe in data.lua looks like this:

Code: Select all

data:extend{
  {
    type = "recipe",
    name = "recipe-electronic-circuit-copper-plate",
    normal =
    {
      ingredients =
      {
        {"copper-plate", 1},
        {"copper-cable", 3}
      },
      result = "electronic-circuit",
    },
    expensive =
    {
      ingredients =
      {
        {"copper-plate", 2},
        {"copper-cable", 10}
      },
      result = "electronic-circuit",
    },
    icon = "__Electronic_Circuit_Copper_Plate__/graphics/icons/recipe/electronic-circuit-copper-plate.png",
    icon_size = 32,
  }
}
It is recognized and works fine.

In my mod i have the folder and file structure "_ModName_/locale/en/config.cfg". Like described here https://wiki.factorio.com/Tutorial:Modd ... sir#Locale .

If I put the following in config.cfg

Code: Select all

[recipe-name]
recipe-electronic-circuit-copper-plate=Recipe name in section recipe-name

it does not change anything. I looked up the file base.cfg in the base mod. There is a section [recipe-name] that lists all the recipe names which are different from their results name, or which have multiple results.

I tried to make a file base.cfg next to config.cfg . But that has no effect either.

I had a look at other mods and there naming recipes works just fine.

Any knowledge/ideas? Thanks!
Last edited by Impatient on Mon Feb 26, 2018 5:00 pm, edited 1 time in total.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Naming a custom recipe

Post by eradicator »

As far as i can tell:

Prototype with .result -> uses item-name
Prototype with .results -> uses recipe-name (possibly also requires main_product= "",)

So you can try using .results instead, which works for single-output recipes just fine. It's just a different format. Or you can just straight ahead to using .localised_name, but that is probably overkill if you don't want to dynamically generate any names.

Code: Select all

results=
    {
      {type="item", name="electronic-circuit", amount=1}
    },
main_product= "",
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 884
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Naming a custom recipe

Post by Impatient »

Thank you, that worked. Smart solution, to use the multiple results format, but to just define one result.

The engine also asked for a subgroup as the mainproduct is set to "". The predefined subgroups can be found here: https://wiki.factorio.com/Data.raw#item-subgroup

The working recipe looks like this now:

Code: Select all

data:extend{
  {
    type = "recipe",
    name = "recipe-electronic-circuit-copper-plate",
    normal =
    {
      ingredients =
      {
        {"copper-plate", 1},
        {"copper-cable", 3}
      },
      results={{type="item", name="electronic-circuit", amount=1}},
      main_product= "",
    },
    expensive =
    {
      ingredients =
      {
        {"copper-plate", 2},
        {"copper-cable", 10}
      },
      results={{type="item", name="electronic-circuit", amount=1}},
      main_product= "",
    },
    subgroup = "intermediate-product",
    icon = "__Electronic_Circuit_Copper_Plate__/graphics/icons/recipe/electronic-circuit-copper-plate.png",
    icon_size = 32,
  }
}
Post Reply

Return to “Modding help”