From 538dd76061f15eddef9391475a82b1e820b7ea1f Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 28 Jan 2025 18:52:44 +0100 Subject: show message for empty scoreboards --- server/src/commands.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'server/src') diff --git a/server/src/commands.rs b/server/src/commands.rs index 64fa50f6..b6b00c22 100644 --- a/server/src/commands.rs +++ b/server/src/commands.rs @@ -39,8 +39,8 @@ enum Command { timer: Option, }, /// Shows the best entries of the scoreboard for this map. - #[clap(alias = "top5")] - Top { + #[clap(alias = "top", alias = "top5")] + Scoreboard { /// Name of the map, default: current map: Option, /// Send text instead of document @@ -247,7 +247,7 @@ impl Server { algo, ))); } - Command::Top { map, text } => { + Command::Scoreboard { map, text } => { let mapname = map.as_ref().unwrap_or(&self.game.data.current_map); if let Some(board) = self.scoreboard.get(mapname) { @@ -286,7 +286,7 @@ impl Server { es: board .best .iter() - .take(5) + .take(10) .enumerate() .map(|(place, entry)| DocumentElement::Text { s: trm!( @@ -307,6 +307,11 @@ impl Server { }], }))); } + } else { + replies.push(PacketC::ServerMessage { + message: trm!("c.menu.scoreboard.no_finish", s = mapname.to_string()), + error: false, + }); } } Command::Info { map } => { -- cgit v1.2.3-70-g09d2