summaryrefslogtreecommitdiff
path: root/server/src/protocol.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/protocol.rs')
-rw-r--r--server/src/protocol.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/src/protocol.rs b/server/src/protocol.rs
new file mode 100644
index 00000000..d463a5d3
--- /dev/null
+++ b/server/src/protocol.rs
@@ -0,0 +1,31 @@
+use glam::{UVec2, Vec2};
+use serde::{Deserialize, Serialize};
+
+pub type ID = u32;
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum Item {}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum Tile {}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum PacketS {
+ Join { name: String },
+ Leave,
+ Position { pos: Vec2, rot: f32 },
+ Interact { pos: UVec2 },
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum PacketC {
+ AddPlayer { id: ID, name: String },
+ RemovePlayer { id: ID },
+ Position { player: ID, pos: Vec2, rot: f32 },
+ TakeItem { item: ID, player: ID },
+ PutItem { item: ID, pos: UVec2 },
+ ProduceItem { id: ID, pos: UVec2, kind: Item },
+ ConsumeItem { id: ID, pos: UVec2 },
+ SetActive { tile: UVec2 },
+ UpdateMap { pos: UVec2, tile: Tile },
+}