color vitals/suit integrity red if low

This commit is contained in:
yuni 2024-04-15 02:32:30 +02:00
parent b857d46119
commit eb3353bb07

View file

@ -318,10 +318,20 @@ fn update_hud(
//text.sections[11].value = format!("{adrenaline:.0}pg/mL"); //text.sections[11].value = format!("{adrenaline:.0}pg/mL");
let vitals = 100.0 * hp.current / hp.max; let vitals = 100.0 * hp.current / hp.max;
text.sections[13].value = format!("{vitals:.0}%"); text.sections[13].value = format!("{vitals:.0}%");
if vitals < 50.0 {
text.sections[13].style.color = Color::MAROON;
} else {
text.sections[13].style.color = Color::GRAY;
}
let all_actors = query_all_actors.iter().len(); let all_actors = query_all_actors.iter().len();
text.sections[9].value = format!("{all_actors:.0}"); text.sections[9].value = format!("{all_actors:.0}");
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}%");
if integrity < 50.0 {
text.sections[11].style.color = Color::MAROON;
} else {
text.sections[11].style.color = Color::GRAY;
}
//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");
// Target display // Target display