Skip to content

Docking: stop the maneuver when the target disappears; refuse docking with self - #2922

Open
dj803 wants to merge 1 commit into
daid:masterfrom
dj803:drowa/ee1903-dock-abort
Open

dj803 wants to merge 1 commit into
daid:masterfrom
dj803:drowa/ee1903-dock-abort

Conversation

@dj803

@dj803 dj803 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Refs #1903.

Two small fixes in src/systems/docking.cpp:

  1. DockingSystem::update, state Docking: when the target is gone or has no Transform, only state was reset to NotDocking. The impulse request set a tick earlier (-1) stayed, so the ship kept reversing. It now calls abortDock(entity), which also zeroes impulse and warp requests and stops the thrusters, as the manual abort path does.
  2. requestDock: add target == entity to the early return. The old requestDock had target == this ([SpaceShip] Don't try to dock with yourself #1906); the ECS port lost it. Only matters for an entity that has its own DockingBay (a stock Atlantis has none, so it cannot dock to itself).

Measured (headless, one scenario, commandDock then station:destroy() 1 s later)

Case Time master 29df4600 (control) this PR
A: target destroyed mid-dock t=1.0 (before destroy) docking, impulse -1.0 docking, impulse -1.0
t=1.5 not_docking, impulse -1.0 not_docking, impulse 0.0
t=3.0 not_docking, impulse -1.0 not_docking, impulse 0.0
B: ship with components.docking_bay = {} docks itself t=4.0 (1 s after commandDock(p, p)) docking, impulse -1.0 not_docking, impulse 0.0
B: stock Atlantis docks itself t=4.0 not_docking, impulse 0.0 not_docking, impulse 0.0

Regression run (90 s simulated): a player Atlantis and an AI Phobos both reach docked on master and on this branch. An AI ship whose station is destroyed mid-dock ends not_docking on both (the AI re-issues its own impulse each tick, so single samples there are noise).

Docked state (station destroyed 2 s after the ship reports docked; player and AI): identical on master and this PR. Player docked -> not_docking, impulse 0.0, no drift. AI docked -> not_docking and flies off (it sets its own impulse each tick). The Docked branch is untouched by this PR.

GUI check (Windows, this PR's build, Helms screen): Atlantis docking at impulse -19%, station destroyed 2 s later; impulse went to -9%, then 0% (speed 0.0), and the Request dock button became available again.

Build checks: built locally (MSVC, RelWithDebInfo, Windows). No other platform built. No scenario smoke needed (no scripts changed).

Not tested

  • No networked client run. The GUI check above was on this PR's build only; master was not run in the GUI.
  • Self-dock in the GUI: not run, because the Helms dock button already skips the own ship (dockingButton.cpp); only script commandDock reaches that path, covered headless above.
  • Warp/thruster reset exercised only through the Atlantis template (has impulse + thrusters).
  • Linux/macOS builds; upstream CI not run locally.

🤖 Generated with Claude Code

…se docking with self

DockingSystem::update only reset the dock state when the target was removed
mid-dock, leaving the impulse request at -1 (ship keeps reversing). Use abortDock.
requestDock had no target == entity guard (lost in the ECS port, was daid#1906).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant