diff options
author | metamuffin <metamuffin@disroot.org> | 2025-09-21 22:55:28 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-09-21 22:55:41 +0200 |
commit | e8ba490376c421e727f735c3d91d048f685b442e (patch) | |
tree | 2a66f0feb38740cd91bfb7adb7a6125a72e54bf1 /server/src | |
parent | 5c8b83257e6e0a6d1343dfc6c5b0c10ab9fa77b4 (diff) | |
download | hurrycurry-e8ba490376c421e727f735c3d91d048f685b442e.tar hurrycurry-e8ba490376c421e727f735c3d91d048f685b442e.tar.bz2 hurrycurry-e8ba490376c421e727f735c3d91d048f685b442e.tar.zst |
Add tile message command and demand list command
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/commands.rs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/server/src/commands.rs b/server/src/commands.rs index 0e57a013..8e3d926a 100644 --- a/server/src/commands.rs +++ b/server/src/commands.rs @@ -72,8 +72,12 @@ enum Command { List, /// Send an effect Effect { name: String }, - /// Send an item + /// Send an item message Item { name: String }, + /// Send a tile message + Tile { name: String }, + /// Show all possible demands for this map + Demands, /// Reload the resource index ReloadIndex, #[clap(alias = "summon", alias = "bot")] @@ -244,6 +248,20 @@ impl Server { }) .ok(); } + Command::Tile { name } => { + let tile = self + .game + .data + .get_tile_by_name(&name) + .ok_or(tre!("s.error.no_tile", s = name))?; + self.tx + .send(PacketC::Communicate { + player, + message: Some(Message::Tile(tile)), + timeout: None, + }) + .ok(); + } Command::CreateBot { algo, name } => { let (aname, cons) = ALGO_CONSTRUCTORS .iter() @@ -391,6 +409,20 @@ impl Server { Command::SetEditorAddress { url } => { self.editor_address = Some(url); } + Command::Demands => { + replies.push(PacketC::ServerMessage { + message: Message::Text( + self.game + .data + .demands + .iter() + .map(|d| self.game.data.item_name(d.input).to_owned()) + .collect::<Vec<String>>() + .join("\n"), + ), + error: false, + }); + } } Ok(()) } |