This bug should appear for you, too.
Title: Connector rods built by a space platform are not registered – reactor assembly stops at them
Description
On a space platform, a reactor is only partly assembled: the components directly next to the reactor interface are added, but the assembly stops at every connector rod, so nothing behind a connector rod becomes part of the reactor. The connector rods themselves show no status icon, which means they were never registered by the mod.
Cause
Space platforms build entities through defines.events.on\\\_space\\\_platform\\\_built\\\_entity, not through on\\\_built\\\_entity / on\\\_robot\\\_built\\\_entity.
Most reactor components still get registered on platforms, because their prototypes have a created\\\_effect script trigger (effect\\\_id = "built") that fires whatever built them. The connector rod (simple-entity-with-owner, connector-rod) has no such trigger. It is only registered via on\\\_built\\\_entity and on\\\_robot\\\_built\\\_entity, so a connector rod built by a platform (or by a script with raise\\\_built) is never added to storage.connector\\\_rods, and the reactor flood fill cannot pass through it.
Steps to reproduce
- Place a ghost of a small reactor on a space platform: reactor interface – fuel rod – connector rod – fuel rod.
- Let the platform build it.
- Assemble the reactor: only the first fuel rod is added; the connector rod and everything behind it are missing.
Suggested fix
- Call
Rods.on\\\_built(event.entity, event.tags) for on\\\_space\\\_platform\\\_built\\\_entity, script\\\_raised\\\_built and script\\\_raised\\\_revive too. The built functions of the other components already check whether the entity is registered, so the trigger and the event do not register them twice.
- Add the same check to
rods.on\\\_connector\\\_rod\\\_built: return if storage.connector\\\_rods\\\[id] already exists. Alternatively, give the connector rod the same created\\\_effect as the other components.
- Migration for existing saves: in
on\\\_configuration\\\_changed, find all connector rods on all surfaces and register those that are missing (find\\\_entities\\\_filtered{name = "connector-rod"}). The player then has to assemble the reactor again.
- Optional: handle
on\\\_space\\\_platform\\\_mined\\\_entity like on\\\_player\\\_mined\\\_entity. At the moment the fuel left in a fuel rod is only handled for players and robots (spilled on the ground). On a platform, it should go into event.buffer instead.
Found and fixed in the fork Control Your Reactor (control-your-rods-fork 0.5.4), Factorio 2.1 with Space Age.