From 053f2827dd534880a2ae307a91e170c5ce6d94a6 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 11 Apr 2024 21:17:34 +0200 Subject: [PATCH] handle god mode properly when restarting/cheat-dying --- src/actor.rs | 3 ++- src/main.rs | 5 +---- src/world.rs | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 9e35787..aaf71d4 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -234,7 +234,7 @@ pub fn update_physics_lifeforms( pub fn handle_input( mut commands: Commands, keyboard_input: Res>, - settings: ResMut, + mut settings: ResMut, q_talker: Query<(&chat::Talker, &Transform), (Without, Without)>, player: Query>, q_camera: Query<&Transform, With>, @@ -296,6 +296,7 @@ pub fn handle_input( } } else if keyboard_input.just_pressed(settings.key_restart) { + settings.god_mode = false; ew_playerdies.send(PlayerDiesEvent(DamageType::Mental)); } } diff --git a/src/main.rs b/src/main.rs index b4b80a2..c497348 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,7 +77,7 @@ fn setup( fn handle_input( keyboard_input: Res>, - mut settings: ResMut, + settings: Res, mut app_exit_events: ResMut>, mut windows: Query<&mut Window, With>, ) { @@ -93,7 +93,4 @@ fn handle_input( } } } - if keyboard_input.just_pressed(settings.key_restart) { - settings.reset(); - } } diff --git a/src/world.rs b/src/world.rs index 86ecfdc..334cfda 100644 --- a/src/world.rs +++ b/src/world.rs @@ -446,6 +446,7 @@ fn handle_cheats( lifeform.adrenaline = 1.0; } if key_input.just_pressed(settings.key_cheat_die) { + settings.god_mode = false; ew_playerdies.send(actor::PlayerDiesEvent(actor::DamageType::Trauma)); } }