diff options
Diffstat (limited to 'server')
-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(()) } |