import { Game } from "../game"; import { LogicAction } from "../action/logicAction"; import { Actionable } from "../action/actionable"; import { GameState } from "../../player/gameState"; import { Chained, Proxied } from "../action/chain"; import type { Namespace, Storable } from "../elements/persistent/storable"; import { LiveGame } from "../game/liveGame"; import { NameSpaceContent } from "./persistent/type"; export type NamespaceGetter = >(namespace: string) => Namespace; export interface ScriptCtx { gameState: GameState; game: Game; liveGame: LiveGame; storable: Storable; $: NamespaceGetter; } type ScriptRun = (ctx: ScriptCtx) => ScriptCleaner | void; export declare class Script extends Actionable { /** * Create a script action from a handler. * @param handler - The script callback invoked when the action runs. * @returns A proxied script action ready to chain. * @example * ```ts * const script = Script.execute(({ storable }) => { * storable.getNamespace("player").set("score", 42); * }); * scene.action([script]); * ``` */ static execute(handler: ScriptRun): Proxied>; /** * Construct a script that runs arbitrary synchronous or asynchronous game logic. * @param handler - Called with the script context when the action executes. */ constructor(handler: ScriptRun); } export {};