Page 1 of 1

[0.15.37]Why does my recipe take the name of the output item

Posted: Thu Oct 26, 2017 10:50 am
by Jelmergu
I have the following recipe

Code: Select all

{
        type = "recipe",
        name = "burner-to-electric-inserter",
        order = "b",
        icon = "__upgrade-machines__/graphics/icons/burner-to-electric-inserter.png",
        subgroup = "upgrade-machines",
        ingredients = {
            { "electronic-circuit", 1 },
            { "burner-inserter", 1 }
        },
        result = "inserter",
        energy_required = 1,
        enabled = true
    },
With the following line in recipe-name.cfg

Code: Select all

burner-to-electric-inserter=Burner to Electric inserter
I would expect the recipe to be called 'Burner to Electric inserter' in the crafting GUI. The actual name that appears is 'Inserter' which is the name of the output item. This is consistent with the other recipes that have a single result. The recipes that result in multiple items do take the name of the recipe-name.cfg whitch shows to me that the config gets used.

The question now is why the recipe takes the name of the output item if there is a different name defined for it.

Re: Why does my recipe take the name of the output item

Posted: Thu Oct 26, 2017 10:51 am
by Klonan
Moved to modding help

I think you need to do:

Code: Select all

main_product = ""
In the recipe definition

Re: Why does my recipe take the name of the output item

Posted: Thu Oct 26, 2017 10:58 am
by Jelmergu
Klonan wrote:Moved to modding help

I think you need to do:

Code: Select all

main_product = ""
In the recipe definition
Works like a charm

Re: Why does my recipe take the name of the output item

Posted: Thu Oct 26, 2017 5:02 pm
by darkfrei
Klonan wrote:Moved to modding help

I think you need to do:

Code: Select all

main_product = ""
In the recipe definition
Why main product definition changes the recipe name?

Re: Why does my recipe take the name of the output item

Posted: Thu Oct 26, 2017 6:16 pm
by Klonan
darkfrei wrote:
Klonan wrote:Moved to modding help

I think you need to do:

Code: Select all

main_product = ""
In the recipe definition
Why main product definition changes the recipe name?
By default the recipe is named after it's product, this is to cut down on duplicate locale entries for simple recipes

Re: Why does my recipe take the name of the output item

Posted: Fri Oct 27, 2017 8:05 am
by bobingabout
darkfrei wrote:
Klonan wrote:Moved to modding help

I think you need to do:

Code: Select all

main_product = ""
In the recipe definition
Why main product definition changes the recipe name?
When you have a single result recipe, certain factors are assumed automatically. Naming the recipe after the item, rather than the recipe name saves on locale entries, as pointed out by Klonan. It also does some other internal magic.

By specifying that there is no main product, it should function as if it were a multiple result recipe, and assume the name of the recipe instead of the name of the item.

This also works in reverse, where if you specify a main_product on a multiple output recipe, then the recipe will be named via that product instead.

I believe there's a bit more background processing going on than simply specifying the recipe to use the item's locale entry, but it's not that important for this discussion.