always show "absolute" speed, even if targeting

This commit is contained in:
yuni 2024-04-15 21:28:52 +02:00
parent 76548d86a4
commit 594b05f638

View file

@ -218,6 +218,7 @@ fn setup(
TextSection::new("", style.clone()), TextSection::new("", style.clone()),
TextSection::new("\nVitals ", style.clone()), TextSection::new("\nVitals ", style.clone()),
TextSection::new("", style.clone()), TextSection::new("", style.clone()),
TextSection::new("", style.clone()), // Speed
TextSection::new("", style.clone()), // Target TextSection::new("", style.clone()), // Target
]).with_style(Style { ]).with_style(Style {
position_type: PositionType::Absolute, position_type: PositionType::Absolute,
@ -451,6 +452,10 @@ fn update_hud(
"".to_string() "".to_string()
}; };
let gforce = gforce.gforce; 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() { if let Ok((clickable, _, target_v_maybe)) = q_target.get_single() {
let distance = if dist_scalar.is_nan() { let distance = if dist_scalar.is_nan() {
"UNKNOWN".to_string() "UNKNOWN".to_string()
@ -466,12 +471,10 @@ fn update_hud(
}; };
let speed_readable = nature::readable_distance(speed); let speed_readable = nature::readable_distance(speed);
let target_name = clickable.name.clone().unwrap_or("Unnamed".to_string()); 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 { else {
let speed = cam_v.length(); text.sections[15].value = "".to_string();
let speed_readable = nature::readable_distance(speed);
text.sections[14].value = format!("\nv {speed_readable}/s + {gforce:.1}g{dev_speed}");
} }
} }
} }