diff --git a/src/hud.rs b/src/hud.rs index ce795d0..04df403 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -1,4 +1,4 @@ -use crate::{settings, actor, audio}; +use crate::{settings, actor, audio, nature}; use bevy::prelude::*; use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin}; use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; @@ -359,7 +359,15 @@ fn update( text.sections[3].value = format!("{power:}Wh"); let oxy_percent = suit.oxygen / suit.oxygen_max * 100.0; let oxy_total = suit.oxygen * 1e6; - text.sections[5].value = format!("{oxy_percent:.1}% [{oxy_total:.0}mg]"); + + // 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[5].value = format!("{oxy_percent:.1}% [{oxy_total:.0}mg] [lasts {oxy_hour:.1} hours]"); + } else { + let oxy_min = suit.oxygen / nature::OXY_M; + text.sections[5].value = format!("{oxy_percent:.1}% [{oxy_total:.0}mg] [lasts {oxy_min:.1} min]"); + } let adrenaline = lifeform.adrenaline * 990.0 + 10.0; text.sections[7].value = format!("{adrenaline:.0}pg/mL"); let all_actors = query_all_actors.iter().len();