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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user