[Guide] Factorio item GUI ordering

Place to post guides, observations, things related to modding that are not mods themselves.
PsyhoBelka
Burner Inserter
Burner Inserter
Posts: 17
Joined: Fri Nov 30, 2018 7:47 am
Contact:

[Guide] Factorio item GUI ordering

Post by PsyhoBelka »

As far as I didn't find any usefull (understandable) help or article about how ordering in Factorio GUI working - I decide to close this gap for new young modders.
Here the already existing doc or post:
- https://lua-api.factorio.com/latest/types/Order.html
- viewtopic.php?p=23818#p23818
But I will provide some pictures and hopes this will be more usefull to understand, then just abstract text:)

The general structure of GUI ordering system is:
1) Item group
2) Item subgroup
3) Item order string
4) Item name

So, to find a place where your new item would be placed in GUI, first of all you need to understand a core source of base Factorio items\recipes:
https://github.com/wube/factorio-data

Here you can find basic descriptions of all items and recipes in the game.
You are interesting in several files:
- base/prototypes/item-groups.lua
- base/prototypes/fluid.lua
- base/prototypes/recipe.lua
- space-age/prototypes/item-groups.lua
- space-age/prototypes/fluid.lua
- space-age/prototypes/recipe.lua

According to names - they are split between base game and Space Age DLC.

Let's dive into code and try to understand how al this works
1. Group (aka, Logistics, Production, etc) - this is a tabs, you can see on the right side, when pressing E.
07-06-2026, 22-37-36.png
07-06-2026, 22-37-36.png (32.81 KiB) Viewed 127 times
Here is how describing tabs look like in code:

Code: Select all

{
    type = "item-group",
    name = "logistics",
    order = "a",
    icon = "__base__/graphics/item-group/logistics.png",
    icon_size = 128,
  },
  {
    type = "item-group",
    name = "production",
    order = "b",
    icon = "__base__/graphics/item-group/production.png",
    icon_size = 128,
  }
Keep eyes on order field - there's key field, which define ordering. It's just a string and all ordering based on alphabetical sorting.

2. Subgroups (aka Storage, Belt) - this is how items orders inside each tabs. In each tab ordering starts from the begining.
07-06-2026, 22-51-15.png
07-06-2026, 22-51-15.png (50.72 KiB) Viewed 127 times
Here is how it look in code:

Code: Select all

{
    type = "item-subgroup",
    name = "storage",
    group = "logistics",
    order = "a"
  },
  {
    type = "item-subgroup",
    name = "belt",
    group = "logistics",
    order = "b"
  },
  {
    type = "item-subgroup",
    name = "inserter",
    group = "logistics",
    order = "c"
  }
3. Item order string - this is most confusing thing, which you maybe already saw in item description - order = "a-b-c', etc
This string describes how item ordered inside subgroups. In the past devs used more hard way with just "a-b-c", but now it moved to more understandable format - "a[storage]-b[wooden-chest]". So the text in [] used just for describing section inside subgroup.
07-06-2026, 22-58-22.png
07-06-2026, 22-58-22.png (37.87 KiB) Viewed 127 times
Here ho it look in code:

Code: Select all

{
    type = "item",
    name = "wooden-chest",
    icon = "__base__/graphics/icons/wooden-chest.png",
    subgroup = "storage",
    order = "a[items]-a[wooden-chest]",
    inventory_move_sound = item_sounds.wood_inventory_move,
    pick_sound = item_sounds.wood_inventory_pickup,
    drop_sound = item_sounds.wood_inventory_move,
    place_result = "wooden-chest",
    stack_size = 50
  },
  {
    type = "item",
    name = "iron-chest",
    icon = "__base__/graphics/icons/iron-chest.png",
    subgroup = "storage",
    order = "a[items]-b[iron-chest]",
    inventory_move_sound = item_sounds.metal_chest_inventory_move,
    pick_sound = item_sounds.metal_chest_inventory_pickup,
    drop_sound = item_sounds.metal_chest_inventory_move,
    place_result = "iron-chest",
    stack_size = 50,
    random_tint_color = item_tints.iron_rust
  },
  {
    type = "item",
    name = "steel-chest",
    icon = "__base__/graphics/icons/steel-chest.png",
    subgroup = "storage",
    order = "a[items]-c[steel-chest]",
    inventory_move_sound = item_sounds.metal_chest_inventory_move,
    pick_sound = item_sounds.metal_chest_inventory_pickup,
    drop_sound = item_sounds.metal_chest_inventory_move,
    place_result = "steel-chest",
    stack_size = 50
  },
  {
    type = "item",
    name = "storage-tank",
    icon = "__base__/graphics/icons/storage-tank.png",
    subgroup = "storage",
    order = "b[fluid]-a[storage-tank]",
    inventory_move_sound = item_sounds.metal_large_inventory_move,
    pick_sound = item_sounds.metal_large_inventory_pickup,
    drop_sound = item_sounds.metal_large_inventory_move,
    place_result = "storage-tank",
    stack_size = 50
  }
Again, keep eyes on subgroup and order fields

Here the good example to understand the whole concept - we have subgroup Storage. And this subgroup divided into two internal groups - a[items] and b[fluids].
a[items] contains 3 items - wooden-chest, iron-chest, steel-chest. b[fluids] contains just 1 item - storage-tank.
Also, each chests has their own defined position - a[wooden-chest], b[iron-chest], c[steel-chest].
(The text insidde [] - does nothing, except more readable view). storage-tank also has dedicated position a[storage-tank] - which is the first position in b[fluids].
And finally, as far as 'a' comes before 'b' in EN aplphabet - the GUI will know how to order this items. First a[items], then b[fluids]. And inside a[items] will be clear that first will be a - wooden-chest, then b - iron-chest and then c - steel-chest.

So, for example, to add some new storage tank type - you can write a code like this:

Code: Select all

 {
    type = "item",
    name = "storage-tank-mk2",
    icon = "__base__/graphics/icons/storage-tank-mk2.png",
    subgroup = "storage",
    order = "b[fluid]-b[storage-tank-mk2]",
    inventory_move_sound = item_sounds.metal_large_inventory_move,
    pick_sound = item_sounds.metal_large_inventory_pickup,
    drop_sound = item_sounds.metal_large_inventory_move,
    place_result = "storage-tank",
    stack_size = 50
  }
4. Item name - GUI will use the item\recipe name, if you will omit some of ordering path definitions. I think this part is simple enough:)


To summarize - if you want to place you new modded items in the dedicated place in GUI items' list - you need to find closest already existed items, look at their subgroup and order string, and produce your own based on this info.

That's it:)
Hopes this will helps to understand how this system works:)
Post Reply

Return to “Modding discussion”