diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-21 10:29:05 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-21 10:29:10 +0200 |
commit | 946bf63829a3d6efc57f6cc57d43593a915d4254 (patch) | |
tree | a44663299d582d5086e01fd4eea64104e795de32 | |
parent | b2e429386f88f505615cb31559331b4e05eab5d2 (diff) | |
download | hurrycurry-946bf63829a3d6efc57f6cc57d43593a915d4254.tar hurrycurry-946bf63829a3d6efc57f6cc57d43593a915d4254.tar.bz2 hurrycurry-946bf63829a3d6efc57f6cc57d43593a915d4254.tar.zst |
item command
-rw-r--r-- | server/src/state.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/src/state.rs b/server/src/state.rs index 82540fd6..44b4078a 100644 --- a/server/src/state.rs +++ b/server/src/state.rs @@ -56,6 +56,8 @@ enum Command { List, /// Send an effect Effect { name: String }, + /// Send an item + Item { name: String }, /// Reload the resource index ReloadIndex, /// Reload the current map @@ -221,6 +223,20 @@ impl State { }) .ok(); } + Command::Item { name } => { + let item = self + .game + .data + .get_item_by_name(&name) + .ok_or(anyhow!("unknown item"))?; + self.tx + .send(PacketC::Communicate { + player, + message: Some(Message::Item(item)), + persist: false, + }) + .ok(); + } } Ok(()) } |