Jido.BehaviorTree.Nodes.SetBlackboard (Jido Behavior Tree v1.0.0)

View Source

A leaf node that sets values in the blackboard.

Always returns :success after setting the specified key-value pairs. Note: Since ticks are immutable, the updated blackboard is returned in the node state for the parent to propagate.

Example

node = SetBlackboard.new(:player_health, 100)
# Sets :player_health to 100 in the blackboard

node = SetBlackboard.new(%{a: 1, b: 2})
# Sets multiple values at once

Summary

Functions

Creates a new SetBlackboard node with the specified entries.

Returns the Zoi schema for this module

Context-aware tick variant that returns the updated tick.

Types

t()

@type t() :: %Jido.BehaviorTree.Nodes.SetBlackboard{
  entries: %{optional(atom()) => any()},
  updated_tick: nil | any()
}

Functions

new(entries)

@spec new(map()) :: t()

Creates a new SetBlackboard node with the specified entries.

Examples

iex> SetBlackboard.new(%{key: "value"})
%SetBlackboard{entries: %{key: "value"}, updated_tick: nil}

iex> SetBlackboard.new(:key, "value")
%SetBlackboard{entries: %{key: "value"}, updated_tick: nil}

new(key, value)

@spec new(atom(), term()) :: t()

schema()

Returns the Zoi schema for this module

tick_with_context(state, tick)

Context-aware tick variant that returns the updated tick.