diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-20 19:29:41 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-20 19:29:41 +0200 |
commit | 1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7 (patch) | |
tree | 5712d2d0784da660733e41d1b69636127b71c3b3 /server/protocol | |
parent | 89ba8a6b62b90ac72547e2ca9ea5eeae7bbc6500 (diff) | |
download | hurrycurry-1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7.tar hurrycurry-1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7.tar.bz2 hurrycurry-1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7.tar.zst |
refactor score code (and break things)
Diffstat (limited to 'server/protocol')
-rw-r--r-- | server/protocol/src/lib.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs index cf422761..61efd74f 100644 --- a/server/protocol/src/lib.rs +++ b/server/protocol/src/lib.rs @@ -193,12 +193,7 @@ pub enum PacketC { ServerMessage { text: String, }, - Score { - points: i64, - demands_failed: usize, - demands_completed: usize, - time_remaining: Option<f32>, - }, + Score(Score), SetIngame { state: bool, lobby: bool, @@ -206,12 +201,33 @@ pub enum PacketC { Error { message: String, }, + Menu(Menu), MovementSync, /// For use in replay sessions only ReplayStart, } +#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode)] +#[serde(rename_all = "snake_case", tag = "type", content = "data")] +pub enum Menu { + Book, + Score(Score), +} + +#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, Default)] +pub struct Score { + pub time_remaining: f64, + pub stars: u8, + pub points: i64, + pub demands_failed: usize, + pub demands_completed: usize, + pub players: usize, + pub active_recipes: usize, + pub passive_recipes: usize, + pub instant_recipes: usize, +} + #[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, Copy, PartialEq, Eq, Hash)] #[serde(rename_all = "snake_case")] pub enum ItemLocation { |