diff options
Diffstat (limited to 'server/bot/src/algos/customer.rs')
-rw-r--r-- | server/bot/src/algos/customer.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/bot/src/algos/customer.rs b/server/bot/src/algos/customer.rs index e602addc..6a45e379 100644 --- a/server/bot/src/algos/customer.rs +++ b/server/bot/src/algos/customer.rs @@ -20,7 +20,9 @@ use crate::{ BotAlgo, BotInput, }; use hurrycurry_client_lib::Game; -use hurrycurry_protocol::{glam::IVec2, DemandIndex, Message, PacketS, PlayerID, Score}; +use hurrycurry_protocol::{ + glam::IVec2, DemandIndex, Message, PacketS, PlayerClass, PlayerID, Score, +}; use log::info; use rand::{random, seq::IndexedRandom, thread_rng}; @@ -124,7 +126,7 @@ impl BotAlgo for Customer { .players .iter() .find(|(id, p)| { - p.character < 0 + p.class == PlayerClass::Customer && **id != me && p.movement.position.distance(chair.as_vec2() + 0.5) < 1. }) @@ -186,7 +188,11 @@ impl BotAlgo for Customer { if !*pinned { let mut pin = false; game.players_spatial_index.query(pos, 3., |pid, _| { - if game.players.get(&pid).map_or(false, |p| p.character >= 0) { + if game + .players + .get(&pid) + .map_or(false, |p| p.class.is_cheflike()) + { pin = true } }); |