And the closest thing to a "guide" to item sorting is this post by kovarex from 2 years ago, but it's still pretty confusing.order
Is used to order items in inventory (when sorting is enabled) and to sort recipes in crafting screen.
Is there a guide for item ordering and subgroups?
- bigyihsuan
- Filter Inserter
- Posts: 299
- Joined: Thu Jan 01, 2015 12:57 pm
- Contact:
Is there a guide for item ordering and subgroups?
The wiki has the unhelpful:
Re: Is there a guide for item ordering and subgroups?
This really needs CLEARLY explained by a dev. And the dev needs to have one of their friends WHO HAS NO CODING EXPERIENCE read their description first. Its not useful if the description makes sense to someone who already knows whats going on. Needs to be useful enough of a description to teach.
Re: Is there a guide for item ordering and subgroups?
Let's use Steel furnace as an example.
item.lua
item-groups.lua
1. Steel furnace is in the "production" group, which is order "b", the second tab.
2. Steel furnace is in the "smelting-machine" subgroup, which is order "d", the fourth row.
3. Steel furnace is order "b", the second item in the row.
4. Let's duplicate the steel furnace, call the new item "stainless-steel-furnace", and also give it order "b". The new item would appear ahead of "steel-furnace" in alphabetical order.
item.lua
Code: Select all
{
type = "item",
name = "steel-furnace",
icon = "__base__/graphics/icons/steel-furnace.png",
flags = {"goes-to-quickbar"},
subgroup = "smelting-machine",
order = "b[steel-furnace]",
place_result = "steel-furnace",
stack_size = 50
},
Code: Select all
{
type = "item-group",
name = "production",
order = "b",
inventory_order = "d",
icon = "__base__/graphics/item-group/production.png"
},
{
type = "item-subgroup",
name = "smelting-machine",
group = "production",
order = "d",
},
To decode that:kovarex wrote:the ordering of items is determined by these priorities
- 1) Item group
- 2) Item subgroup
- 3) Item order string
- 4) Item name
1. Steel furnace is in the "production" group, which is order "b", the second tab.
2. Steel furnace is in the "smelting-machine" subgroup, which is order "d", the fourth row.
3. Steel furnace is order "b", the second item in the row.
4. Let's duplicate the steel furnace, call the new item "stainless-steel-furnace", and also give it order "b". The new item would appear ahead of "steel-furnace" in alphabetical order.
Re: Is there a guide for item ordering and subgroups?
You want a programming concept for programmers explained in a non-programmer way - that makes no sense.seronis wrote:This really needs CLEARLY explained by a dev. And the dev needs to have one of their friends WHO HAS NO CODING EXPERIENCE read their description first. Its not useful if the description makes sense to someone who already knows whats going on. Needs to be useful enough of a description to teach.
Anyone who's going to be changing item ordering, subgroups, and order strings is going to be a programmer and as such explaining it to them as a programmer is exactly what is expected.
If you want to get ahold of me I'm almost always on Discord.
Re: Is there a guide for item ordering and subgroups?
Well I dont see it as a coding concept at all. Its describing labels and order and the examples are not self explaining. Post prior to yours did a good job in general but it doesnt explain some of the convoluted order strings with sections separated by dashes and brackets.
- bigyihsuan
- Filter Inserter
- Posts: 299
- Joined: Thu Jan 01, 2015 12:57 pm
- Contact:
Re: Is there a guide for item ordering and subgroups?
So it's Tab-Line-Column? What happens when you have more than 26 items to a line?DaveMcW wrote:Let's use Steel furnace as an example.To decode that:kovarex wrote:the ordering of items is determined by these priorities
- 1) Item group
- 2) Item subgroup
- 3) Item order string
- 4) Item name
1. Steel furnace is in the "production" group, which is order "b", the second tab.
2. Steel furnace is in the "smelting-machine" subgroup, which is order "d", the fourth row.
3. Steel furnace is order "b", the second item in the row.
4. Let's duplicate the steel furnace, call the new item "stainless-steel-furnace", and also give it order "b". The new item would appear ahead of "steel-furnace" in alphabetical order.
Re: Is there a guide for item ordering and subgroups?
You are not limited to 26 letters, the order can be any string you like. It will be sorted in alphabetical order.
- bigyihsuan
- Filter Inserter
- Posts: 299
- Joined: Thu Jan 01, 2015 12:57 pm
- Contact:
Re: Is there a guide for item ordering and subgroups?
So I could do a[item]-c[red]-d[something] and a[item]-c[green]-d[thing] and it would work? Does it have to be an item that's defined, or can it be any tag I want?DaveMcW wrote:You are not limited to 26 letters, the order can be any string you like. It will be sorted in alphabetical order.
Re: Is there a guide for item ordering and subgroups?
The [tags] are optional, not used by the game, and only meant to help modders get the order right. That plan seems to have backfired.
Re: Is there a guide for item ordering and subgroups?
The [tags] thing was extremely confusing of Kovarex to say. They are literal strings - they're compared as such. There's no parsing of the string it's simply C++ std::string < comparison.DaveMcW wrote:The [tags] are optional, not used by the game, and only meant to help modders get the order right. That plan seems to have backfired.
So for:
Code: Select all
data.raw["item1"].order = "a-[b]-b[car]"
data.raw["item2"].order = "a-[a]-b[car]"
Code: Select all
std::string item1.order = "a-[b]-b[car]";
std::string item2.order = "a-[a]-b[car]";
return item1.order < item2.order;
In simple terms: It's pure string alphabetical order comparison. Ignore all the "[...] is ignored" stuff - it's not - it's this: https://en.wikipedia.org/wiki/Lexicographical_order
If you want to get ahold of me I'm almost always on Discord.
Re: Is there a guide for item ordering and subgroups?
Paraphrased:
Then at some point those strings should probably be changed to something that doesnt look like they have parsed sections. But at least we now have the real explanation (that just happens to not require programming knowledge, just describes order)Rseding91 wrote: It's pure alphabetical order comparison and nothing is ignored.