diff --git a/server/src/game/spawner.ts b/server/src/game/spawner.ts index fa29567..db75874 100644 --- a/server/src/game/spawner.ts +++ b/server/src/game/spawner.ts @@ -15,6 +15,7 @@ export function spawnNPC(world: World, map: GameMap, positionHint?: Position, ev world.addComponent(entity, 'position', pos); world.addComponent(entity, 'needs', { hunger: 40 + Math.random() * 40, // 40-80 + thirst: 40 + Math.random() * 40, // 40-80 energy: 40 + Math.random() * 40, productivity: 60 + Math.random() * 40, // 60-100 }); diff --git a/server/src/persistence/entitySerializer.ts b/server/src/persistence/entitySerializer.ts index a5de505..e9c4a83 100644 --- a/server/src/persistence/entitySerializer.ts +++ b/server/src/persistence/entitySerializer.ts @@ -109,6 +109,11 @@ function deserializeComponent(name: string, json: string): unknown { } return parsed; } + case 'needs': { + const needs = parsed as any; + if (needs.thirst === undefined) needs.thirst = 80; + return needs; + } case 'name': // These are strings directly return parsed;