Skip to content

API reference / @jsprismarine/entity-brains / GateBehavior

Class: GateBehavior ​

Defined in: behavior/gate.ts:69

Java's GateBehavior.

A gate is running while at least one of its children is. tickOrStop ticks every running child and stops the gate once none of them is left, so a run_one gate ends when its chosen child ends, and a try_all gate ends when the last of them does.

Extended by ​

Implements ​

Constructors ​

Constructor ​

new GateBehavior(orderPolicy, runningPolicy, behaviors, options?): GateBehavior

Defined in: behavior/gate.ts:78

Parameters ​

orderPolicy ​

OrderPolicy

runningPolicy ​

RunningPolicy

behaviors ​

readonly WeightedBehavior[]

options? ​

GateOptions = {}

Returns ​

GateBehavior

Properties ​

name ​

readonly name: string

Defined in: behavior/gate.ts:70

The Java class name, which is what a debug read-out shows.

Implementation of ​

BehaviorControl.name

Accessors ​

requiredMemories ​

Get Signature ​

get requiredMemories(): readonly MemoryModuleType<unknown>[]

Defined in: behavior/gate.ts:97

Every memory the behavior reads or writes. The brain registers each one when the behavior is added, which is how a memory a mob never declares still gets a slot.

Returns ​

readonly MemoryModuleType<unknown>[]

Every memory the behavior reads or writes. The brain registers each one when the behavior is added, which is how a memory a mob never declares still gets a slot.

Implementation of ​

BehaviorControl.requiredMemories


status ​

Get Signature ​

get status(): BehaviorStatus

Defined in: behavior/gate.ts:93

Returns ​

BehaviorStatus

Implementation of ​

BehaviorControl.status

Methods ​

doStop() ​

doStop(context, timestamp): void

Defined in: behavior/gate.ts:145

Stops every running child and erases the gate's exitErasedMemories.

Parameters ​

context ​

BrainContext

timestamp ​

number

Returns ​

void

Implementation of ​

BehaviorControl.doStop


tickOrStop() ​

tickOrStop(context, timestamp): void

Defined in: behavior/gate.ts:133

Ticks every running child and stops the gate once none is left running.

Parameters ​

context ​

BrainContext

timestamp ​

number

Returns ​

void

Implementation of ​

BehaviorControl.tickOrStop


tryStart() ​

tryStart(context, timestamp): boolean

Defined in: behavior/gate.ts:111

Checks the gate's own memory conditions, reorders the children when the policy is shuffled, then starts them until one takes under run_one, or all of them have been tried under try_all.

Parameters ​

context ​

BrainContext

timestamp ​

number

Returns ​

boolean

Implementation of ​

BehaviorControl.tryStart