feat: add social interaction guards to brain and movement systems

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-07 13:05:05 +00:00
parent ac3f26a470
commit 7cfc8c0537
3 changed files with 48 additions and 3 deletions
+4 -1
View File
@@ -1,6 +1,6 @@
import {
HUNGER_THRESHOLD, ENERGY_THRESHOLD, Direction,
type Needs, type Movement, type NPCBrain, type Position,
type Needs, type Movement, type NPCBrain, type Position, type SocialState,
} from '@dflike/shared';
import type { World } from '../ecs/World.js';
import type { GameMap } from '../map/GameMap.js';
@@ -32,6 +32,9 @@ export function npcBrainSystem(world: World, map: GameMap): void {
const movement = world.getComponent<Movement>(entity, 'movement')!;
const pos = world.getComponent<Position>(entity, 'position')!;
const socialState = world.getComponent<SocialState>(entity, 'socialState');
if (socialState && socialState.phase !== 'none') continue;
// Skip if currently walking toward a goal
if (movement.state === 'walking' && movement.path.length > 0) continue;