diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-04 21:20:26 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-04 21:20:26 +0200 |
commit | 4df50b07df35f8c75980ce19d954f3f366dae848 (patch) | |
tree | 6de145c099956037f7eddd01b4dfc4c5b3dacee0 | |
parent | 56ac2f25ac1fdc23dbab04e83e41bffb48d410e1 (diff) | |
download | hurrycurry-4df50b07df35f8c75980ce19d954f3f366dae848.tar hurrycurry-4df50b07df35f8c75980ce19d954f3f366dae848.tar.bz2 hurrycurry-4df50b07df35f8c75980ce19d954f3f366dae848.tar.zst |
mapinfo command
-rw-r--r-- | server/src/commands.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/server/src/commands.rs b/server/src/commands.rs index 5354c266..c33f5832 100644 --- a/server/src/commands.rs +++ b/server/src/commands.rs @@ -40,6 +40,11 @@ enum Command { /// Name of the map, default: current map: Option<String>, }, + #[clap(alias = "mapinfo")] + Info { + /// Name of the map, default: current + map: Option<String>, + }, /// Abort the current game End, /// Download recipe/map's source declaration @@ -184,6 +189,20 @@ impl Server { bail!("{o}"); } } + Command::Info { map } => { + let mapname = map.as_ref().unwrap_or(&self.game.data.current_map); + let info = self + .index + .maps + .get(mapname) + .ok_or(anyhow!("no information available"))?; + bail!( + "{:?}\nRecommended player count: {}\nDifficulty: {}", + info.name, + info.difficulty, + info.players + ) + } } Ok(()) } |