diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/bot/src/algos/frank.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/server/bot/src/algos/frank.rs b/server/bot/src/algos/frank.rs index 1e02e297..47b8ca7d 100644 --- a/server/bot/src/algos/frank.rs +++ b/server/bot/src/algos/frank.rs @@ -21,7 +21,7 @@ use crate::{ }; use hurrycurry_client_lib::Game; use hurrycurry_protocol::{glam::Vec2, Message, PacketS, PlayerClass, PlayerID}; -use rand::{seq::IndexedRandom, thread_rng}; +use rand::{random, seq::IndexedRandom, thread_rng}; #[derive(Default)] pub struct Frank { @@ -33,17 +33,6 @@ pub struct Frank { path: Option<Path>, } -const MESSAGES: &[fn(&str) -> String] = &[ - |_name| format!("Work faster, {_name}!"), - |_name| "Quick! There is no time for chit-chat!".to_string(), - |_name| "Look what a mess you've made! Clean this up immediatly!".to_string(), - |_name| "Don't let the customers starve!".to_string(), - |_name| format!("You are wasting me money, {_name}!"), - |_name| "I'm not paying you to stand around!".to_string(), - |_name| format!("Get back to work, {_name}!"), - |_name| "You're FIRED!".to_string(), -]; - impl BotAlgo for Frank { fn tick(&mut self, me: PlayerID, game: &Game, dt: f32) -> BotInput { let Some(player) = game.players.get(&me) else { @@ -78,11 +67,13 @@ impl BotAlgo for Frank { if pos.distance(tpos) < 2. { self.sleep = 8.; self.idle = 15.; - let message = MESSAGES.choose(&mut thread_rng()).unwrap()(&player.name); return BotInput { extra: vec![PacketS::Communicate { player: me, - message: Some(Message::Text(message)), + message: Some(Message::Translation { + id: format!("s.bot.frank.line.{}", random::<u32>() % 8), + params: vec![Message::Text(player.name.clone())], + }), timeout: Some(3.), pin: Some(false), }], |