From 3676fd444c15ed0f3379b3ca28392f6a671ff78e Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 11 Apr 2024 21:06:35 +0200 Subject: [PATCH] reset settings on death/restart --- src/actor.rs | 3 ++- src/main.rs | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 9e35787..886865d 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -423,12 +423,13 @@ fn handle_player_death( mut ew_sfx: EventWriter, mut ew_effect: EventWriter, mut log: ResMut, - settings: Res, + mut settings: ResMut, ) { for death in er_playerdies.read() { if settings.god_mode { return; } + settings.reset(); for entity in &q_noscenes { cmd.entity(entity).despawn(); } 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(); - } }