Connector jumps, plant corrupt

Logistics Tools & Construction
kayser_ [discord] · 1 month ago

I was hit by this bugger again and I decided to trace this in the decompiled 0.8.7b/b615 code. It looks like blueprint preview and actual placement use different transport endpoint-joining rules.

StaticTransportPreview knows whether each transport endpoint connects to something inside the blueprint. It passes that information as disallowMiniZipAtStart/End during preview validation.

During actual placement, the config-based path through TransportsCommandsProcessor.TryBuildTransportFromConfig does not appear to carry those endpoint flags forward. Transport validation is therefore performed with both flags set to false.

If a copied endpoint overlaps an existing transport, commit-time validation may treat the endpoint as eligible for a new join. TransportsConstructionHelper.CanJoinTo then cuts the overlapping transport and creates a mini-connector there. Visually, this looks like the blueprint connector moved by one tile.

As a test, I forced both endpoint-protection flags to true during config-based transport placement. The pasted result then matched the preview exactly.

Possible fixes:

  1. Carry the preview’s per-end connection state through the placement command and use it during commit.
  2. Alternatively, determine on the simulation side which transport endpoints connect within the submitted batch, and suppress automatic joins only at those endpoints.

I may be missing some intended behavior here. This probably isn’t risk-free: partial blueprints, connections to transports outside the blueprint, replacement order, undo/redo, and multiplayer determinism may all need consideration. Globally protecting both endpoints worked as a diagnostic, but is likely too broad for a production fix.

17 Showing 21–22 of 22