menu: display suit system power usage
This commit is contained in:
parent
ae3e9c9b48
commit
0b5058abf5
|
@ -115,7 +115,7 @@ A variety of relatively simple game systems should interact with each other to c
|
||||||
- [X] Augmented Reality
|
- [X] Augmented Reality
|
||||||
- [X] Flashlight intensity
|
- [X] Flashlight intensity
|
||||||
- [ ] AI assistance systems
|
- [ ] AI assistance systems
|
||||||
- [ ] Thruster boost
|
- [X] Thruster boost
|
||||||
- [ ] G-force dampeners
|
- [ ] G-force dampeners
|
||||||
- [ ] Life support, material recyclers (air, water, etc)
|
- [ ] Life support, material recyclers (air, water, etc)
|
||||||
- [ ] High energy particle shield?
|
- [ ] High energy particle shield?
|
||||||
|
|
12
src/actor.rs
12
src/actor.rs
|
@ -21,10 +21,12 @@ use bevy_xpbd_3d::prelude::*;
|
||||||
pub const ENGINE_SPEED_FACTOR: f32 = 30.0;
|
pub const ENGINE_SPEED_FACTOR: f32 = 30.0;
|
||||||
const MAX_TRANSMISSION_DISTANCE: f32 = 100.0;
|
const MAX_TRANSMISSION_DISTANCE: f32 = 100.0;
|
||||||
const MAX_INTERACT_DISTANCE: f32 = 50.0;
|
const MAX_INTERACT_DISTANCE: f32 = 50.0;
|
||||||
const POWER_DRAIN_THRUSTER: [f32; 3] = [3e6, 3e6, 0.0];
|
pub const POWER_DRAIN_THRUSTER: [f32; 3] = [3e6, 3e6, 0.0];
|
||||||
const THRUSTER_BOOST_FACTOR: [f64; 3] = [3.0, 3.0, 0.0];
|
pub const THRUSTER_BOOST_FACTOR: [f64; 3] = [3.0, 3.0, 0.0];
|
||||||
const POWER_DRAIN_FLASHLIGHT: [f32; 3] = [200e3, 1500e3, 2500e3];
|
pub const POWER_DRAIN_FLASHLIGHT: [f32; 3] = [200e3, 1500e3, 2500e3];
|
||||||
pub const FLASHLIGHT_INTENSITY: [f32; 3] = [10e6, 400e6, 2e9]; // in lumens
|
pub const FLASHLIGHT_INTENSITY: [f32; 3] = [10e6, 400e6, 2e9]; // in lumens
|
||||||
|
pub const POWER_DRAIN_LIGHTAMP: [f32; 4] = [0.0, 200e3, 400e3, 800e3];
|
||||||
|
pub const POWER_DRAIN_AR: f32 = 300e3;
|
||||||
|
|
||||||
pub struct ActorPlugin;
|
pub struct ActorPlugin;
|
||||||
impl Plugin for ActorPlugin {
|
impl Plugin for ActorPlugin {
|
||||||
|
@ -295,8 +297,8 @@ pub fn update_power(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if settings.hud_active {
|
if settings.hud_active {
|
||||||
let mut hud_drain = 300e3; // 300kW
|
let mut hud_drain = POWER_DRAIN_AR;
|
||||||
hud_drain += prefs.light_amp as f32 * 200e3; // 200kW per level
|
hud_drain += POWER_DRAIN_LIGHTAMP[prefs.light_amp];
|
||||||
battery.power -= hud_drain * d;
|
battery.power -= hud_drain * d;
|
||||||
if battery.power <= 0.0 {
|
if battery.power <= 0.0 {
|
||||||
power_down = true;
|
power_down = true;
|
||||||
|
|
16
src/menu.rs
16
src/menu.rs
|
@ -486,15 +486,21 @@ pub fn update_menu(
|
||||||
}
|
}
|
||||||
MenuAction::ToggleAR => {
|
MenuAction::ToggleAR => {
|
||||||
let onoff = bool2string(settings.hud_active);
|
let onoff = bool2string(settings.hud_active);
|
||||||
text.sections[i].value = format!("Augmented Reality: {onoff} [TAB]\n");
|
let p = if settings.hud_active { actor::POWER_DRAIN_AR / 1e3 } else { 0.0 };
|
||||||
|
let kw = if p > 0.0 { format!(" ({p}kW)") } else { String::from("") };
|
||||||
|
text.sections[i].value = format!("Augmented Reality: {onoff}{kw} [TAB]\n");
|
||||||
}
|
}
|
||||||
MenuAction::ModLightAmp => {
|
MenuAction::ModLightAmp => {
|
||||||
let n = prefs.light_amp;
|
let n = prefs.light_amp;
|
||||||
text.sections[i].value = format!("Light Amplification: {n}/3\n");
|
let p = actor::POWER_DRAIN_LIGHTAMP[prefs.light_amp] / 1e3;
|
||||||
|
let kw = if p > 0.0 { format!(" ({p}kW)") } else { String::from("") };
|
||||||
|
text.sections[i].value = format!("Light Amplification: {n}/3{kw}\n");
|
||||||
}
|
}
|
||||||
MenuAction::ModFlashlightPower => {
|
MenuAction::ModFlashlightPower => {
|
||||||
let n = prefs.flashlight_power + 1;
|
let n = prefs.flashlight_power + 1;
|
||||||
text.sections[i].value = format!("Flashlight Power: {n}/3\n");
|
let p = actor::POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] / 1e3;
|
||||||
|
let kw = if p > 0.0 { format!(" ({p}kW)") } else { String::from("") };
|
||||||
|
text.sections[i].value = format!("Flashlight Power: {n}/3{kw}\n");
|
||||||
}
|
}
|
||||||
MenuAction::ModThrusterBoost => {
|
MenuAction::ModThrusterBoost => {
|
||||||
let state = match prefs.thruster_boost {
|
let state = match prefs.thruster_boost {
|
||||||
|
@ -503,7 +509,9 @@ pub fn update_menu(
|
||||||
2 => "Off",
|
2 => "Off",
|
||||||
_ => "ERROR",
|
_ => "ERROR",
|
||||||
};
|
};
|
||||||
text.sections[i].value = format!("Thruster Boost: {state}\n");
|
let p = actor::POWER_DRAIN_THRUSTER[prefs.thruster_boost] / 1e3;
|
||||||
|
let kw = if p > 0.0 { format!(" ({p}kW)") } else { String::from("") };
|
||||||
|
text.sections[i].value = format!("Thruster Boost: {state}{kw}\n");
|
||||||
}
|
}
|
||||||
MenuAction::ChangeARAvatar => {
|
MenuAction::ChangeARAvatar => {
|
||||||
if let Some(ava) = hud::PLAYER_AR_AVATARS.get(settings.ar_avatar) {
|
if let Some(ava) = hud::PLAYER_AR_AVATARS.get(settings.ar_avatar) {
|
||||||
|
|
Loading…
Reference in a new issue