From c4cd244e9ffc0ef8e8cf7341b620104f58be326f Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 2 Feb 2026 17:43:31 +0000 Subject: [PATCH] debug: add logging to trace command dispatch and movement handler Add console.log to: - dispatchCommand: trace when commands are dispatched via EventBus - FormationMovement.handleMoveCommand: trace when move handler receives event This will help identify if the event is reaching the movement system. https://claude.ai/code/session_01VWGwpnz8yMDkYjicbv2dZ7 --- src/engine/core/GameCommand.ts | 2 ++ src/engine/systems/movement/FormationMovement.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/engine/core/GameCommand.ts b/src/engine/core/GameCommand.ts index 787c2058..6d8207cf 100644 --- a/src/engine/core/GameCommand.ts +++ b/src/engine/core/GameCommand.ts @@ -162,12 +162,14 @@ const COMMAND_EVENTS: Record = { * @param command The game command to dispatch */ export function dispatchCommand(eventBus: EventBus, command: GameCommand): void { + console.log('[dispatchCommand] Dispatching command:', command.type, command.entityIds); // Emit generic command event for logging/debugging eventBus.emit('command:received', command); // Build event payload based on command type switch (command.type) { case 'MOVE': + console.log('[dispatchCommand] Emitting command:move event'); eventBus.emit(COMMAND_EVENTS.MOVE, command); break; diff --git a/src/engine/systems/movement/FormationMovement.ts b/src/engine/systems/movement/FormationMovement.ts index e8bf5235..4764668d 100644 --- a/src/engine/systems/movement/FormationMovement.ts +++ b/src/engine/systems/movement/FormationMovement.ts @@ -231,6 +231,11 @@ export class FormationMovement { targetPosition: { x: number; y: number }; queue?: boolean; }): void { + console.log('[FormationMovement] handleMoveCommand received:', { + entityIds: data.entityIds, + targetPosition: data.targetPosition, + queue: data.queue, + }); const { entityIds, targetPosition, queue } = data; // Single unit always goes directly to target