summaryrefslogtreecommitdiff
path: root/src/protocol.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-16 21:58:21 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-16 21:58:21 +0200
commitf3405890721b5092d60cd7a470e3711c4b86e204 (patch)
tree2c453275c3ef304c89ef1e716a7ba33d7b853d15 /src/protocol.rs
downloadhurrycurry-f3405890721b5092d60cd7a470e3711c4b86e204.tar
hurrycurry-f3405890721b5092d60cd7a470e3711c4b86e204.tar.bz2
hurrycurry-f3405890721b5092d60cd7a470e3711c4b86e204.tar.zst
stuff
Diffstat (limited to 'src/protocol.rs')
-rw-r--r--src/protocol.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/protocol.rs b/src/protocol.rs
new file mode 100644
index 00000000..d463a5d3
--- /dev/null
+++ b/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 },
+}