aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-12-22 19:57:47 +0100
committermetamuffin <metamuffin@disroot.org>2024-12-22 19:57:47 +0100
commit4cbbb0b7deb686789eff439b6c5cc78535a3c431 (patch)
treeac38c5017f4df2a2974d72aa09c9e380d93d8a68
parent105b2be1cbf70abc6c609fc64cbc44cb38219662 (diff)
downloadhurrycurry-4cbbb0b7deb686789eff439b6c5cc78535a3c431.tar
hurrycurry-4cbbb0b7deb686789eff439b6c5cc78535a3c431.tar.bz2
hurrycurry-4cbbb0b7deb686789eff439b6c5cc78535a3c431.tar.zst
translate frank lines, fixes #229
-rw-r--r--client/game.gd4
-rw-r--r--locale/en.ini8
-rw-r--r--server/bot/src/algos/frank.rs19
3 files changed, 15 insertions, 16 deletions
diff --git a/client/game.gd b/client/game.gd
index 63217c68..f886840d 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -233,7 +233,7 @@ func handle_packet(p):
tutorial_running = true
update_tutorial_running.emit(tutorial_running)
mp.send_chat(player_id, "/start-tutorial %s" % item_name)
- elif "text" in p.message:
+ elif "text" in p.message or "translation" in p.message:
var data = TextMessage.new()
data.timeout_initial = timeout_initial
data.timeout_remaining = timeout_remaining
@@ -242,7 +242,7 @@ func handle_packet(p):
var player: Player = players[p.player]
data.color = Character.COLORS[player.character.ParsedStyle.new(player.character_idx).color]
data.username = players[p.player].username
- data.text = p.message.text
+ data.text = p.message.text if "text" in p.message else get_message_str(p.message)
player.text_message(data)
text_message.emit(data)
diff --git a/locale/en.ini b/locale/en.ini
index 74924c7a..b46244d6 100644
--- a/locale/en.ini
+++ b/locale/en.ini
@@ -198,6 +198,14 @@ c.setup.user_signature.desc=Signature of the Employee:%n%n%n
c.setup.user_signature=Click to sign
s.bot.dishwasher=Dish washer
s.bot.frank=Frank Miller
+s.bot.frank.line.0=You’e FIRED!
+s.bot.frank.line.1=Work faster, {0}!
+s.bot.frank.line.2=Quick! There is no time for chit-chat!
+s.bot.frank.line.3=Look what a mess you’ve made! Clean this up immediatly!
+s.bot.frank.line.4=Don’t let the customers starve!
+s.bot.frank.line.5=You are wasting me money, {0}!
+s.bot.frank.line.6=I’m not paying you to stand around!
+s.bot.frank.line.7=Get back to work, {0}!
s.bot.simple=Simple chef
s.bot.waiter=Waiter
s.campaign.condition.stars=Reach at least {0} stars in {1}
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),
}],