From f79b5deb0427ccbdde3e99d3ed67e53998da24de Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 8 May 2024 01:38:29 +0200 Subject: [PATCH] don't update HUD if it's turned off --- src/hud.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hud.rs b/src/hud.rs index f3c84a6..cff9800 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -612,7 +612,7 @@ fn update_dashboard( mut q_flashlight: Query<&mut Visibility, With>, settings: Res, ) { - if !timer.0.just_finished() { + if !settings.hud_active || !timer.0.just_finished() { return; } for mut vis in &mut q_flashlight { @@ -622,6 +622,7 @@ fn update_dashboard( fn update_speedometer( timer: ResMut, + settings: Res, q_camera: Query<&LinearVelocity, With>, q_player: Query<&actor::ExperiencesGForce, With>, q_target: Query<&LinearVelocity, With>, @@ -629,7 +630,7 @@ fn update_speedometer( mut q_speedometer2: Query<&mut Style, (With, Without)>, mut q_node_speed: Query<&mut Text, With>, ) { - if !timer.0.just_finished() { + if !settings.hud_active || !timer.0.just_finished() { return; } if let Ok(cam_v) = q_camera.get_single() { @@ -688,7 +689,7 @@ fn update_gauges( mut q_gauges: Query<(&mut Style, &mut BackgroundColor, &Gauge, &GaugeLength)>, settings: Res, ) { - if !timer.0.just_finished() { + if !settings.hud_active || !timer.0.just_finished() { return; } let player = q_player.get_single(); @@ -727,11 +728,10 @@ fn update_hud( settings: Res, q_target: Query<(&IsClickable, Option<&Position>, Option<&LinearVelocity>), With>, ) { - // TODO only when hud is actually on if timer.0.tick(time.delta()).just_finished() || log.needs_rerendering { let q_camera_result = q_camera.get_single(); let mut freshest_line: f64 = 0.0; - if q_camera_result.is_ok() { + if settings.hud_active && q_camera_result.is_ok() { let (pos, _) = q_camera_result.unwrap(); for mut text in &mut q_node_hud { text.sections[0].value = format!("2524-03-12 03:02");