1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! The behavior abstraction: anything the Arora runtime can tick.
//!
//! A [`Behavior`] is the runtime's "what to do each step". The behavior tree is
//! one (`arora-behavior-tree`'s `TreeBehavior`); a Vizij node graph is another.
//! The runtime accepts any of them interchangeably — it just swaps the
//! interpreter.
//!
//! Each tick a behavior gets a [`BehaviorContext`]: the shared
//! [`DataStore`](arora_types::data::DataStore) (read inputs, write intent /
//! outputs), a [`CallBridge`](arora_types::call::CallBridge) (so module-calling
//! behaviors like the behavior tree can reach the engine), and the frame delta.
//! A behavior uses whichever it needs — a graph reads/writes the store; the tree
//! drives the caller.
use CallBridge;
use DataStore;
/// Whether a behavior wants to be ticked again.
/// What a [`Behavior`] receives each [`tick`](Behavior::tick).
/// A behavior failed to tick.
/// Something the Arora runtime ticks once per step.
///
/// Implemented by the behavior tree (`arora-behavior-tree`'s `TreeBehavior`) and
/// by external interpreters such as a Vizij node graph. The runtime holds a
/// queue of `Box<dyn Behavior>` and ticks them without knowing which is which.
///
/// Not `Send`: the runtime is a single-owner, single-thread step loop.