forked from eros/curltastic
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:
parent
0ef0dc3d78
commit
2f68325801
@ -55,6 +55,7 @@ impl fmt::Display for Team {
|
|||||||
#[serde(tag = "type", rename_all = "snake_case")]
|
#[serde(tag = "type", rename_all = "snake_case")]
|
||||||
pub enum ClientMessage {
|
pub enum ClientMessage {
|
||||||
Throw {
|
Throw {
|
||||||
|
team: Team,
|
||||||
broom_x: f32,
|
broom_x: f32,
|
||||||
broom_y: f32,
|
broom_y: f32,
|
||||||
weight: u8,
|
weight: u8,
|
||||||
@ -71,7 +72,7 @@ fn default_friction() -> f32 { 1.0 }
|
|||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(tag = "type", rename_all = "snake_case")]
|
#[serde(tag = "type", rename_all = "snake_case")]
|
||||||
pub enum ServerMessage {
|
pub enum ServerMessage {
|
||||||
Joined { room: String, team: Team },
|
Joined { room: String },
|
||||||
Waiting { message: String },
|
Waiting { message: String },
|
||||||
GameState {
|
GameState {
|
||||||
end: u8,
|
end: u8,
|
||||||
@ -82,7 +83,7 @@ pub enum ServerMessage {
|
|||||||
phase: Phase,
|
phase: Phase,
|
||||||
},
|
},
|
||||||
Trajectory {
|
Trajectory {
|
||||||
path: Vec<(f32, f32, f32)>,
|
paths: Vec<StoneTrajectory>,
|
||||||
},
|
},
|
||||||
EndScored { end: u8, points: i32, scoring_team: Option<Team> },
|
EndScored { end: u8, points: i32, scoring_team: Option<Team> },
|
||||||
GameOver {
|
GameOver {
|
||||||
@ -104,6 +105,12 @@ pub enum Phase {
|
|||||||
GameComplete,
|
GameComplete,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct StoneTrajectory {
|
||||||
|
pub stone_id: u32,
|
||||||
|
pub path: Vec<(f32, f32, f32)>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct StoneState {
|
pub struct StoneState {
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
@ -113,10 +120,3 @@ pub struct StoneState {
|
|||||||
pub rotation: f32,
|
pub rotation: f32,
|
||||||
pub active: bool,
|
pub active: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
|
||||||
pub struct Player {
|
|
||||||
pub id: String,
|
|
||||||
pub team: Team,
|
|
||||||
pub connected: bool,
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user