Display recipe ingredients and results in the order they're declared in the prototype

User avatar
snouz
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Sun Jan 03, 2021 6:01 pm
Contact:

Display recipe ingredients and results in the order they're declared in the prototype

Post by snouz »

Hi, even when playing with item order and subgroup, I couldn't get a consistent ordering of items/fluids in recipe tooltips.

The most logical ordering for me would be to prioritize items that are declared the most (for example, if the recipe needs 12 steel and 1 plastic, it'd make sense for the tooltip to display the steel first)

The solution to that, and to avoid any unwanted behavior, I suggest that recipes should keep the recipe/ingredient ordering of the prototype.
Another solution would be to allow for an "order" string in https://lua-api.factorio.com/latest/typ ... otype.html and https://lua-api.factorio.com/latest/typ ... otype.html

example:

Code: Select all

{
    type = "recipe",
    name = "silicon",
    category = "chemistry",
    energy_required = 2,
    ingredients = {
      {type = "item", name = "sand", amount = 5, order = "a"},
      {type = "item", name = "coal", amount = 1, order = "b"},
      {type = "fluid", name = "steam", amount = 10, order = "c"},
    },
    results = {
      {type = "item", name = "silicon", amount = 1, order = "a"}
      {type = "fluid", name = "water", amount = 1, order = "b"}
    },
    allow_productivity = true,
    enabled = false,
  },
(I searched for a similar request and couldn't find one)
09-03-2025, 14-02-44.png
09-03-2025, 14-02-44.png (22.32 KiB) Viewed 2231 times
09-03-2025, 14-03-28.png
09-03-2025, 14-03-28.png (19.87 KiB) Viewed 2231 times
Planet Moshine, GUI Unifier + 17 mods, contributed graphically and otherwise to 70+ mods
curiosity
Filter Inserter
Filter Inserter
Posts: 728
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by curiosity »

While not exactly what you want, it's something along a similar line: https://lua-api.factorio.com/latest/pro ... _in_recipe
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4728
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by boskid »

Recipe's item ingredients are sorted since 0.16.31 due to 58757. Ordering is based on ItemGroup's order_in_recipe and if those are equal it uses item order. The only change that could be done is to have a RecipePrototype explicitly opt out of the ingredients sorting, but that would require extra checks to make sure the original issue this sorting fixed is not reintroduced.
User avatar
snouz
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Sun Jan 03, 2021 6:01 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by snouz »

boskid wrote: Wed Sep 03, 2025 12:23 pm Recipe's item ingredients are sorted since 0.16.31 due to 58757. Ordering is based on ItemGroup's order_in_recipe and if those are equal it uses item order. The only change that could be done is to have a RecipePrototype explicitly opt out of the ingredients sorting, but that would require extra checks to make sure the original issue this sorting fixed is not reintroduced.
My suggestion was to have the ing/result order property overwrite the default behavior, so that if it's not present, it wouldn't change the default behavior.
curiosity wrote: Wed Sep 03, 2025 12:22 pm While not exactly what you want, it's something along a similar line: https://lua-api.factorio.com/latest/pro ... _in_recipe
But order_in_recipe is the ordering of the whole tab's content in recipes, to de-correlate it from the order of the tabs at the top. It doesn't allow any sort of custom ordering in my recipe, just that belts/poles/cars will always be before furnaces/accumulators/modules...
Planet Moshine, GUI Unifier + 17 mods, contributed graphically and otherwise to 70+ mods
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 329
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by Osmo »

+1, a way of defining custom order for a recipe's ingredients by opting out of auto sorting would be very useful.
User avatar
Quezler
Filter Inserter
Filter Inserter
Posts: 331
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by Quezler »

+1, for ocd purposed this is nice, just being able to match the order ingame with the order in the code without messing with overall order strings.
User avatar
protocol_1903
Filter Inserter
Filter Inserter
Posts: 525
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by protocol_1903 »

I'd consider the order in the recipe definition to be the issue in 58757, not how the game displays it.
pY and pYblock developer, wielder of fluid networks and subtick events in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903

Buy me a coffee
User avatar
snouz
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Sun Jan 03, 2021 6:01 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by snouz »

Hi, after checking that it's still not possible in 2.1, I am again asking for this feature since the feasibility of it might have changed since 2.0, and because I think the request is still relevant.
06-29-2026, 16-55-27.png
06-29-2026, 16-55-27.png (14.88 KiB) Viewed 329 times
This addition doesn't seem to answer this, as this is only controlling the order of item groups, but doesn't affect e.g. coal compared to iron.

I would argue the that it would need to be declared in the prototype instead of the item itself, as you might have a recipe that requires 10000 coal and 1 iron, and another 10000 iron and 1 coal, so you might want to have the more important one first.
Planet Moshine, GUI Unifier + 17 mods, contributed graphically and otherwise to 70+ mods
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4728
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by boskid »

What is in game right now is enough, you can make game not sort ingredients and sort them manually in data stage however you like using whatever niceness metric you like. What you are asking for is proposing some arbitrary niceness function and requesting for the game to handle it for you, which is rejected. Just sort ingredients on your own if you want.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17239
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by Rseding91 »

snouz wrote: Mon Jun 29, 2026 3:00 pm Hi, after checking that it's still not possible in 2.1, I am again asking for this feature since the feasibility of it might have changed since 2.0, and because I think the request is still relevant.

06-29-2026, 16-55-27.png
This addition doesn't seem to answer this, as this is only controlling the order of item groups, but doesn't affect e.g. coal compared to iron.

I would argue the that it would need to be declared in the prototype instead of the item itself, as you might have a recipe that requires 10000 coal and 1 iron, and another 10000 iron and 1 coal, so you might want to have the more important one first.
I think you're missing something. That value does exactly what you're asking for: when false - the ingredients are "what ever they were defined by the lua stage that made them".
If you want to get ahold of me I'm almost always on Discord.
User avatar
snouz
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Sun Jan 03, 2021 6:01 pm
Contact:

Re: Display recipe ingredients and results in the order they're declared in the prototype

Post by snouz »

Rseding91 wrote: Mon Jun 29, 2026 3:19 pm
snouz wrote: Mon Jun 29, 2026 3:00 pm Hi, after checking that it's still not possible in 2.1, I am again asking for this feature since the feasibility of it might have changed since 2.0, and because I think the request is still relevant.

06-29-2026, 16-55-27.png
This addition doesn't seem to answer this, as this is only controlling the order of item groups, but doesn't affect e.g. coal compared to iron.

I would argue the that it would need to be declared in the prototype instead of the item itself, as you might have a recipe that requires 10000 coal and 1 iron, and another 10000 iron and 1 coal, so you might want to have the more important one first.
I think you're missing something. That value does exactly what you're asking for: when false - the ingredients are "what ever they were defined by the lua stage that made them".
I had indeed missed that, and I thought I had tested it but I was on the wrong version of my mod. Well thank you for adding this feature, and you can move this to implemented then!
I think to make it clearer, the description for sort_item_ingredients should be:

Default: true
When set to true, item ingredients will be sorted based on ItemGroup::order_in_recipe. When set to false, items are listed in the order in which they're defined in ingredients and products arrays.
Planet Moshine, GUI Unifier + 17 mods, contributed graphically and otherwise to 70+ mods
Post Reply

Return to “Implemented mod requests”