Skip to content

Emit wires instead of neighbours for electric poles #78

Description

@wormeyman

GridToBlueprintString emits a neighbours array (entity numbers) on electric poles. Factorio 2.0 replaced neighbours/connections with a top-level wires array, so the game ignores what we write.

Confirmed against the game, not inferred

A throwaway mod built a save with two auto-connected medium poles and blueprinted them in Factorio 2.1.14. The export:

top-level keys: [entities, icons, item, version, wires]
wires: [[1, 5, 2, 5]]
entities: [
  {"entity_number": 1, "name": "medium-electric-pole", "position": {"x": 0.5, "y": 0.5}},
  {"entity_number": 2, "name": "medium-electric-pole", "position": {"x": 5.5, "y": 0.5}}
]

No neighbours on any entity. The wires entries are [entity_a, connector_a, entity_b, connector_b].

Why nobody reported it

Real-world impact is near zero: poles auto-connect by wire reach when placed, so a blueprint without explicit connections still produces a working power network. That is also why the oracle would never catch it - it compares prototype data, and this is an output-format issue.

Why it is not a one-liner

Emitting wires correctly means deciding which poles the planner intends to connect and encoding the connector IDs. Deleting neighbours on its own would churn every blueprint snapshot for no user-visible gain, so the two should land together.

Reproducing

The technique is documented in CLAUDE.md under "The Factorio oracle": a mod whose on_init calls surface.create_entity, stack.create_blueprint{...} and helpers.write_file(name, stack.export_stack()), run headless via factorio --create <save> --mod-directory <dir>.

Found during #77.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions