summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-06-02 18:04:20 +0200
committermetamuffin <metamuffin@disroot.org>2025-06-02 18:04:20 +0200
commit8059e28bbc363dd6304cc67db69dbc573f6e0280 (patch)
tree762eecaac7c6807098e63ddb71f6b54072d0b2b3
parentb838981cfd164dad36f7e919238211bb87f96578 (diff)
downloadhurrycurry-8059e28bbc363dd6304cc67db69dbc573f6e0280.tar
hurrycurry-8059e28bbc363dd6304cc67db69dbc573f6e0280.tar.bz2
hurrycurry-8059e28bbc363dd6304cc67db69dbc573f6e0280.tar.zst
send clientbound pause notification
-rw-r--r--server/protocol/src/lib.rs3
-rw-r--r--server/src/state.rs2
-rw-r--r--test-client/protocol.ts1
3 files changed, 6 insertions, 0 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs
index 7c815254..4f0d5d67 100644
--- a/server/protocol/src/lib.rs
+++ b/server/protocol/src/lib.rs
@@ -231,6 +231,9 @@ pub enum PacketC {
dir: Vec2,
boost: bool,
},
+ Pause {
+ state: bool,
+ },
MoveItem {
from: ItemLocation,
to: ItemLocation,
diff --git a/server/src/state.rs b/server/src/state.rs
index 53ca3b42..a509a3bd 100644
--- a/server/src/state.rs
+++ b/server/src/state.rs
@@ -27,6 +27,8 @@ impl Server {
info!("Game paused: {}", should_pause);
self.paused = should_pause;
for p in self.game.players.keys() {
+ self.packet_out
+ .push_back(PacketC::Pause { state: self.paused });
self.packet_out.push_back(PacketC::ServerHint {
position: None,
message: if self.paused {
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index d1cd9c07..6a1d2909 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -69,6 +69,7 @@ export type PacketC =
| { type: "environment", effects: string[] }
| { type: "tutorial_ended", item: ItemIndex, player: PlayerID, success: boolean }
| { type: "set_ingame", state: boolean, lobby: boolean } // Set to false when entering the game or switching maps
+ | { type: "pause", state: boolean } // Set game paused so clients dont increment timers
export type Menu =
{ menu: "document", data: DocumentElement }