import { P as Scene, b as Engine } from "./behavior-B_245qRy.js"; import { a as SceneJson } from "./rng-BsXZg3D6.js"; //#region src/core/scene/loader.d.ts interface LoadSceneOptions { /** * Resolve a sub-scene path referenced by `{instance: ''}`. * * Returning nothing is a real answer — "I do not have that one" — and the * loader turns it into `UNRESOLVED_INSTANCE` naming the node and the path. * The type said `=> SceneJson`, so the one recipe a game actually writes * (`prefabs[path] ?? null` over a bundler's eager glob) did not typecheck. */ resolveScene?: (path: string) => SceneJson | null | undefined; /** * Assets declared ELSEWHERE in the project, for `$ref` validation. * * A scene a `NetworkSpawner` spawns resolves its refs against the HOST's * `assets{}` — `remote-player.scene.json` names `$characters/base` and * declares nothing itself, which is correct and cannot be checked from that * one file. A tool with the whole project passes the union in; loading the * file alone still fails, because alone it really cannot resolve. */ declaredAssets?: Record; /** * Tool/preview mode (the editor's ▶ play strips behaviors — and their * `static signals` with them): declare each connection's signal on its * from-node instead of hard-failing with UNKNOWN_SIGNAL. Games should * NOT set this — the strict default catches typos. */ declareConnectionSignals?: boolean; /** * Validation/tool mode (incanto-check, structure-only validation without * the game's TypeScript): scripts naming UNREGISTERED behaviors get a no-op * stub — props unvalidated, handlers accepted. Registered behaviors still * validate for real. Games should NOT set this. */ stubMissingBehaviors?: boolean; /** * Editor mode: EVERY script becomes a no-op stub, registered or not. * * The editor must not run the game while you edit it — a behavior's `onReady` * moving the player, or `update` walking it off the terrain, is not something * an edit view should do. It used to get that by deleting `script` outright, * which also meant deleting `connections` (a behavior handler cannot resolve * on a node with no behavior) — so the editor validated a scene the game * would reject, and reported green. * * Stubbing instead keeps connections loadable and hard-validated: endpoints * must still resolve, so DANGLING_CONNECTION fires in the editor exactly * where it fires in the game. Handlers are accepted (they live in the game's * TypeScript, which the editor does not load) and props are not applied. * Games should NOT set this. */ stubAllBehaviors?: boolean; /** * Attach the engine BEFORE onEnterTree/onReady fire, so behaviors can use * `this.engine` / `this.rng` / `this.log` in onReady. `createGame` does * this for you; pair it with `engine.setScene(scene)` afterwards. */ engine?: Engine; } /** * Build a live Scene from scene JSON. * * Takes `unknown` on purpose: the loader hard-validates everything at runtime, * so consumers can pass an imported JSON module without TypeScript casts. * * Order: validate header → instantiate nodes top-down → attach to a SceneTree * (enterTree/ready fire) → wire connections LAST. Every failure is a hard * IncantoError naming valid alternatives — agents self-correct on hard errors. */ declare function loadScene(json: unknown, opts?: LoadSceneOptions): Scene; //#endregion export { loadScene as n, LoadSceneOptions as t };