feat(systems): pause movement during gathering, wire gathering into game loop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-08 22:50:48 +00:00
parent 3a075b68e0
commit 25d842e367
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -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<SocialState>(entity, 'socialState');
if (socialState && socialState.phase !== 'none') continue;
const gatheringState = world.getComponent<GatheringState>(entity, 'gatheringState');
if (gatheringState) continue;
if (movement.state !== 'walking' || movement.path.length === 0) {
if (movement.state === 'walking' && movement.path.length === 0) {
movement.state = 'idle';