infinite energy inside vehicles
This commit is contained in:
parent
d8b6a20867
commit
5597411bac
|
@ -281,13 +281,15 @@ pub fn update_power(
|
||||||
prefs: Res<Preferences>,
|
prefs: Res<Preferences>,
|
||||||
mut q_battery: Query<(&mut Battery, &mut Engine), With<Player>>,
|
mut q_battery: Query<(&mut Battery, &mut Engine), With<Player>>,
|
||||||
mut q_flashlight: Query<&mut Visibility, With<PlayersFlashLight>>,
|
mut q_flashlight: Query<&mut Visibility, With<PlayersFlashLight>>,
|
||||||
|
q_bike: Query<&PlayerDrivesThis>,
|
||||||
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
||||||
mut ew_game: EventWriter<game::GameEvent>,
|
mut ew_game: EventWriter<game::GameEvent>,
|
||||||
) {
|
) {
|
||||||
let mut power_down = false;
|
let mut power_down = false;
|
||||||
let d = time.delta_seconds();
|
let d = time.delta_seconds();
|
||||||
|
let inside_vehicle = !q_bike.is_empty();
|
||||||
for (mut battery, mut engine) in &mut q_battery {
|
for (mut battery, mut engine) in &mut q_battery {
|
||||||
if !settings.god_mode {
|
if !inside_vehicle && !settings.god_mode {
|
||||||
if settings.flashlight_active {
|
if settings.flashlight_active {
|
||||||
battery.power -= POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] * d; // 2.4MW
|
battery.power -= POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] * d; // 2.4MW
|
||||||
if battery.power <= 0.0 {
|
if battery.power <= 0.0 {
|
||||||
|
|
Loading…
Reference in a new issue