fix thruster boost in god mode
This commit is contained in:
parent
d9306b57d6
commit
c7fb4eef3f
16
src/actor.rs
16
src/actor.rs
|
@ -339,7 +339,17 @@ pub fn update_power(
|
|||
let d = time.delta_seconds();
|
||||
let inside_vehicle = !q_bike.is_empty();
|
||||
for (mut battery, mut engine) in &mut q_battery {
|
||||
if !inside_vehicle && !settings.god_mode {
|
||||
if !inside_vehicle {
|
||||
let boosting = !battery.overloaded_recovering
|
||||
&& prefs.thruster_boost != 2
|
||||
&& (prefs.thruster_boost == 1 || engine.currently_matching_velocity);
|
||||
if settings.god_mode {
|
||||
if boosting {
|
||||
engine.current_boost_factor = THRUSTER_BOOST_FACTOR[prefs.thruster_boost];
|
||||
} else {
|
||||
engine.current_boost_factor = 1.0;
|
||||
}
|
||||
} else {
|
||||
if settings.flashlight_active {
|
||||
battery.power -= POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] * d; // 2.4MW
|
||||
if battery.power <= 0.0 {
|
||||
|
@ -363,9 +373,6 @@ pub fn update_power(
|
|||
}
|
||||
}
|
||||
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];
|
||||
|
@ -384,6 +391,7 @@ pub fn update_power(
|
|||
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);
|
||||
if battery.overloaded_recovering && battery.power > battery.capacity * 0.5 {
|
||||
|
|
Loading…
Reference in a new issue