unlimited energy in god mode

This commit is contained in:
yuni 2024-10-03 05:59:50 +02:00
parent 5da66a5b15
commit 108efd0e55

View file

@ -287,48 +287,50 @@ pub fn update_power(
let mut power_down = false;
let d = time.delta_seconds();
for (mut battery, mut engine) in &mut q_battery {
if settings.flashlight_active {
battery.power -= POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] * d; // 2.4MW
if battery.power <= 0.0 {
power_down = true;
settings.flashlight_active = false;
for mut flashlight_vis in &mut q_flashlight {
*flashlight_vis = Visibility::Hidden;
if !settings.god_mode {
if settings.flashlight_active {
battery.power -= POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] * d; // 2.4MW
if battery.power <= 0.0 {
power_down = true;
settings.flashlight_active = false;
for mut flashlight_vis in &mut q_flashlight {
*flashlight_vis = Visibility::Hidden;
}
}
}
}
if settings.hud_active {
let mut hud_drain = POWER_DRAIN_AR;
hud_drain += POWER_DRAIN_LIGHTAMP[prefs.light_amp];
battery.power -= hud_drain * d;
if battery.power <= 0.0 {
power_down = true;
ew_game.send(GameEvent::SetAR(Turn::Off));
for mut flashlight_vis in &mut q_flashlight {
*flashlight_vis = Visibility::Hidden;
if settings.hud_active {
let mut hud_drain = POWER_DRAIN_AR;
hud_drain += POWER_DRAIN_LIGHTAMP[prefs.light_amp];
battery.power -= hud_drain * d;
if battery.power <= 0.0 {
power_down = true;
ew_game.send(GameEvent::SetAR(Turn::Off));
for mut flashlight_vis in &mut q_flashlight {
*flashlight_vis = Visibility::Hidden;
}
}
}
}
let drain = POWER_DRAIN_THRUSTER[prefs.thruster_boost];
let boosting = !battery.overloaded_recovering
&& prefs.thruster_boost != 2
&& (prefs.thruster_boost == 1 || engine.currently_matching_velocity);
if boosting {
if battery.power > drain * d * 100.0 {
engine.current_boost_factor = THRUSTER_BOOST_FACTOR[prefs.thruster_boost];
if engine.currently_firing {
battery.power -= drain * d;
let drain = POWER_DRAIN_THRUSTER[prefs.thruster_boost];
let boosting = !battery.overloaded_recovering
&& prefs.thruster_boost != 2
&& (prefs.thruster_boost == 1 || engine.currently_matching_velocity);
if boosting {
if battery.power > drain * d * 100.0 {
engine.current_boost_factor = THRUSTER_BOOST_FACTOR[prefs.thruster_boost];
if engine.currently_firing {
battery.power -= drain * d;
}
} else {
power_down = true;
battery.overloaded_recovering = true;
engine.current_boost_factor = 1.0;
}
} else {
power_down = true;
battery.overloaded_recovering = true;
engine.current_boost_factor = 1.0;
}
} else {
engine.current_boost_factor = 1.0;
}
if power_down {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::PowerDown));
if power_down {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::PowerDown));
}
}
let reactor = POWER_GAIN_REACTOR[settings.reactor_state];
battery.power = (battery.power + reactor * d).clamp(0.0, battery.capacity);