-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.rs
More file actions
66 lines (59 loc) · 1.56 KB
/
commands.rs
File metadata and controls
66 lines (59 loc) · 1.56 KB
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
use serde::{Deserialize, Serialize};
use crate::domain::time::TimeDelta;
use crate::world::{ActorId, EntityId, PlaceId, TravelRoute};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ActionRequest {
pub actor_id: ActorId,
pub action: ActionKind,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ActionKind {
MoveTo { destination: PlaceId },
Speak { target: ActorId, text: String },
InspectEntity { entity_id: EntityId },
Wait { duration: TimeDelta },
DoNothing,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum AvailableAction {
MoveTo { destination: PlaceId },
SpeakTo { target: ActorId },
InspectEntity { entity_id: EntityId },
Wait,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum AgentAvailableAction {
MoveTo { destination: PlaceId },
SpeakTo { target: ActorId },
InspectEntity { entity_id: EntityId },
DoNothing,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ActionPlan {
pub actor_id: ActorId,
pub duration: TimeDelta,
pub action: PlannedAction,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PlannedAction {
MoveTo {
origin: PlaceId,
destination: PlaceId,
route: TravelRoute,
},
Speak {
place_id: PlaceId,
target: ActorId,
text: String,
},
InspectEntity {
place_id: PlaceId,
entity_id: EntityId,
},
Wait {
place_id: PlaceId,
},
DoNothing {
place_id: PlaceId,
},
}