diff options
Diffstat (limited to 'server/bot/src/pathfinding.rs')
| -rw-r--r-- | server/bot/src/pathfinding.rs | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/server/bot/src/pathfinding.rs b/server/bot/src/pathfinding.rs index 5c5551dd..936f99dd 100644 --- a/server/bot/src/pathfinding.rs +++ b/server/bot/src/pathfinding.rs @@ -16,12 +16,9 @@ */ use hurrycurry_game_core::Game; +use hurrycurry_protocol::glam::{IVec2, Vec2}; #[cfg(feature = "debug_events")] -use hurrycurry_protocol::{DebugEvent, PlayerID}; -use hurrycurry_protocol::{ - DebugEventDisplay, - glam::{IVec2, Vec2}, -}; +use hurrycurry_protocol::{DebugEvent, DebugEventDisplay, PlayerID}; use log::{debug, trace}; use std::{ cmp::Ordering, @@ -56,8 +53,8 @@ impl Path { pub fn is_done(&self) -> bool { self.segments.is_empty() } - pub fn is_stuck(&self) -> bool { - self.seg_time > 3. + pub fn is_stuck(&self, thres: f32) -> bool { + self.seg_time > thres } pub fn remaining_segments(&self) -> usize { self.segments.len() @@ -65,17 +62,10 @@ impl Path { #[cfg(feature = "debug_events")] pub fn debug(&self, id: PlayerID) -> DebugEvent { - use std::f32::consts::TAU; - - use hurrycurry_protocol::glam::Vec3; - let a = id.0 as f32; + use crate::debug_player_color; DebugEvent { key: format!("path-{id}"), - color: Vec3::new( - (a + TAU / 3. * 0.).sin(), - (a + TAU / 3. * 1.).sin(), - (a + TAU / 3. * 2.).sin(), - ), + color: debug_player_color(id), display: DebugEventDisplay::Path { points: self.segments.clone(), }, |