reduce all power gain/usage, turning kW into W

This commit is contained in:
yuni 2024-09-22 17:12:23 +02:00
parent ef7aae7201
commit 3105b75b1c
2 changed files with 20 additions and 20 deletions

View file

@ -21,13 +21,13 @@ 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;
pub const POWER_DRAIN_THRUSTER: [f32; 3] = [3e6, 3e6, 0.0]; pub const POWER_DRAIN_THRUSTER: [f32; 3] = [3000.0, 3000.0, 0.0];
pub 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];
pub const POWER_DRAIN_FLASHLIGHT: [f32; 4] = [200e3, 1500e3, 2500e3, 10000e3]; pub const POWER_DRAIN_FLASHLIGHT: [f32; 4] = [200.0, 1500.0, 2500.0, 10000.0];
pub const FLASHLIGHT_INTENSITY: [f32; 4] = [10e6, 400e6, 2e9, 100e9]; // in lumens pub const FLASHLIGHT_INTENSITY: [f32; 4] = [10e6, 400e6, 2e9, 100e9]; // in lumens
pub const POWER_DRAIN_LIGHTAMP: [f32; 4] = [0.0, 200e3, 400e3, 1400e3]; pub const POWER_DRAIN_LIGHTAMP: [f32; 4] = [0.0, 200.0, 400.0, 1400.0];
pub const POWER_DRAIN_AR: f32 = 300e3; pub const POWER_DRAIN_AR: f32 = 300.0;
pub const POWER_GAIN_REACTOR: [f32; 3] = [0.0, 2000e3, 10000e3]; pub const POWER_GAIN_REACTOR: [f32; 3] = [0.0, 2000.0, 10000.0];
pub struct ActorPlugin; pub struct ActorPlugin;
impl Plugin for ActorPlugin { impl Plugin for ActorPlugin {
@ -268,8 +268,8 @@ pub struct Battery {
impl Default for Battery { impl Default for Battery {
fn default() -> Self { fn default() -> Self {
Self { Self {
power: 10e3 * 3600.0, power: 10.0 * 3600.0,
capacity: 10e3 * 3600.0, // 10kWh capacity: 10.0 * 3600.0, // 10Wh
overloaded_recovering: false, overloaded_recovering: false,
} }
} }

View file

@ -488,17 +488,17 @@ pub fn update_menu(
} }
MenuAction::ToggleAR => { MenuAction::ToggleAR => {
let onoff = bool2string(settings.hud_active); let onoff = bool2string(settings.hud_active);
let p = if settings.hud_active { actor::POWER_DRAIN_AR / 1e3 } else { 0.0 }; let p = if settings.hud_active { actor::POWER_DRAIN_AR } else { 0.0 };
let kw = if p > 0.0 { format!(" ({p}kW)") } else { String::from("") }; let w = if p > 0.0 { format!(" ({p}W)") } else { String::from("") };
text.sections[i].value = format!("Augmented Reality: {onoff}{kw} [TAB]\n"); text.sections[i].value = format!("Augmented Reality: {onoff}{w} [TAB]\n");
} }
MenuAction::ModLightAmp => { MenuAction::ModLightAmp => {
let p = actor::POWER_DRAIN_LIGHTAMP[prefs.light_amp] / 1e3; let p = actor::POWER_DRAIN_LIGHTAMP[prefs.light_amp];
text.sections[i].value = format!("\nLight Amplification: {p}kW\n"); text.sections[i].value = format!("\nLight Amplification: {p}W\n");
} }
MenuAction::ModFlashlightPower => { MenuAction::ModFlashlightPower => {
let p = actor::POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] / 1e3; let p = actor::POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power];
text.sections[i].value = format!("Flashlight Power: {p}kW\n"); text.sections[i].value = format!("Flashlight Power: {p}W\n");
} }
MenuAction::ModThrusterBoost => { MenuAction::ModThrusterBoost => {
let state = match prefs.thruster_boost { let state = match prefs.thruster_boost {
@ -507,9 +507,9 @@ pub fn update_menu(
2 => "Off", 2 => "Off",
_ => "ERROR", _ => "ERROR",
}; };
let p = actor::POWER_DRAIN_THRUSTER[prefs.thruster_boost] / 1e3; let p = actor::POWER_DRAIN_THRUSTER[prefs.thruster_boost];
let kw = if p > 0.0 { format!(" ({p}kW)") } else { String::from("") }; let w = if p > 0.0 { format!(" ({p}W)") } else { String::from("") };
text.sections[i].value = format!("Thruster Boost: {state}{kw}\n"); text.sections[i].value = format!("Thruster Boost: {state}{w}\n");
} }
MenuAction::ModReactor => { MenuAction::ModReactor => {
let state = match settings.reactor_state { let state = match settings.reactor_state {
@ -518,9 +518,9 @@ pub fn update_menu(
2 => "OVERLOAD", 2 => "OVERLOAD",
_ => "ERROR", _ => "ERROR",
}; };
let p = actor::POWER_GAIN_REACTOR[settings.reactor_state] / 1e3; let p = actor::POWER_GAIN_REACTOR[settings.reactor_state];
let kw = if p > 0.0 { format!(" (+{p}kW)") } else { String::from("") }; let w = if p > 0.0 { format!(" (+{p}W)") } else { String::from("") };
text.sections[i].value = format!("Reactor: {state}{kw}\n"); text.sections[i].value = format!("Reactor: {state}{w}\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) {