reset settings on death/restart

This commit is contained in:
yuni 2024-04-11 21:06:35 +02:00
parent d0df5c5dbd
commit 3676fd444c
2 changed files with 3 additions and 5 deletions

View file

@ -423,12 +423,13 @@ fn handle_player_death(
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<effects::SpawnEffectEvent>,
mut log: ResMut<hud::Log>,
settings: Res<settings::Settings>,
mut settings: ResMut<settings::Settings>,
) {
for death in er_playerdies.read() {
if settings.god_mode {
return;
}
settings.reset();
for entity in &q_noscenes {
cmd.entity(entity).despawn();
}

View file

@ -77,7 +77,7 @@ fn setup(
fn handle_input(
keyboard_input: Res<ButtonInput<KeyCode>>,
mut settings: ResMut<settings::Settings>,
settings: Res<settings::Settings>,
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
mut windows: Query<&mut Window, With<PrimaryWindow>>,
) {
@ -93,7 +93,4 @@ fn handle_input(
}
}
}
if keyboard_input.just_pressed(settings.key_restart) {
settings.reset();
}
}