feat(shared): add productivity need, gather goal, inventory, STONE terrain

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-08 22:40:09 +00:00
parent f6792baf68
commit 53750df48b
2 changed files with 12 additions and 2 deletions
+6
View File
@@ -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];
+6 -2
View File
@@ -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<string, number>;
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 {