import type { FunctionMutationInput, FunctionParamInput, Scalars, SeedPropertyDefInput } from '../../generated/graphql.js'; import { type KitBlueprint, type KitSelectorSpec } from './core.js'; /** A trigger for an NPC behavior: a schedule (interval or cron) or a model event. */ export type NpcBehaviorTrigger = { intervalMs: number; } | { cronExpr: string; } | { onEvent: 'function_invoked' | 'property_changed' | 'container_created'; functionName?: string; containerTypeName?: string; propertyKey?: string; /** * `property_changed` only: which writes wake the behavior. NPC state is * written by behavior functions rather than by clients, so reacting to * one needs `'function'` or `'any'` — the default `'direct'` sees only * client `setProperty` calls. */ writeSource?: 'direct' | 'function' | 'any'; debounceMs?: number; }; /** One server-driven NPC behavior: a model function plus the automation that drives it. */ export interface NpcBehaviorSpec { /** * Automation name (unique per app), e.g. `'npc-wander'`. Also derives the * default function name (`npc_wander`). */ name: string; /** Entry-point function name. Defaults to the snake-cased behavior name. */ functionName?: string; /** The property writes the behavior performs each tick. */ mutations: FunctionMutationInput[]; /** Typed parameters (bind them from a selector or static `paramsJson`). */ parameters?: FunctionParamInput[]; /** What makes the behavior run. */ trigger: NpcBehaviorTrigger; /** * Selector choosing/filtering targets and binding params (see the Game API * "Autonomous Processes → Selectors" guide), including grid-permission * predicates ({@link KitSelectorSpec}). JSON-encoded at deploy. */ selector?: KitSelectorSpec; /** * Convenience: only NPCs whose `role` property equals this act (adds a * `selfWhere` filter when no explicit `selector` is given). */ role?: string; /** Fan-out cap per run. Defaults to 8. */ maxTargets?: number; /** Static params merged into every call. */ params?: Record; /** Identity the automation acts as; omit for a trusted server caller. */ runAsUserId?: Scalars['BigInt']['input']; } /** Options for {@link npcBlueprint}. */ export interface NpcBlueprintOptions { /** NPC container type name. Defaults to `'Npc'`. */ typeName?: string; /** * Extra property definitions beyond the defaults (`role`, `x`, `y`, `z`, * `behavior_state`, `health`). `containerTypeName` is filled in. */ extraProperties?: Omit[]; /** The server-driven behaviors this NPC archetype has. */ behaviors: NpcBehaviorSpec[]; } /** Compute the function/automation names an NPC behavior deploys under. */ export declare function npcBehaviorFunctionName(behavior: NpcBehaviorSpec): string; /** * Blueprint for an **NPC archetype**: an admin-instantiable container type * holding the NPC's durable state, one `autonomousInvocable` model function * per behavior (gated `is_automation` so players cannot puppet them), and the * automations + event triggers that drive those behaviors on the server. * * Runtime counterpart: `client.kit(appId).npcs`. */ export declare function npcBlueprint(options: NpcBlueprintOptions): KitBlueprint; //# sourceMappingURL=npcs.d.ts.map