add extra-bright flash light mode

This commit is contained in:
yuni 2024-09-22 06:39:21 +02:00
parent bb539c00cc
commit 5104f2bbcf
3 changed files with 6 additions and 8 deletions

View file

@ -23,8 +23,8 @@ const MAX_TRANSMISSION_DISTANCE: f32 = 100.0;
const MAX_INTERACT_DISTANCE: f32 = 50.0;
pub const POWER_DRAIN_THRUSTER: [f32; 3] = [3e6, 3e6, 0.0];
pub const THRUSTER_BOOST_FACTOR: [f64; 3] = [3.0, 3.0, 0.0];
pub const POWER_DRAIN_FLASHLIGHT: [f32; 3] = [200e3, 1500e3, 2500e3];
pub const FLASHLIGHT_INTENSITY: [f32; 3] = [10e6, 400e6, 2e9]; // in lumens
pub const POWER_DRAIN_FLASHLIGHT: [f32; 4] = [200e3, 1500e3, 2500e3, 10000e3];
pub const FLASHLIGHT_INTENSITY: [f32; 4] = [10e6, 400e6, 2e9, 100e9]; // in lumens
pub const POWER_DRAIN_LIGHTAMP: [f32; 4] = [0.0, 200e3, 400e3, 800e3];
pub const POWER_DRAIN_AR: f32 = 300e3;
pub const POWER_GAIN_REACTOR: [f32; 3] = [0.0, 2000e3, 10000e3];

View file

@ -499,15 +499,13 @@ pub fn update_menu(
text.sections[i].value = format!("Light Amplification: {n}/3{kw}\n");
}
MenuAction::ModFlashlightPower => {
let n = prefs.flashlight_power + 1;
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");
text.sections[i].value = format!("Flashlight Power: {p}kW\n");
}
MenuAction::ModThrusterBoost => {
let state = match prefs.thruster_boost {
0 => "Only when slowing down",
1 => "MAX POWER",
1 => "Always",
2 => "Off",
_ => "ERROR",
};
@ -634,7 +632,7 @@ pub fn handle_input(
}
MenuAction::ModFlashlightPower => {
prefs.flashlight_power += 1;
if prefs.flashlight_power > 2 {
if prefs.flashlight_power > 3 {
prefs.flashlight_power = 0;
}
ew_game.send(GameEvent::UpdateFlashlight);

View file

@ -577,7 +577,7 @@ pub fn load_prefs() -> Preferences {
println!("Loaded preferences from internal defaults");
}
prefs.source_file = path;
prefs.flashlight_power = prefs.flashlight_power.clamp(0, 2);
prefs.flashlight_power = prefs.flashlight_power.clamp(0, 3);
prefs.light_amp = prefs.light_amp.clamp(0, 3);
prefs.thruster_boost = prefs.thruster_boost.clamp(0, 2);
prefs