selection_priority does not always default to 50

Place to report issues and suggest improvements to the API documentation.
User avatar
Quezler
Filter Inserter
Filter Inserter
Posts: 316
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

selection_priority does not always default to 50

Post by Quezler »

i ran into an issue working with loaders that their selection priority was 45 instead of the default/assumed 50.

we modders often use (entity.selection_priority or 50) + 1 to make sure something is above or below a certain entity, but there are a bunch of exceptions.

i found 3 of those that are documented, though one of which is an override:

https://lua-api.factorio.com/latest/pro ... n_priority
https://lua-api.factorio.com/latest/pro ... n_priority
https://lua-api.factorio.com/latest/pro ... n_priority

however as SelectionPriorities in EntityPrototype.hpp around line 513 suggests there are more exceptions, like 45 for belt stuff, 40 for ores, etc.

(and possibly mention that in entity-util.lua there's a premade list referencable by lua, i was not even aware it existed until the comment pointed it out)
Attachments
Screenshot 2026-02-27 at 12.02.09.png
Screenshot 2026-02-27 at 12.02.09.png (45.3 KiB) Viewed 122 times
User avatar
Osmo
Fast Inserter
Fast Inserter
Posts: 238
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: selection_priority does not always default to 50

Post by Osmo »

entity-util.lua also says
editor_only = 20, -- entities not selectable by normal player (e.g. corpses, projectiles), but by editor in entity mode
It would be good if the treshold at which the entity becomes unselectable was documwnted as well
User avatar
Quezler
Filter Inserter
Filter Inserter
Posts: 316
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

Re: selection_priority does not always default to 50

Post by Quezler »

Osmo wrote: Fri Feb 27, 2026 6:00 pm entity-util.lua also says
editor_only = 20, -- entities not selectable by normal player (e.g. corpses, projectiles), but by editor in entity mode
It would be good if the treshold at which the entity becomes unselectable was documwnted as well
i was curious about that one too but from what i can find that treshold does not actually prevent an entity from being selected, they'd still need the `selectable_in_game = false` but it seems to be more of an internal convention to set those to selection priority 20.
Post Reply

Return to “Documentation Improvement Requests”