summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2025-06-06 18:04:05 +0200
committertpart <tpart120@proton.me>2025-06-06 18:04:11 +0200
commit22d5a487627bccd9f8f99895f04d9107107b7a6b (patch)
treed977dc64203a253f2c64541fde414c0c73ca73ea
parentfe11bc036ad342e178ba29e66e014baa1e60d380 (diff)
downloadhurrycurry-22d5a487627bccd9f8f99895f04d9107107b7a6b.tar
hurrycurry-22d5a487627bccd9f8f99895f04d9107107b7a6b.tar.bz2
hurrycurry-22d5a487627bccd9f8f99895f04d9107107b7a6b.tar.zst
Correctly implement pausing (Fix #284)
-rw-r--r--client/game.gd5
-rw-r--r--client/global.gd2
-rw-r--r--client/map/items/item.gd15
-rw-r--r--client/menu/communicate/item/item_message.gd2
4 files changed, 15 insertions, 9 deletions
diff --git a/client/game.gd b/client/game.gd
index 5503c017..849f970b 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -350,7 +350,10 @@ func handle_packet(p):
get_parent().replace_menu("res://menu/game.tscn", p.uri[0])
"replay_start":
is_replay = true
-
+ "pause":
+ overlay.timer.paused = p.state
+ Global.game_paused = p.state
+
_: push_error("Unrecognized packet type: %s" % p.type)
func set_join_state(state: JoinState):
diff --git a/client/global.gd b/client/global.gd
index 8fd50ac6..4c147198 100644
--- a/client/global.gd
+++ b/client/global.gd
@@ -55,6 +55,8 @@ var settings: Dictionary
var settings_tree: GameSetting
+var game_paused := false
+
var server_url = ""
var error_message = ""
diff --git a/client/map/items/item.gd b/client/map/items/item.gd
index f7592d87..eed38596 100644
--- a/client/map/items/item.gd
+++ b/client/map/items/item.gd
@@ -79,14 +79,15 @@ func _process(delta):
if destroy_timeout <= 0: queue_free()
else: scale = Vector3.ONE * destroy_timeout
+ if !Global.game_paused:
+ progress_position += delta * progress_speed
+ progress_instance.update(progress_position, progress_warn)
+ var time_remaining = (1 - progress_position) / progress_speed
- progress_position += delta * progress_speed
- progress_instance.update(progress_position, progress_warn)
- var time_remaining = (1 - progress_position) / progress_speed
-
- if progress_warn and progress_speed > 0 and time_remaining < 5.:
- if not beep_sound.playing:
- beep_sound.play()
+ if progress_warn and progress_speed > 0 and time_remaining < 5.:
+ if not beep_sound.playing:
+ beep_sound.play()
+ else: beep_sound.stop()
else: beep_sound.stop()
func progress(position_: float, speed: float, warn: bool):
diff --git a/client/menu/communicate/item/item_message.gd b/client/menu/communicate/item/item_message.gd
index dfbaf232..94fdf82d 100644
--- a/client/menu/communicate/item/item_message.gd
+++ b/client/menu/communicate/item/item_message.gd
@@ -63,7 +63,7 @@ func remove_item():
item_render.remove_item()
func _process(delta):
- if item_render.item != null:
+ if item_render.item != null and !Global.game_paused:
timeout_remaining -= delta
progress.value = timeout_remaining
var x: float = timeout_remaining / timeout_initial