API reference / @jsprismarine/entity-brains / RunOne
Class: RunOne
Defined in: behavior/gate.ts:163
Java's RunOne: a shuffled gate that starts the first child that will start.
It is the most used combinator in the game; sixteen of the twenty brain mobs build at least one.
Extends
Constructors
Constructor
new RunOne(
behaviors,entryCondition?):RunOne
Defined in: behavior/gate.ts:164
Parameters
behaviors
readonly WeightedBehavior[]
entryCondition?
Returns
RunOne
Overrides
Properties
name
readonlyname:string
Defined in: behavior/gate.ts:70
The Java class name, which is what a debug read-out shows.
Inherited from
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.
Inherited from
status
Get Signature
get status():
BehaviorStatus
Defined in: behavior/gate.ts:93
Returns
Inherited from
Methods
doStop()
doStop(
context,timestamp):void
Defined in: behavior/gate.ts:145
Stops every running child and erases the gate's exitErasedMemories.
Parameters
context
timestamp
number
Returns
void
Inherited from
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
timestamp
number
Returns
void
Inherited from
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
timestamp
number
Returns
boolean