correctly show unknown star distances
This commit is contained in:
parent
58bd34cfd0
commit
9881154489
11
src/hud.rs
11
src/hud.rs
|
@ -527,7 +527,11 @@ fn update_hud(
|
|||
// Target display
|
||||
let (x, y, z, dist_scalar) : (f64, f64, f64, f64);
|
||||
if let Ok((_, IsClickable { distance: Some(dist), .. })) = q_target.get_single() {
|
||||
dist_scalar = *dist;
|
||||
if *dist >= 100000.0 {
|
||||
dist_scalar = f64::NAN;
|
||||
} else {
|
||||
dist_scalar = *dist;
|
||||
}
|
||||
(x, y, z) = (0.0, 0.0, 0.0);
|
||||
}
|
||||
else {
|
||||
|
@ -552,7 +556,10 @@ fn update_hud(
|
|||
}
|
||||
}
|
||||
|
||||
if dist_scalar != 0.0 {
|
||||
if dist_scalar.is_nan() {
|
||||
text.sections[7].value = format!("distance: UNKNOWN");
|
||||
}
|
||||
else if dist_scalar != 0.0 {
|
||||
text.sections[7].value = format!("{x:.0}m / {z:.0}m / {y:.0}m / distance: {dist_scalar:.0}m");
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue