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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//! Events that define the lifecycle of the library.
//!
//! These events are split into three categories:
//! - Scoring events
//! - Picking events
//! - Acting events
//!
//! Generally speaking, events that start with `On` should only be listened to,
//! while other events should only be triggered.
//!
//! # Scoring events
//!
//! [`RunScoring`] can be triggered to score a specific entity or all entities with the [`Score`] component.
//! [`Score`] entities with [`Score`] children will be scored after their children, to ensure correct scoring.
//! This will trigger the [`OnScore`] event for the target entity, which should be listened to by scoring [`Observer`]s
//! to calculate the [`Score`] for a given entity.
//!
//! # Picking events
//!
//! [`RunPicking`] can be triggered to make a specific entity or all entities with the [`Picker`] component pick an action.
//! This will trigger the [`OnPick`] event for the target entity, which should be listened to by picking [`Observer`]s and
//! which will trigger the [`OnPicked`] event with the picked action.
//!
//! # Acting events
//!
//! [`RequestAction`] can be triggered to request an action to be initiated for a specific entity.
//! This will trigger the [`OnActionInitiated`] event for the target entity, using the action picked by their [`Picker`].
//! The [`OnActionEnded`] event is triggered by action lifecycle or actions themselves to indicate that they have completed or been cancelled.
//! In between these two previous events, the action should be executed.
//!
//! [`Score`]: crate::scoring::Score
//! [`Picker`]: crate::picking::Picker
use ;
////////////////////////////////////////////////////////////
// Scoring events
////////////////////////////////////////////////////////////
/// Trigger this [`Event`] to score the targeted entity,
/// or all entities if no target is specified.
///
/// Entities are scored in depth-first post-order traversal,
/// ensuring that all children are scored before their parents.
;
/// This [`Event`] is listened to by scoring systems to calculate the score(s) for a given entity.
/// DO NOT TRIGGER MANUALLY, trigger [`RunScoring`] instead.
;
////////////////////////////////////////////////////////////
// Picking events
////////////////////////////////////////////////////////////
/// Trigger this [`Event`] to make the target actor entity pick an action based on its score(s),
/// or all actor entities if no target is specified.
;
/// Listen to this [`Event`] to handle picking an action for the target actor entity.
;
/// Listen to this [`Event`] to check which action was picked for the target actor entity.
/// This [`Event`] is triggered by [`Picker`]s to indicate that an action has been picked for the target actor entity.
///
/// [`Picker`]: crate::picking::Picker
////////////////////////////////////////////////////////////
// Action events
////////////////////////////////////////////////////////////
/// Trigger this [`Event`] to request a specific action or the picked action to be initiated for the target actor entity.
///
/// This event SHOULD NOT be triggered without a target entity.
/// This [`Event`] is triggered by action lifecycle to indicate that they have been initiated.
/// This [`Event`] is triggered by action lifecycle or actions themselves to indicate
/// that they have completed or been cancelled.
///
/// An action will be cancelled if a different action is [requested][`RequestAction`] before it completes.
/// The reason [`OnActionEnded`] was triggered.