From 25d842e367877b8e7b321b709ae104496ac0b612 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 8 Mar 2026 22:50:48 +0000 Subject: [PATCH] feat(systems): pause movement during gathering, wire gathering into game loop Co-Authored-By: Claude Opus 4.6 --- server/src/game/GameLoop.ts | 2 ++ server/src/systems/movementSystem.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/server/src/game/GameLoop.ts b/server/src/game/GameLoop.ts index 77e3034..5085997 100644 --- a/server/src/game/GameLoop.ts +++ b/server/src/game/GameLoop.ts @@ -8,6 +8,7 @@ import { movementSystem } from '../systems/movementSystem.js'; import { socialSystem } from '../systems/socialSystem.js'; import { statModifierSystem } from '../systems/statModifierSystem.js'; import { relationshipSystem } from '../systems/relationshipSystem.js'; +import { gatheringSystem } from '../systems/gatheringSystem.js'; import { createBondRegistry } from '../systems/bondRegistry.js'; import { ItemRegistry } from '../industry/itemRegistry.js'; import { spawnNPC } from './spawner.js'; @@ -103,6 +104,7 @@ export class GameLoop { socialSystem(this.world, this.eventMemoryService); narrationEmitter(this.world, this.narrationService, this.followedEntityIds, this.eventMemoryService); relationshipSystem(this.world, this.eventMemoryService); + gatheringSystem(this.world, this.map); movementSystem(this.world); this.thoughtSystem.update(this.world, this.followedEntityIds, this.tick); diff --git a/server/src/systems/movementSystem.ts b/server/src/systems/movementSystem.ts index 4df3f41..91e53a3 100644 --- a/server/src/systems/movementSystem.ts +++ b/server/src/systems/movementSystem.ts @@ -1,5 +1,6 @@ import { Direction, MOVE_SPEED, type Movement, type Position, type SocialState } from '@dflike/shared'; import type { World } from '../ecs/World.js'; +import type { GatheringState } from './gatheringSystem.js'; function directionFromDelta(dx: number, dy: number): number { if (Math.abs(dx) > Math.abs(dy)) return dx > 0 ? Direction.RIGHT : Direction.LEFT; @@ -14,6 +15,9 @@ export function movementSystem(world: World): void { const socialState = world.getComponent(entity, 'socialState'); if (socialState && socialState.phase !== 'none') continue; + const gatheringState = world.getComponent(entity, 'gatheringState'); + if (gatheringState) continue; + if (movement.state !== 'walking' || movement.path.length === 0) { if (movement.state === 'walking' && movement.path.length === 0) { movement.state = 'idle';