implement hud info for remaining oxygen duration
This commit is contained in:
parent
b22f780f73
commit
36b6e3696c
12
src/hud.rs
12
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();
|
||||
|
|
Loading…
Reference in a new issue