summaryrefslogtreecommitdiff
path: root/server/protocol/src/lib.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-12-23 15:37:11 +0100
committermetamuffin <metamuffin@disroot.org>2024-12-23 15:37:11 +0100
commit1a9f7e9a20bff0fbc854454f131d4bc546e73e72 (patch)
tree7be16db47cd819177ae73d42af7b59c37593060a /server/protocol/src/lib.rs
parentbd71cd120fa4d8caf4987fd9c76838ccbeec19f7 (diff)
downloadhurrycurry-1a9f7e9a20bff0fbc854454f131d4bc546e73e72.tar
hurrycurry-1a9f7e9a20bff0fbc854454f131d4bc546e73e72.tar.bz2
hurrycurry-1a9f7e9a20bff0fbc854454f131d4bc546e73e72.tar.zst
two-handed server
Diffstat (limited to 'server/protocol/src/lib.rs')
-rw-r--r--server/protocol/src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs
index 2ef07015..6ccd2367 100644
--- a/server/protocol/src/lib.rs
+++ b/server/protocol/src/lib.rs
@@ -71,6 +71,12 @@ pub struct RecipeIndex(pub usize);
#[serde(transparent)]
pub struct DemandIndex(pub usize);
+#[derive(Debug, Clone, Copy, Serialize, Deserialize, Encode, Decode, PartialEq, Eq, Hash)]
+pub enum Hand {
+ Left,
+ Right,
+}
+
#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode)]
pub struct MapMetadata {
pub name: String,
@@ -124,6 +130,7 @@ pub enum PacketS {
},
Interact {
player: PlayerID,
+ hand: Hand,
#[bincode(with_serde)]
pos: Option<IVec2>,
},
@@ -144,6 +151,7 @@ pub enum PacketS {
/// For internal use only (customers)
ReplaceHand {
player: PlayerID,
+ hand: Hand,
item: Option<ItemIndex>,
},
#[serde(skip)]
@@ -344,7 +352,7 @@ pub enum Recipe {
#[serde(rename_all = "snake_case")]
pub enum ItemLocation {
Tile(#[bincode(with_serde)] IVec2),
- Player(PlayerID),
+ Player(PlayerID, Hand),
}
#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode)]