import { GameEntityBehavior } from "../classes/entity.d.ts"; import { Action } from "./action.d.ts"; import { ColliderDebugConfig } from "../managers/colliderDebug.d.ts"; export type GameEntityBehaviorConstructor = new () => GameEntityBehavior; export interface GameEntityDefinition { /** Unique type identifier for this entity definition. */ type: string; /** Type string of a base definition to inherit from. Resolved at registration time. */ extends?: string; /** Optional human-readable name for entities of this type. Can be overridden per-instance. */ name?: string; /** Initial tags to apply to entities of this type. */ tags?: string[]; /** Actions that this entity type responds to. */ actions?: Action[]; /** Default state for entities of this type. */ defaultState: State; /** Behaviors to attach to entities of this type. */ behaviors: GameEntityBehaviorConstructor[]; /** * Visual representation configuration. * If specified, a mesh will be automatically created when the entity spawns. */ mesh?: { /** * Mesh source: primitive type or path to GLB file. * Primitives: 'box', 'sphere', 'capsule', 'cylinder' * GLB: '/assets/models/player.glb' */ source: 'box' | 'sphere' | 'capsule' | 'cylinder' | string; /** Scale multiplier for the mesh (default: 1) */ scale?: number | { x: number; y: number; z: number; }; /** Material configuration */ material?: { /** Material type: 'standard' (default) or 'pbr' */ type?: 'standard' | 'pbr'; /** Diffuse/albedo color (RGB 0-1) */ color?: { r: number; g: number; b: number; }; /** Emissive color for glow effects (RGB 0-1) */ emissive?: { r: number; g: number; b: number; }; /** PBR: Metallic factor (0-1, default 0) */ metallic?: number; /** PBR: Roughness factor (0-1, default 1) */ roughness?: number; }; /** Primitive-specific parameters */ params?: { size?: number; width?: number; height?: number; depth?: number; diameter?: number; segments?: number; radius?: number; }; }; /** If true, entities of this type are recycled via an object pool instead of being destroyed. */ poolable?: boolean; /** Number of entities to prewarm in the pool at registration time. Implies poolable. */ poolSize?: number; /** Child entities to create and attach when this entity is created. */ children?: { type: string; name?: string; initialState?: Record; position?: { x: number; y: number; z: number; }; rotation?: { x: number; y: number; z: number; }; }[]; /** Debug collider visualization config. Applied automatically during level loading. */ debugCollider?: ColliderDebugConfig; onBeforeCreate?: (state: State) => Promise | State | undefined; onCreate?: (state: State) => Promise | State | undefined; onBeforeDestroy?: (state: State) => Promise | State | undefined; onDestroy?: (state: State) => Promise | void; }