Need a way to keep track of ghosts that are build using robots
Posted: Sat May 09, 2026 11:44 am
With my mod a player can select entities (including ghosts), and then configure stuff. Currently I store the unit_number of the selected entities, however when the ghosts are build by construction bots I lose track of them (the entity has a new unit_number). So when working with a ghost build that is slowly built by bots, the player has to reselect over and over again to have all the entities. (https://mods.factorio.com/mod/sw-rates-calc-extreme)
What I tried so far:
Assign a tag with the ghosts's unit_number to a ghost that gets built. Then when bot (or player) builds the entity I get access to the ghost's unit_number in on_robot_built_entity.tags and can change the set of selected entities. The issue is that anyone copy-pasting something on top of a ghost overwrites/removes the tag. I don't get a lot of events when copy-pasting, just an on_pre_build event.
What I would like to see:
Add a field to on_robot_built_entity/on_built_entity/on_space_platform_built_entity events with the ghost's unit_number (I guess the ghost itself as LuaEntity doesn't exist anymore).
or
Add an event for when entities change due to a blueprint being pasted. This could be much larger than just changes in tags - also control behavior, modules, ...
What I tried so far:
Assign a tag with the ghosts's unit_number to a ghost that gets built. Then when bot (or player) builds the entity I get access to the ghost's unit_number in on_robot_built_entity.tags and can change the set of selected entities. The issue is that anyone copy-pasting something on top of a ghost overwrites/removes the tag. I don't get a lot of events when copy-pasting, just an on_pre_build event.
What I would like to see:
Add a field to on_robot_built_entity/on_built_entity/on_space_platform_built_entity events with the ghost's unit_number (I guess the ghost itself as LuaEntity doesn't exist anymore).
or
Add an event for when entities change due to a blueprint being pasted. This could be much larger than just changes in tags - also control behavior, modules, ...