I already discussed this with Rseding91 on #factorio and was told that the game used the first item in the prototype sort order (group, subgroup, order key).
Unfortunately, this isn't how the game does it actually. I've done a bit of research and made a few hypothesis on how the items are actually sorted:
- By order of appearance in data.raw (unlikely since data.raw is indexed by prototype type)
- By item type and order of appearance
- By item type and name
- By item name
data.lua
Using this code, we try to ghost-build a dummy-entity:
Code: Select all
/c game.player.surface.create_entity{name = 'entity-ghost', inner_name = 'dummy-entity', position = { game.player.position.x, game.player.position.y - 1 }, force = game.forces.player }
So it would seem that the game actually uses the first item in ascending name order which is quite inconvenient if you want to control which item gets used.