From f21cccf9f381bd52dffbd3a9e6822300d5525897 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 16 Jun 2024 22:12:42 +0200 Subject: a --- server/src/protocol.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 server/src/protocol.rs (limited to 'server/src/protocol.rs') 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 }, +} -- cgit v1.2.3-70-g09d2