use crate::recipes::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; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case", tag = "type")] 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", tag = "type")] pub enum PacketC { Init { data: Gamedata, id: PlayerID, }, AddPlayer { id: PlayerID, name: String, hand: Option<(ItemID, ItemIndex)>, }, RemovePlayer { id: PlayerID, }, Position { player: PlayerID, pos: Vec2, rot: f32, }, TakeItem { item: ItemID, player: PlayerID, }, PutItem { item: ItemID, pos: IVec2, }, ProduceItem { id: ItemID, pos: IVec2, kind: ItemIndex, }, ConsumeItem { id: ItemID, pos: IVec2, }, SetActive { tile: IVec2, progress: Option, }, UpdateMap { pos: IVec2, tile: TileIndex, }, }