diff options
Diffstat (limited to 'server/src/customer/mod.rs')
-rw-r--r-- | server/src/customer/mod.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/server/src/customer/mod.rs b/server/src/customer/mod.rs index 9e474b8f..d1f49655 100644 --- a/server/src/customer/mod.rs +++ b/server/src/customer/mod.rs @@ -104,6 +104,7 @@ impl DemandState { tiles: &mut HashMap<IVec2, Tile>, data: &Gamedata, dt: f32, + points: &mut i64, ) -> Result<()> { if self.customers.len() < 5 { self.customer_id_counter.0 -= 1; @@ -165,6 +166,7 @@ impl DemandState { .expect("no path to exit"); *self.chairs.get_mut(&chair).unwrap() = true; self.failed += 1; + *points -= 1; self.score_changed = true; p.state = CustomerState::Exiting { path } } else { @@ -212,14 +214,11 @@ impl DemandState { let demand = data.demand(*demand); *progress += dt / demand.duration; if *progress >= 1. { - packets_out.push(( - id, - PacketS::ReplaceHand { - item: Some(demand.to), - }, - )); - for edge in [true, false] { - packets_out.push((id, PacketS::Interact { pos: *target, edge })) + packets_out.push((id, PacketS::ReplaceHand { item: demand.to })); + if demand.to.is_some() { + for edge in [true, false] { + packets_out.push((id, PacketS::Interact { pos: *target, edge })) + } } let path = find_path( &self.walkable, @@ -229,6 +228,7 @@ impl DemandState { .ok_or(anyhow!("no path to exit"))?; *self.chairs.get_mut(&chair).unwrap() = true; self.completed += 1; + *points += demand.points; self.score_changed = true; p.state = CustomerState::Exiting { path } } |