diff options
Diffstat (limited to 'server/src/customer/mod.rs')
-rw-r--r-- | server/src/customer/mod.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/src/customer/mod.rs b/server/src/customer/mod.rs index ba57542c..e60c50c7 100644 --- a/server/src/customer/mod.rs +++ b/server/src/customer/mod.rs @@ -22,7 +22,7 @@ use crate::{data::Gamedata, game::Tile}; use anyhow::{anyhow, Result}; use fake::{faker, Fake}; use hurrycurry_protocol::{glam::IVec2, DemandIndex, Message, PacketS, PlayerID}; -use log::debug; +use log::info; use movement::MovementBase; use pathfinding::{find_path, Path}; use rand::{random, thread_rng}; @@ -121,6 +121,7 @@ impl DemandState { let from = data.customer_spawn.as_ivec2(); let path = find_path(&self.walkable, from, chair) .ok_or(anyhow!("no path from {from} to {chair}"))?; + info!("{id:?} -> entering"); self.customers.insert( id, Customer { @@ -133,7 +134,6 @@ impl DemandState { for (&id, p) in &mut self.customers { match &mut p.state { CustomerState::Entering { path, chair } => { - debug!("{id:?} entering"); packets_out.push((id, path.execute_tick(&mut p.movement, &self.walkable, dt))); if path.is_done() { let demand = DemandIndex(random::<usize>() % self.data.demands.len()); @@ -144,6 +144,7 @@ impl DemandState { persist: true, }, )); + info!("{id:?} -> waiting"); p.state = CustomerState::Waiting { chair: *chair, timeout: 60. + random::<f32>() * 30., @@ -156,7 +157,6 @@ impl DemandState { demand, timeout, } => { - debug!("{id:?} waiting"); *timeout -= dt; if *timeout <= 0. { packets_out.push(( @@ -183,6 +183,7 @@ impl DemandState { self.failed += 1; *points -= 1; self.score_changed = true; + info!("{id:?} -> exiting"); p.state = CustomerState::Exiting { path } } else { let demand_data = &data.demand(*demand); @@ -222,6 +223,7 @@ impl DemandState { )); packets_out.push((id, PacketS::Interact { pos: Some(pos) })); packets_out.push((id, PacketS::Interact { pos: None })); + info!("{id:?} -> eating"); p.state = CustomerState::Eating { demand: *demand, target: pos, @@ -237,7 +239,6 @@ impl DemandState { progress, chair, } => { - debug!("{id:?} eating"); let demand = data.demand(*demand); *progress += dt / demand.duration; if *progress >= 1. { @@ -256,13 +257,14 @@ impl DemandState { self.completed += 1; *points += demand.points; self.score_changed = true; + info!("{id:?} -> exiting"); p.state = CustomerState::Exiting { path } } } CustomerState::Exiting { path } => { - debug!("{id:?} exiting"); packets_out.push((id, path.execute_tick(&mut p.movement, &self.walkable, dt))); if path.is_done() { + info!("{id:?} -> leave"); packets_out.push((id, PacketS::Leave)); customers_to_remove.push(id); } |