use glam::{IVec2, Vec2}; use serde::{Deserialize, Serialize}; pub type ID = u32; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(transparent)] pub struct Item(pub String); #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(transparent)] pub struct Tile(pub String); #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum PacketS { Join { name: String }, Leave, Position { pos: Vec2, rot: f32 }, Interact { pos: IVec2, edge: bool }, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum PacketC { Joined { id: ID, }, AddPlayer { id: ID, name: String, hand: Option<(ID, Item)>, }, RemovePlayer { id: ID, }, Position { player: ID, pos: Vec2, rot: f32, }, TakeItem { item: ID, player: ID, }, PutItem { item: ID, pos: IVec2, }, ProduceItem { id: ID, pos: IVec2, kind: Item, }, ConsumeItem { id: ID, pos: IVec2, }, SetActive { tile: IVec2, progress: f32, }, UpdateMap { pos: IVec2, tile: Tile, }, }