From 2f68325801de7e4bf1f1172303f61c642402e14c Mon Sep 17 00:00:00 2001 From: Jason Dekarske Date: Fri, 10 Jul 2026 23:16:06 -0700 Subject: [PATCH] refactor(backend): multi-stone StoneTrajectory on protocol wire Clients send team on throw; joined no longer assigns a fixed slot team. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- backend/src/protocol.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/protocol.rs b/backend/src/protocol.rs index 925b216..decf70b 100644 --- a/backend/src/protocol.rs +++ b/backend/src/protocol.rs @@ -55,6 +55,7 @@ impl fmt::Display for Team { #[serde(tag = "type", rename_all = "snake_case")] pub enum ClientMessage { Throw { + team: Team, broom_x: f32, broom_y: f32, weight: u8, @@ -71,7 +72,7 @@ fn default_friction() -> f32 { 1.0 } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] pub enum ServerMessage { - Joined { room: String, team: Team }, + Joined { room: String }, Waiting { message: String }, GameState { end: u8, @@ -82,7 +83,7 @@ pub enum ServerMessage { phase: Phase, }, Trajectory { - path: Vec<(f32, f32, f32)>, + paths: Vec, }, EndScored { end: u8, points: i32, scoring_team: Option }, GameOver { @@ -104,6 +105,12 @@ pub enum Phase { GameComplete, } +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct StoneTrajectory { + pub stone_id: u32, + pub path: Vec<(f32, f32, f32)>, +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct StoneState { pub id: u32, @@ -113,10 +120,3 @@ pub struct StoneState { pub rotation: f32, pub active: bool, } - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct Player { - pub id: String, - pub team: Team, - pub connected: bool, -}