infinite energy inside vehicles

This commit is contained in:
yuni 2024-10-03 06:26:06 +02:00
parent d8b6a20867
commit 5597411bac

View file

@ -281,13 +281,15 @@ pub fn update_power(
prefs: Res<Preferences>,
mut q_battery: Query<(&mut Battery, &mut Engine), With<Player>>,
mut q_flashlight: Query<&mut Visibility, With<PlayersFlashLight>>,
q_bike: Query<&PlayerDrivesThis>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_game: EventWriter<game::GameEvent>,
) {
let mut power_down = false;
let d = time.delta_seconds();
let inside_vehicle = !q_bike.is_empty();
for (mut battery, mut engine) in &mut q_battery {
if !settings.god_mode {
if !inside_vehicle && !settings.god_mode {
if settings.flashlight_active {
battery.power -= POWER_DRAIN_FLASHLIGHT[prefs.flashlight_power] * d; // 2.4MW
if battery.power <= 0.0 {