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
//! Hook for game-specific world map behavior
use super::types::*;
use async_trait::async_trait;
/// Hook for game-specific world map behavior
#[async_trait]
pub trait WorldMapHook: Send + Sync {
/// Called when travel starts
///
/// # Arguments
///
/// * `entity_id` - Entity starting travel
/// * `travel` - Travel instance
async fn on_travel_started(&self, _entity_id: &str, _travel: &Travel) {}
/// Called when travel completes
///
/// # Arguments
///
/// * `entity_id` - Entity that completed travel
/// * `location_id` - Destination location
async fn on_travel_completed(&self, _entity_id: &str, _location_id: &str) {}
/// Called when travel is cancelled
///
/// # Arguments
///
/// * `entity_id` - Entity that cancelled travel
/// * `travel` - Cancelled travel instance
async fn on_travel_cancelled(&self, _entity_id: &str, _travel: &Travel) {}
/// Called when travel is paused
///
/// # Arguments
///
/// * `entity_id` - Entity that paused travel
/// * `travel` - Paused travel instance
async fn on_travel_paused(&self, _entity_id: &str, _travel: &Travel) {}
/// Called when travel is resumed
///
/// # Arguments
///
/// * `entity_id` - Entity that resumed travel
/// * `travel` - Resumed travel instance
async fn on_travel_resumed(&self, _entity_id: &str, _travel: &Travel) {}
/// Generate random encounter during travel (return None for no encounter)
///
/// # Arguments
///
/// * `entity_id` - Entity traveling
/// * `travel` - Current travel state
/// * `route` - Route being traveled
///
/// # Returns
///
/// Optional encounter, or None if no encounter should occur
async fn generate_encounter(
&self,
_entity_id: &str,
_travel: &Travel,
_route: &Route,
) -> Option<Encounter> {
None
}
/// Calculate custom travel speed modifier (default 1.0)
///
/// # Arguments
///
/// * `entity_id` - Entity traveling
/// * `route` - Route being traveled
///
/// # Returns
///
/// Speed multiplier (1.0 = normal)
async fn calculate_speed_modifier(&self, _entity_id: &str, _route: &Route) -> f32 {
1.0
}
/// Validate if entity can start travel (check resources, permissions, etc.)
///
/// # Arguments
///
/// * `entity_id` - Entity requesting travel
/// * `from` - Starting location
/// * `to` - Destination location
///
/// # Returns
///
/// Ok(()) if travel is allowed, Err(reason) otherwise
async fn can_start_travel(
&self,
_entity_id: &str,
_from: &str,
_to: &str,
) -> Result<(), String> {
Ok(())
}
/// Called when location is discovered (fog of war)
///
/// # Arguments
///
/// * `entity_id` - Entity that discovered the location
/// * `location_id` - Discovered location
async fn on_location_discovered(&self, _entity_id: &str, _location_id: &str) {}
/// Calculate travel cost (for economy integration)
///
/// # Arguments
///
/// * `entity_id` - Entity traveling
/// * `route` - Route being traveled
/// * `distance` - Travel distance
///
/// # Returns
///
/// Travel cost (currency or resource units)
async fn calculate_travel_cost(&self, _entity_id: &str, _route: &Route, _distance: f32) -> f32 {
0.0
}
}
/// Default no-op hook
pub struct DefaultWorldMapHook;
#[async_trait]
impl WorldMapHook for DefaultWorldMapHook {}