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

t()

@type t() :: %Jido.BehaviorTree.Nodes.Inverter{child: any()}

Functions

new(child)

@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}

schema()

Returns the Zoi schema for this module

tick_with_context(state, tick)

Context-aware tick that preserves child tick mutations.