ui/phase-20: lock after Send + dashed tracks for in-flight & pending sends

Send joins Modernize / Dismantle / Transfer as a lockable command:
once any of the four lands in the draft for a group, every action
button on its inspector is disabled with a "command pending"
tooltip and the banner names the queued kind. Load / Unload /
Split / Join Fleet stay non-locking — they stack legitimately on
the engine side.

Two dashed overlays now run alongside the cargo-route arrows:

- Yellow dashed track for own in-space groups, drawn from the
  origin planet to the destination (matches the in-space point
  colour so eye reads both as one entity).
- Green dashed track for every wire-valid sendShipGroup command
  in the order draft, drawn from the source group's orbit planet
  to the chosen destination. Disappears when the command is
  removed from the order tab, when the engine rejects it, or
  when the group has left orbit (in-space track replaces it).

Both tracks are wrap-aware via torusShortestDelta and never
participate in hit-test.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-10 17:55:43 +02:00
parent 2d201537ee
commit 54733bfb14
11 changed files with 511 additions and 58 deletions
@@ -125,7 +125,7 @@ modernize cost preview backed by `core.blockUpgradeCost`.
// pending form would still allow Confirm despite the locked
// banner above it.
$effect(() => {
if (pendingDestructiveCommand !== null) {
if (pendingLockingCommand !== null) {
if (sendPicking) {
pick?.cancel();
sendPicking = false;
@@ -245,20 +245,24 @@ modernize cost preview backed by `core.blockUpgradeCost`.
return reason === null ? null : i18n.t(reason);
}
// pendingDestructiveCommand watches the order draft for any
// pendingLockingCommand watches the order draft for any send /
// modernize / dismantle / transfer command targeting this group.
// Once the player queues one of those three, every action on the
// Once the player queues one of those four, every action on the
// group is disabled until the draft entry is removed: each is
// state-changing at turn cutoff (Modernize → state Upgrade,
// Transfer → state Transfer, Dismantle → group removed), so a
// follow-up action would race the engine's pre-condition check
// and noisy-fail server-side. The lock surfaces the commitment
// up-front and points the player at the order list as the way
// to release it.
const pendingDestructiveCommand = $derived.by(() => {
// state-changing at turn cutoff (Send → state Launched, Modernize
// → state Upgrade, Transfer → state Transfer, Dismantle → group
// removed), so a follow-up action would race the engine's
// pre-condition check and noisy-fail server-side. The lock
// surfaces the commitment up-front and points the player at the
// order list as the way to release it. Load / Unload / Split /
// Join Fleet stay non-locking — the engine accepts them stacked,
// and Send + the three destructive variants are the only commands
// that flip the group out of `In_Orbit` on the next tick.
const pendingLockingCommand = $derived.by(() => {
if (draft === undefined) return null;
for (const cmd of draft.commands) {
if (
cmd.kind !== "sendShipGroup" &&
cmd.kind !== "upgradeShipGroup" &&
cmd.kind !== "dismantleShipGroup" &&
cmd.kind !== "transferShipGroup"
@@ -272,14 +276,16 @@ modernize cost preview backed by `core.blockUpgradeCost`.
return null;
});
const lockedReason: TranslationKey | null = $derived(
pendingDestructiveCommand === null
pendingLockingCommand === null
? null
: "game.inspector.ship_group.action.disabled.locked",
);
const lockedKindLabel = $derived.by(() => {
const cmd = pendingDestructiveCommand;
const cmd = pendingLockingCommand;
if (cmd === null) return "";
switch (cmd.kind) {
case "sendShipGroup":
return i18n.t("game.inspector.ship_group.action.locked.kind.send");
case "upgradeShipGroup":
return i18n.t("game.inspector.ship_group.action.locked.kind.modernize");
case "dismantleShipGroup":
@@ -675,7 +681,7 @@ modernize cost preview backed by `core.blockUpgradeCost`.
</script>
<section class="actions" data-testid="inspector-ship-group-actions">
{#if pendingDestructiveCommand !== null}
{#if pendingLockingCommand !== null}
<p class="locked" data-testid="inspector-ship-group-actions-locked">
{i18n.t("game.inspector.ship_group.action.locked.banner", {
command: lockedKindLabel,