The context map contain all the (live and static) data of a behavior tree.
It has a notably flat structure, where database, static tree and dynamic extent are merged into it. So that the context also is the database and the tree, as well as other keys merged into these.
This means that functions from the db and tree namespaces can be called on a context map.
Wherever a node has a function parameter, the context map is always the first (and often only) parameter passed to it.
The context map contain all the (live and static) data of a behavior tree. It has a notably flat structure, where database, static tree and dynamic extent are merged into it. So that the context also is the database and the tree, as well as other keys merged into these. This means that functions from the db and tree namespaces can be called on a context map. Wherever a node has a function parameter, the context map is always the first (and often only) parameter passed to it.
(cancel ctx node-id)
Resets the node's children, removes its data from the database, and, when the node is an on-cancel node, ticks its cancel child node.
Resets the node's children, removes its data from the database, and, when the node is an on-cancel node, ticks its cancel child node.
(clear-tracing ctx)
Disables tracing on this context
Disables tracing on this context
The maximum number of node ticks that may occur during a single tree tick
The maximum number of node ticks that may occur during a single tree tick
(do-nodes ctx node-ids func)
Applies the func to each of the provided nodes, threading the context along. func will be called with the threaded context and a node-id, and must return a possibly updated context.
Applies the func to each of the provided nodes, threading the context along. func will be called with the threaded context and a node-id, and must return a possibly updated context.
(get-max-tick-count context)
Returns the maximum number of node ticks that may occur during a single tree tick. An error will be thrown if this number is exceeded.
Returns the maximum number of node ticks that may occur during a single tree tick. An error will be thrown if this number is exceeded.
(get-node-children-ids ctx node-id)
Returns the ids of the children nodes to the provided node-id
Returns the ids of the children nodes to the provided node-id
(get-tick-count context)
Returns the current tick count since the start of the tree tick evaluation.
Returns the current tick count since the start of the tree tick evaluation.
(inc-tick-count context)
Increases the current tick count, possibly throwing an error is it goes over the max-tick-count threshold.
Increases the current tick count, possibly throwing an error is it goes over the max-tick-count threshold.
Keys that can be found in a context map
Keys that can be found in a context map
(make db tree)
Returns a context object based on on the provided database and static tree
Returns a context object based on on the provided database and static tree
(reset-nodes ctx node-ids)
Sets the provided nodes to the :fresh status
Sets the provided nodes to the :fresh status
(reset-tick-count context)
Resets the rick count of this context. Mostly internal use.
Resets the rick count of this context. Mostly internal use.
(set-max-tick-count context value)
Sets the maximum tick count
Sets the maximum tick count
(set-node-status ctx node-id new-status)
Sets the status of a node, possibly cancelling it if it goes from :running to :fresh.
Sets the status of a node, possibly cancelling it if it goes from :running to :fresh.
(set-tracing ctx)
Enabled tracing on this context, sending treacing information to the tap. Note that this can be done at any moment.
Enabled tracing on this context, sending treacing information to the tap. Note that this can be done at any moment.
Keys specific to the context map
Keys specific to the context map
(tick ctx node-id)
Ticks a node if it's in the :fresh or :running status, increasing the tick count.
Ticks a node if it's in the :fresh or :running status, increasing the tick count.
(tracing-tick ctx node-id)
Ticks a node while sending some debugging information to the tap
Ticks a node while sending some debugging information to the tap
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close