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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Jason Dekarske 2026-07-10 23:16:06 -07:00
parent 0ef0dc3d78
commit 2f68325801

View File

@ -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<StoneTrajectory>,
},
EndScored { end: u8, points: i32, scoring_team: Option<Team> },
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,
}