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

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
snouz
Long Handed Inserter
Long Handed Inserter
Posts: 61
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 265 times
09-03-2025, 14-03-28.png
09-03-2025, 14-03-28.png (19.87 KiB) Viewed 265 times
Planet Moshine, GUI Unifier + 17 mods, contributed graphically and otherwise to 70+ mods
curiosity
Filter Inserter
Filter Inserter
Posts: 683
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: 4118
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: 61
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
Osmo
Fast Inserter
Fast Inserter
Posts: 135
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.
Post Reply

Return to “Modding interface requests”