Jido. BehaviorTree. Nodes. Inverter
(Jido Behavior Tree v1.0.0)
View Source
A decorator node that inverts the result of its child.
The Inverter node wraps a single child node and inverts the final status:
- If the child succeeds, the inverter fails
- If the child fails, the inverter succeeds
- Running and error statuses are passed through unchanged
Example
inverter = Inverter.new(CheckEnemyNearby.new())
# Returns :success when CheckEnemyNearby returns :failure
# Returns :failure when CheckEnemyNearby returns :success
Summary
Functions
Creates a new Inverter node wrapping the given child.
Returns the Zoi schema for this module
Context-aware tick that preserves child tick mutations.
Types
@type t() :: %Jido.BehaviorTree.Nodes.Inverter{child: any()}
Functions
@spec new(Jido.BehaviorTree.Node.t()) :: t()
Creates a new Inverter node wrapping the given child.
Examples
iex> Inverter.new(child_node)
%Inverter{child: child_node}
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.