Skip to content

1681-engine / index / BtRun

Interface: BtRun<C> ​

Defined in: src/ai/behaviorTree.ts:19

What a node may use while it ticks: the agent's clock and memory, and its children's ticks.

Type Parameters ​

Type Parameter
C

Properties ​

now ​

ts
readonly now: number;

Defined in: src/ai/behaviorTree.ts:21

The time this tick was given (ms), for waits, cooldowns and timeouts.

Methods ​

halt() ​

ts
halt(child, ctx): void;

Defined in: src/ai/behaviorTree.ts:29

Stops a child that was left running, and everything under it.

Parameters ​

ParameterType
childBtNode<C>
ctxC

Returns ​

void


lasting() ​

ts
lasting<T>(node, init): T;

Defined in: src/ai/behaviorTree.ts:25

Memory that outlives the node finishing (a cooldown's ready time); only reset clears it.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
nodeBtNode<C>
init() => T

Returns ​

T


state() ​

ts
state<T>(node, init): T;

Defined in: src/ai/behaviorTree.ts:23

This node's memory for this agent, made by init the first time and after a halt.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
nodeBtNode<C>
init() => T

Returns ​

T


tick() ​

ts
tick(child, ctx): BtStatus;

Defined in: src/ai/behaviorTree.ts:27

Ticks a child; use this, never child.tick, so it is traced and halted right.

Parameters ​

ParameterType
childBtNode<C>
ctxC

Returns ​

BtStatus

Released under the MIT License.