perf(match): emit timer_updated only when the displayed second changes

match_mode.gd fired the signal every frame while only the once-a-second
value is displayed, forcing the HUD to re-format and re-shape the label
each frame. Gate emission on the whole-second value changing, matching
ship.gd's threshold-gated telemetry discipline.
This commit is contained in:
Josh Creek
2026-08-04 19:41:37 +01:00
parent c96325144a
commit 5193776d86
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -30,6 +30,7 @@ const KICKOFF_COUNTDOWN_SECONDS := 3
var match_timer: Timer
var _in_overtime := false
var _match_over := false
var _last_timer_remaining := -1
func _get_arena_scene_path() -> String:
@@ -64,7 +65,9 @@ func _make_opponent_controller() -> ShipController:
func _process(_delta):
if match_timer and match_timer.time_left > 0:
var remaining := ceili(match_timer.time_left)
timer_updated.emit(floori(remaining / 60.0), remaining % 60)
if remaining != _last_timer_remaining:
_last_timer_remaining = remaining
timer_updated.emit(floori(remaining / 60.0), remaining % 60)
func _on_goal_scored(conceding_team: int) -> void: