diff options
Diffstat (limited to 'server/bot')
-rw-r--r-- | server/bot/src/algos/customer.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/server/bot/src/algos/customer.rs b/server/bot/src/algos/customer.rs index a147db05..0fc7a42b 100644 --- a/server/bot/src/algos/customer.rs +++ b/server/bot/src/algos/customer.rs @@ -20,7 +20,7 @@ use crate::{ BotAlgo, BotInput, }; use hurrycurry_client_lib::Game; -use hurrycurry_protocol::{glam::IVec2, DemandIndex, Message, PacketS, PlayerID}; +use hurrycurry_protocol::{glam::IVec2, DemandIndex, Message, PacketS, PlayerID, Score}; use log::info; use rand::{random, seq::IndexedRandom, thread_rng}; @@ -123,14 +123,15 @@ impl BotAlgo for Customer { if *timeout <= 0. { let path = find_path(&game.walkable, pos.as_ivec2(), *origin) .expect("no path to exit"); - // *self.chairs.get_mut(chair).unwrap() = true; - // game.score.demands_failed += 1; - // game.score.points -= 1; - // game.score_changed = true; info!("{me:?} -> exiting"); *self = Customer::Exiting { path }; BotInput { extra: vec![ + PacketS::ApplyScore(Score { + points: -1, + demands_failed: 1, + ..Default::default() + }), PacketS::Communicate { message: None, persist: true, @@ -216,11 +217,7 @@ impl BotAlgo for Customer { let demand = &game.data.demands[demand.0]; *progress += dt / demand.duration; if *progress >= 1. { - if let Some(path) = find_path( - &game.walkable, - pos.as_ivec2(), - *origin, - ) { + if let Some(path) = find_path(&game.walkable, pos.as_ivec2(), *origin) { let mut packets = Vec::new(); packets.push(PacketS::ReplaceHand { player: me, @@ -235,10 +232,11 @@ impl BotAlgo for Customer { player: me, pos: None, }); - // *self.chairs.get_mut(chair).unwrap() = true; - // game.score.demands_completed += 1; - // game.score.points += demand.points; - // game.score_changed = true; + packets.push(PacketS::ApplyScore(Score { + demands_completed: 1, + points: demand.points, + ..Default::default() + })); info!("{me:?} -> exiting"); *self = Customer::Exiting { path }; return BotInput { |