UNPKG

mistreevous

Version:

A library to declaratively define, build and execute behaviour trees, written in TypeScript for Node and browsers

16 lines (15 loc) 622 B
import State, { CompleteState } from "./State"; /** * A type representing an agent that a behavior tree instance would operate on. */ export type Agent = { [propertyName: string]: AgentFunction | unknown; }; export type ExitFunctionArg = { succeeded: boolean; aborted: boolean; }; export type FunctionArg = any | ExitFunctionArg; export type ActionResult = CompleteState | Promise<CompleteState> | State.RUNNING | void; export type AgentFunction = (this: Agent, ...args: FunctionArg[]) => ActionResult | boolean; export type GlobalFunction = (agent: Agent, ...args: FunctionArg[]) => ActionResult | boolean;