From 4b9ed44dd4609933871ef53c9905f6a6a55a40f9 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 8 May 2024 01:20:22 +0200 Subject: [PATCH] less frequent updating of speedometer, dashboard, gauges --- src/hud.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/hud.rs b/src/hud.rs index db477e2..e4eb3fc 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -607,21 +607,29 @@ fn setup( } fn update_dashboard( + timer: ResMut, mut q_flashlight: Query<&mut Visibility, With>, settings: Res, ) { + if !timer.0.just_finished() { + return; + } for mut vis in &mut q_flashlight { *vis = bool2vis(settings.flashlight_active); } } fn update_speedometer( + timer: ResMut, q_camera: Query<&LinearVelocity, With>, q_target: Query<&LinearVelocity, With>, mut q_speedometer: Query<&mut Style, (With, Without)>, mut q_speedometer2: Query<&mut Style, (With, Without)>, mut q_node_speed: Query<&mut Text, With>, ) { + if !timer.0.just_finished() { + return; + } if let Ok(cam_v) = q_camera.get_single() { let speed = cam_v.length(); @@ -659,10 +667,14 @@ fn update_speedometer( } fn update_gauges( + timer: ResMut, q_player: Query<(&actor::HitPoints, &actor::Suit), With>, mut q_gauges: Query<(&mut Style, &mut BackgroundColor, &Gauge, &GaugeLength)>, settings: Res, ) { + if !timer.0.just_finished() { + return; + } let player = q_player.get_single(); if player.is_err() { return; } let (hp, suit) = player.unwrap();