diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-20 19:53:48 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-20 19:53:48 +0200 |
commit | 8f195b0ce8359ce20496435aa6f518e7d13d992f (patch) | |
tree | 363b21981b996026468fcdcd878a5a8170cf57e9 | |
parent | 663d4251b3fd7fa1e1ffcc1461631d98c2a70072 (diff) | |
download | hurrycurry-8f195b0ce8359ce20496435aa6f518e7d13d992f.tar hurrycurry-8f195b0ce8359ce20496435aa6f518e7d13d992f.tar.bz2 hurrycurry-8f195b0ce8359ce20496435aa6f518e7d13d992f.tar.zst |
update pixelcurry protoco
-rw-r--r-- | pixel-client/src/game.rs | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/pixel-client/src/game.rs b/pixel-client/src/game.rs index aefafd6e..c9253e1f 100644 --- a/pixel-client/src/game.rs +++ b/pixel-client/src/game.rs @@ -28,7 +28,7 @@ use crate::{ use hurrycurry_protocol::{ glam::{IVec2, Vec2}, movement::MovementBase, - ClientGamedata, ItemIndex, ItemLocation, PacketC, PacketS, PlayerID, TileIndex, + ClientGamedata, ItemIndex, ItemLocation, PacketC, PacketS, PlayerID, Score, TileIndex, }; use log::{info, warn}; use sdl2::{ @@ -57,14 +57,6 @@ pub struct Game { score: Score, } -#[derive(Debug, Default)] -pub struct Score { - points: i64, - demands_failed: usize, - demands_completed: usize, - time_remaining: f32, -} - pub struct Tile { _kind: TileIndex, item: Option<Item>, @@ -142,7 +134,7 @@ impl Game { self.movement_send_cooldown += 0.04 } - self.score.time_remaining -= dt; + self.score.time_remaining -= dt as f64; self.score.time_remaining -= self.score.time_remaining.max(0.); if interact != self.interacting { @@ -317,16 +309,8 @@ impl Game { PacketC::ServerMessage { text: _ } => { // TODO } - PacketC::Score { - points, - demands_failed, - demands_completed, - time_remaining, - } => { - self.score.points = points; - self.score.demands_completed = demands_completed; - self.score.demands_failed = demands_failed; - self.score.time_remaining = time_remaining.unwrap_or(-1.); + PacketC::Score(score) => { + self.score = score; } PacketC::SetIngame { state: _, lobby: _ } => { // TODO |