remove most written information from top-left part of HUD

This commit is contained in:
yuni 2024-05-08 01:12:17 +02:00
parent 0a4e3c3006
commit c1755b87bf

View file

@ -256,18 +256,7 @@ fn setup(
let version = &settings.version;
let mut bundle_fps = TextBundle::from_sections([
TextSection::new("", style.clone()),
TextSection::new(format!(" OutFlyOS v{version}"), style.clone()),
TextSection::new("", style.clone()),
TextSection::new("", style.clone()),
TextSection::new("", style.clone()),
TextSection::new("", style.clone()),
TextSection::new("\n氧 OXYGEN ", style.clone()),
TextSection::new("", style.clone()),
TextSection::new("\nProximity 警告 ", style.clone()),
TextSection::new("", style.clone()),
TextSection::new("\nSuit Integrity ", style.clone()),
TextSection::new("", style.clone()),
TextSection::new("\nVitals ", style.clone()),
TextSection::new(format!(" OutFlyOS v{version}"), style.clone()),
TextSection::new("", style.clone()),
TextSection::new("", style.clone()), // Speed
TextSection::new("", style.clone()), // Target
@ -708,7 +697,6 @@ fn update_hud(
mut q_node_console: Query<&mut Text, (With<NodeConsole>, Without<NodeHud>, Without<NodeChoiceText>)>,
mut q_node_choice: Query<&mut Text, (With<NodeChoiceText>, Without<NodeHud>, Without<NodeConsole>)>,
mut q_node_currentline: Query<&mut Text, (With<NodeCurrentChatLine>, Without<NodeHud>, Without<NodeConsole>, Without<NodeChoiceText>)>,
query_all_actors: Query<&actor::Actor>,
settings: Res<var::Settings>,
q_target: Query<(&IsClickable, Option<&Position>, Option<&LinearVelocity>), With<IsTargeted>>,
) {
@ -718,50 +706,16 @@ fn update_hud(
let player = player.get_single();
let mut freshest_line: f64 = 0.0;
if player.is_ok() && q_camera_result.is_ok() {
let (hp, suit, gforce) = player.unwrap();
let (_, _, gforce) = player.unwrap();
let (pos, _) = q_camera_result.unwrap();
for mut text in &mut q_node_hud {
text.sections[0].value = format!("2524-03-12 03:02");
if let Some(fps) = diagnostics.get(&FrameTimeDiagnosticsPlugin::FPS) {
if let Some(value) = fps.smoothed() {
// Update the value of the second section
text.sections[4].value = format!("{value:.0}");
text.sections[2].value = format!("{value:.0}");
}
}
let power = suit.power / suit.power_max * 100.0;
text.sections[2].value = format!("{power:}%");
let oxy_percent = suit.oxygen / suit.oxygen_max * 100.0;
// the remaining oxygen hud info ignores leaking suits from low integrity
if suit.oxygen > nature::OXY_H {
let oxy_hour = suit.oxygen / nature::OXY_H;
text.sections[7].value = format!("{oxy_percent:.1}% [lasts {oxy_hour:.1} hours]");
text.sections[7].style.color = settings.hud_color;
} else {
let oxy_min = suit.oxygen / nature::OXY_M;
text.sections[7].value = format!("{oxy_percent:.1}% [lasts {oxy_min:.1} min]");
text.sections[7].style.color = settings.hud_color_alert;
}
//let adrenaline = lifeform.adrenaline * 990.0 + 10.0;
//text.sections[11].value = format!("{adrenaline:.0}pg/mL");
let vitals = 100.0 * hp.current / hp.max;
text.sections[13].value = format!("{vitals:.0}%");
if vitals < 50.0 {
text.sections[13].style.color = settings.hud_color_alert;
} else {
text.sections[13].style.color = settings.hud_color;
}
let all_actors = query_all_actors.iter().len();
text.sections[9].value = format!("{all_actors:.0}");
let integrity = suit.integrity * 100.0;
if integrity < 50.0 {
text.sections[11].style.color = settings.hud_color_alert;
text.sections[11].value = format!("{integrity:.0}% [LEAKING]");
} else {
text.sections[11].style.color = settings.hud_color;
text.sections[11].value = format!("{integrity:.0}%");
}
//text.sections[17].value = format!("{speed_readable}/s / {kmh:.0}km/h / {gforce:.1}g");
// Target display
let dist_scalar: f64;
@ -805,13 +759,13 @@ fn update_hud(
// };
let dev_speed = "";
let gforce = gforce.gforce;
text.sections[14].value = format!("\n{gforce:.1}g{dev_speed}");
text.sections[3].value = format!("\n{gforce:.1}g{dev_speed}");
if target_multiple {
text.sections[15].value = "\n\nERROR: MULTIPLE TARGETS".to_string();
text.sections[4].value = "\n\nERROR: MULTIPLE TARGETS".to_string();
}
else if target_error {
text.sections[15].value = "\n\nERROR: FAILED TO AQUIRE TARGET".to_string();
text.sections[4].value = "\n\nERROR: FAILED TO AQUIRE TARGET".to_string();
}
else if let Ok((clickable, _, _)) = q_target.get_single() {
let distance = if dist_scalar.is_nan() {
@ -827,10 +781,10 @@ fn update_hud(
} else {
"".to_string()
};
text.sections[15].value = format!("\n\nTarget: {target_name}\n{pronoun}Distance: {distance}");
text.sections[4].value = format!("\n\nTarget: {target_name}\n{pronoun}Distance: {distance}");
}
else {
text.sections[15].value = "".to_string();
text.sections[4].value = "".to_string();
}
}
}