From 5104f2bbcf1b95224c65a9123674a479bc45bd3a Mon Sep 17 00:00:00 2001 From: yuni Date: Sun, 22 Sep 2024 06:39:21 +0200 Subject: [PATCH] add extra-bright flash light mode --- src/actor.rs | 4 ++-- src/menu.rs | 8 +++----- src/var.rs | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 832615b..a7bcc44 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -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]; diff --git a/src/menu.rs b/src/menu.rs index db15f83..26abeb8 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -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); diff --git a/src/var.rs b/src/var.rs index 0838281..4f84228 100644 --- a/src/var.rs +++ b/src/var.rs @@ -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