diff options
Diffstat (limited to 'server/protocol/src/lib.rs')
-rw-r--r-- | server/protocol/src/lib.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs index 2ef07015..74d463a1 100644 --- a/server/protocol/src/lib.rs +++ b/server/protocol/src/lib.rs @@ -71,6 +71,10 @@ pub struct RecipeIndex(pub usize); #[serde(transparent)] pub struct DemandIndex(pub usize); +#[derive(Debug, Clone, Copy, Serialize, Deserialize, Encode, Decode, PartialEq, Eq, Hash)] +#[serde(transparent)] +pub struct Hand(pub usize); + #[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode)] pub struct MapMetadata { pub name: String, @@ -98,6 +102,7 @@ pub struct Gamedata { pub bot_algos: Vec<String>, pub recipes: Vec<Recipe>, pub demands: Vec<Demand>, + pub hand_count: usize, } #[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode)] @@ -124,6 +129,7 @@ pub enum PacketS { }, Interact { player: PlayerID, + hand: Hand, #[bincode(with_serde)] pos: Option<IVec2>, }, @@ -144,6 +150,7 @@ pub enum PacketS { /// For internal use only (customers) ReplaceHand { player: PlayerID, + hand: Hand, item: Option<ItemIndex>, }, #[serde(skip)] @@ -344,7 +351,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)] |