diff --git a/shared/src/constants.ts b/shared/src/constants.ts index ed9edc8..3b5c0e0 100644 --- a/shared/src/constants.ts +++ b/shared/src/constants.ts @@ -16,6 +16,11 @@ export const HUNGER_THRESHOLD = 30; export const ENERGY_THRESHOLD = 20; export const NEED_RECOVERY_RATE = 0.5; +// Productivity need +export const PRODUCTIVITY_DECAY_PER_TICK = 0.02; +export const PRODUCTIVITY_THRESHOLD = 40; +export const PRODUCTIVITY_RECOVERY_RATE = 0.5; + // Day/night cycle export const DAY_NIGHT_RATIO = 2; // day is 2x as long as night export const DAY_HOURS = 12; // game hours of daytime @@ -78,6 +83,7 @@ export const Terrain = { GRASS: 0, WATER: 1, DIRT: 2, + STONE: 3, } as const; export type Terrain = (typeof Terrain)[keyof typeof Terrain]; diff --git a/shared/src/types.ts b/shared/src/types.ts index 02e39a1..61a181b 100644 --- a/shared/src/types.ts +++ b/shared/src/types.ts @@ -23,7 +23,7 @@ export interface MemoryEvent { detail: string; oldTier?: string; newTier?: string; - need?: 'hunger' | 'energy'; + need?: 'hunger' | 'energy' | 'productivity'; oldGoal?: string; newGoal?: string; } @@ -48,6 +48,7 @@ export interface Appearance { export interface Needs { hunger: number; // 0-100 energy: number; // 0-100 + productivity: number; // 0-100 } export interface Stats { @@ -78,7 +79,7 @@ export interface StatModifiers { } export type MovementState = 'idle' | 'walking'; -export type GoalType = 'wander' | 'eat' | 'rest'; +export type GoalType = 'wander' | 'eat' | 'rest' | 'gather'; export interface Movement { state: MovementState; @@ -96,6 +97,7 @@ export interface PlayerControlled { export interface NPCBrain { currentGoal: GoalType | null; goalQueue: GoalType[]; + gatherTarget?: { x: number; y: number; resourceType: string } | null; } export type InteractionPhase = 'none' | 'facing' | 'pausing' | 'emoting' | 'proposing'; @@ -141,6 +143,7 @@ export interface EntityState { playerControlled?: PlayerControlled; name?: string; // NPC display name backstory?: string; + inventory?: Record; socialState?: { phase: InteractionPhase; partnerId: EntityId | null; @@ -166,6 +169,7 @@ export interface WorldState { terrain: number[]; // flat array [y * width + x], terrain type per tile decorations: number[]; // flat array [y * width + x], decoration tile index (-1 = none) trunkDecorations: number[]; // flat array [y * width + x], trunk tile index (-1 = none) + resourceTiles: Array<{ x: number; y: number; resourceType: string }>; } export interface StateUpdate {