simplify
This commit is contained in:
parent
2ae05214f6
commit
48e54265f9
33
src/hud.rs
33
src/hud.rs
|
@ -439,7 +439,6 @@ fn update_hud(
|
||||||
let integrity = suit.integrity * 100.0;
|
let integrity = suit.integrity * 100.0;
|
||||||
text.sections[11].value = format!("{integrity:.0}%");
|
text.sections[11].value = format!("{integrity:.0}%");
|
||||||
let speed = cam_v.length();
|
let speed = cam_v.length();
|
||||||
let kmh = speed * 60.0 * 60.0 / 1000.0;
|
|
||||||
let speed_readable = nature::readable_distance(speed);
|
let speed_readable = nature::readable_distance(speed);
|
||||||
let gforce = gforce.gforce;
|
let gforce = gforce.gforce;
|
||||||
//text.sections[17].value = format!("{speed_readable}/s / {kmh:.0}km/h / {gforce:.1}g");
|
//text.sections[17].value = format!("{speed_readable}/s / {kmh:.0}km/h / {gforce:.1}g");
|
||||||
|
@ -469,28 +468,20 @@ fn update_hud(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let target_name: String;
|
if let Ok((_, clickable)) = q_target.get_single() {
|
||||||
let distance: String;
|
let distance = if dist_scalar.is_nan() {
|
||||||
if dist_scalar.is_nan() {
|
"UNKNOWN".to_string()
|
||||||
distance = "UNKNOWN".to_string();
|
} else if dist_scalar != 0.0 {
|
||||||
}
|
nature::readable_distance(dist_scalar)
|
||||||
else if dist_scalar != 0.0 {
|
} else {
|
||||||
distance = nature::readable_distance(dist_scalar);
|
"ERROR".to_string()
|
||||||
}
|
};
|
||||||
else {
|
let target_name = clickable.name.clone().unwrap_or("Unnamed".to_string());
|
||||||
distance = "ERROR".to_string();
|
|
||||||
}
|
|
||||||
if q_target.is_empty() {
|
|
||||||
text.sections[14].value = format!("\nv {speed_readable}/s + {gforce:.1}g");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let targets: Vec<String> = q_target
|
|
||||||
.iter()
|
|
||||||
.map(|(_, clickable)| clickable.name.clone().unwrap_or("<unnamed>".to_string()))
|
|
||||||
.collect();
|
|
||||||
target_name = targets.join(", ");
|
|
||||||
text.sections[14].value = format!("\n\nTarget: {target_name}\nDistance: {distance}\nΔv {speed_readable}/s + {gforce:.1}g");
|
text.sections[14].value = format!("\n\nTarget: {target_name}\nDistance: {distance}\nΔv {speed_readable}/s + {gforce:.1}g");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
text.sections[14].value = format!("\nv {speed_readable}/s + {gforce:.1}g");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue