diff options
Diffstat (limited to 'server/src/protocol.rs')
-rw-r--r-- | server/src/protocol.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/server/src/protocol.rs b/server/src/protocol.rs index 9e6717a3..4f04793f 100644 --- a/server/src/protocol.rs +++ b/server/src/protocol.rs @@ -1,9 +1,8 @@ -use crate::recipes::Gamedata; +use crate::data::Gamedata; use glam::{IVec2, Vec2}; use serde::{Deserialize, Serialize}; pub type PlayerID = usize; -pub type ItemID = usize; pub type ItemIndex = usize; pub type TileIndex = usize; pub type RecipeIndex = usize; @@ -15,6 +14,7 @@ pub enum PacketS { Leave, Position { pos: Vec2, rot: f32 }, Interact { pos: IVec2, edge: bool }, + Collide { player: PlayerID, force: Vec2 }, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -27,7 +27,7 @@ pub enum PacketC { AddPlayer { id: PlayerID, name: String, - hand: Option<(ItemID, ItemIndex)>, + hand: Option<ItemIndex>, }, RemovePlayer { id: PlayerID, @@ -38,21 +38,19 @@ pub enum PacketC { rot: f32, }, TakeItem { - item: ItemID, + tile: IVec2, player: PlayerID, }, PutItem { - item: ItemID, - pos: IVec2, + player: PlayerID, + tile: IVec2, }, ProduceItem { - id: ItemID, - pos: IVec2, - kind: ItemIndex, + tile: IVec2, + item: ItemIndex, }, ConsumeItem { - id: ItemID, - pos: IVec2, + tile: IVec2, }, SetActive { tile: IVec2, @@ -62,4 +60,8 @@ pub enum PacketC { pos: IVec2, tile: TileIndex, }, + Collide { + player: PlayerID, + force: Vec2, + }, } |