ai_behavior 
Base type for AI behavior leaf nodes in the behavior tree system. setup() is called once on first activation, perform() each tick while running. Returns BT_SUCCESS / BT_FAILURE on completion, BT_RUNNING while active.
Vars | |
| async_finished | TRUE once async finished and via finish_async |
|---|---|
| async_result_flags | AI_BEHAVIOR_* flags that came out of async perform |
| async_running | TRUE while an async perform kicked off by start_async() is going |
| behavior_flags | Flags for extra behavior (see AI_BEHAVIOR_* defines) |
| failed_last_perform | TRUE when the last perform() failed and we are waiting out next_perform_time to say we failed |
| next_perform_time | world.time when perform() may next be called. |
| running | TRUE after setup() has been called and before finish_action() completes. |
| time_between_perform | Cooldown between perform() calls; do not read directly use get_cooldown() |
Procs | |
| async_still_valid | Call from an async behavior after its sleeping call, before committing side effects. FALSE means the behavior was aborted/reset mid-flight bail out without side effects. |
| finish_action | Called when the behavior finishes (succeeded or failed). Subtypes should call ..(). |
| finish_async | Call from an async behavior to commit its result. No-op if the behavior was aborted mid-flight. |
| get_cooldown | Returns the cooldown to apply after a AI_BEHAVIOR_DELAY perform(). Override for conditional delays. |
| handle_async | Checks if we're running async behavior, and if its finished, returns result flags |
| perform | Called each tick while the behavior is running. Returns AI_BEHAVIOR_* flags. |
| perform_async | Override this if you have sleeping behavior, be sure to implement the other async procs in perform() |
| setup | Called when this behavior first activates on a controller. Return FALSE to abort (returns BT_FAILURE). |
| start_async | Marks that async behavior has started and runs perform_async |
| tick | ai behavior tick. Runs setup() once on first activation, then perform() each tick. Respects per-controller cooldowns set by AI_BEHAVIOR_DELAY. Returns BT_SUCCESS / BT_FAILURE on completion, BT_RUNNING while active. |
Var Details
async_finished 
TRUE once async finished and via finish_async
async_result_flags 
AI_BEHAVIOR_* flags that came out of async perform
async_running 
TRUE while an async perform kicked off by start_async() is going
behavior_flags 
Flags for extra behavior (see AI_BEHAVIOR_* defines)
failed_last_perform 
TRUE when the last perform() failed and we are waiting out next_perform_time to say we failed
next_perform_time 
world.time when perform() may next be called.
running 
TRUE after setup() has been called and before finish_action() completes.
time_between_perform 
Cooldown between perform() calls; do not read directly use get_cooldown()
Proc Details
async_still_valid
Call from an async behavior after its sleeping call, before committing side effects. FALSE means the behavior was aborted/reset mid-flight bail out without side effects.
finish_action
Called when the behavior finishes (succeeded or failed). Subtypes should call ..().
finish_async
Call from an async behavior to commit its result. No-op if the behavior was aborted mid-flight.
get_cooldown
Returns the cooldown to apply after a AI_BEHAVIOR_DELAY perform(). Override for conditional delays.
handle_async
Checks if we're running async behavior, and if its finished, returns result flags
perform
Called each tick while the behavior is running. Returns AI_BEHAVIOR_* flags.
perform_async
Override this if you have sleeping behavior, be sure to implement the other async procs in perform()
setup
Called when this behavior first activates on a controller. Return FALSE to abort (returns BT_FAILURE).
start_async
Marks that async behavior has started and runs perform_async
tick
ai behavior tick. Runs setup() once on first activation, then perform() each tick. Respects per-controller cooldowns set by AI_BEHAVIOR_DELAY. Returns BT_SUCCESS / BT_FAILURE on completion, BT_RUNNING while active.