From 594b05f6389afa3f18d7ebfc777855b29a507e05 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 15 Apr 2024 21:28:52 +0200 Subject: [PATCH] always show "absolute" speed, even if targeting --- src/hud.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/hud.rs b/src/hud.rs index 5b36a74..044f0c4 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -218,6 +218,7 @@ fn setup( TextSection::new("", style.clone()), TextSection::new("\nVitals ", style.clone()), TextSection::new("", style.clone()), + TextSection::new("", style.clone()), // Speed TextSection::new("", style.clone()), // Target ]).with_style(Style { position_type: PositionType::Absolute, @@ -451,6 +452,10 @@ fn update_hud( "".to_string() }; let gforce = gforce.gforce; + let speed = cam_v.length(); + let speed_readable = nature::readable_distance(speed); + text.sections[14].value = format!("\n{speed_readable}/s\n{gforce:.1}g{dev_speed}"); + if let Ok((clickable, _, target_v_maybe)) = q_target.get_single() { let distance = if dist_scalar.is_nan() { "UNKNOWN".to_string() @@ -466,12 +471,10 @@ fn update_hud( }; let speed_readable = nature::readable_distance(speed); let target_name = clickable.name.clone().unwrap_or("Unnamed".to_string()); - text.sections[14].value = format!("\n\nTarget: {target_name}\nDistance: {distance}\nΔv {speed_readable}/s + {gforce:.1}g{dev_speed}"); + text.sections[15].value = format!("\n\nTarget: {target_name}\nDistance: {distance}\nΔv {speed_readable}/s"); } else { - let speed = cam_v.length(); - let speed_readable = nature::readable_distance(speed); - text.sections[14].value = format!("\nv {speed_readable}/s + {gforce:.1}g{dev_speed}"); + text.sections[15].value = "".to_string(); } } }