import type { ENTITY_HANDLE } from '../core/graph/NodeContext'; import type { AnimationPlayer } from '../core/model/animation'; import type { AssetType } from '../core/model/AssetTypes'; import type { PropertyBag } from '../core/model/Properties'; /** A live instance of a scene object; its resolved props are mutable runtime state the world mirrors back. */ export interface Entity { /** What tells a graph this object is a live entity and not a struct value. */ readonly [ENTITY_HANDLE]: true; id: string; /** Scene object this entity was instantiated from (for selection highlighting). */ objectId: string; assetId: string; type: AssetType; name: string; /** Position local to `parent` (world position for top-level entities). */ x: number; y: number; /** Draw order, relative to the parent as well; higher is drawn on top. */ z: number; /** For behaviors: the resolved variables (mutable state). For others: resolved properties. */ props: PropertyBag; /** Parent entity (mirrors `SceneObject.parentId`); children move and die with it. */ parent: Entity | null; /** The animations playing on this object; kept out of `props`, which the world writes back. */ animations?: AnimationPlayer[]; /** How often an `Emit` node has restarted this particle source; out of `props` for the same reason. */ emits?: number; }