Compare commits

..

3 commits

Author SHA1 Message Date
yuni afb67d0d0f smaller flashlight cone 2024-09-22 17:12:46 +02:00
yuni 3105b75b1c reduce all power gain/usage, turning kW into W 2024-09-22 17:12:23 +02:00
yuni ef7aae7201 clean up menu 2024-09-22 16:21:18 +02:00
3 changed files with 29 additions and 29 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

@ -1077,9 +1077,9 @@ fn spawn_entities(
intensity: actor::FLASHLIGHT_INTENSITY[prefs.flashlight_power], intensity: actor::FLASHLIGHT_INTENSITY[prefs.flashlight_power],
color: Color::WHITE, color: Color::WHITE,
shadows_enabled: true, shadows_enabled: true,
inner_angle: PI32 / 8.0 * 0.85, inner_angle: PI32 / 8.0 * 0.65,
outer_angle: PI32 / 4.0, outer_angle: PI32 / 8.0 * 1.2,
range: 3000.0, range: 300000.0,
..default() ..default()
}, },
visibility: Visibility::Hidden, visibility: Visibility::Hidden,

View file

@ -63,9 +63,9 @@ pub enum DeathScreenEvent {
} }
pub const MENUDEF: &[(&str, MenuAction)] = &[ pub const MENUDEF: &[(&str, MenuAction)] = &[
("", MenuAction::ToggleMap),
("", MenuAction::ToggleAR), ("", MenuAction::ToggleAR),
("", MenuAction::ChangeARAvatar), ("", MenuAction::ChangeARAvatar),
("", MenuAction::ToggleMap),
("", MenuAction::ModLightAmp), ("", MenuAction::ModLightAmp),
("", MenuAction::ModFlashlightPower), ("", MenuAction::ModFlashlightPower),
("", MenuAction::ModThrusterBoost), ("", MenuAction::ModThrusterBoost),
@ -73,8 +73,8 @@ pub const MENUDEF: &[(&str, MenuAction)] = &[
("", MenuAction::ToggleSound), ("", MenuAction::ToggleSound),
("", MenuAction::ToggleMusic), ("", MenuAction::ToggleMusic),
("", MenuAction::ToggleCamera), ("", MenuAction::ToggleCamera),
("Toggle Fullscreen [F11]", MenuAction::ToggleFullscreen),
("", MenuAction::ToggleShadows), ("", MenuAction::ToggleShadows),
("Fullscreen [F11]", MenuAction::ToggleFullscreen),
("Take Off Helmet", MenuAction::Restart), ("Take Off Helmet", MenuAction::Restart),
("Quit", MenuAction::Quit), ("Quit", MenuAction::Quit),
]; ];
@ -475,7 +475,7 @@ pub fn update_menu(
} else { } else {
&settings.noise_cancellation_modes[0] &settings.noise_cancellation_modes[0]
}; };
text.sections[i].value = format!("Noise Cancellation: {noisecancel}\n"); text.sections[i].value = format!("\nNoise Cancellation: {noisecancel}\n");
} }
MenuAction::ToggleMusic => { MenuAction::ToggleMusic => {
let station = let station =
@ -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!("Light 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) {
@ -538,13 +538,13 @@ pub fn update_menu(
} else { } else {
"1st Person" "1st Person"
}; };
text.sections[i].value = format!("Camera: {onoff} [C]\n"); text.sections[i].value = format!("\nCamera: {onoff} [C]\n");
} }
MenuAction::ToggleShadows => { MenuAction::ToggleShadows => {
let onoff = if settings.shadows_sun { let onoff = if settings.shadows_sun {
"Flashlight + Sun" "High"
} else { } else {
"Flashlight Only" "Low"
}; };
text.sections[i].value = format!("Shadows: {onoff}\n"); text.sections[i].value = format!("Shadows: {onoff}\n");
} }