Jido. BehaviorTree. Nodes. Repeat
(Jido Behavior Tree v1.0.0)
View Source
A decorator node that repeats its child a specified number of times.
The node ticks the child repeatedly until:
- The child has succeeded
counttimes (returns:success) - The child fails (returns
:failureimmediately) - The child returns
:running(returns:running)
Example
repeat = Repeat.new(attack_action, 3)
# Executes attack_action 3 times before succeeding
Summary
Functions
Creates a new Repeat node that repeats the child count times.
Returns the Zoi schema for this module
Context-aware tick that preserves child tick mutations.
Types
Functions
@spec new(Jido.BehaviorTree.Node.t(), pos_integer()) :: t()
Creates a new Repeat node that repeats the child count times.
Examples
iex> Repeat.new(child_node, 5)
%Repeat{child: child_node, count: 5, current_iteration: 0}
Returns the Zoi schema for this module
@spec tick_with_context(t(), Jido.BehaviorTree.Tick.t()) :: {Jido.BehaviorTree.Status.t(), t(), Jido.BehaviorTree.Tick.t()}
Context-aware tick that preserves child tick mutations.