reset *some* settings on death

This commit is contained in:
yuni 2024-04-11 21:20:54 +02:00
parent 053f2827dd
commit ef0ada9dac
2 changed files with 11 additions and 1 deletions

View file

@ -424,12 +424,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_player_settings();
for entity in &q_noscenes {
cmd.entity(entity).despawn();
}

View file

@ -155,11 +155,20 @@ impl Default for Settings {
}
impl Settings {
#[allow(dead_code)]
pub fn reset(&mut self) {
println!("Resetting settings!");
*self = Self::default();
}
pub fn reset_player_settings(&mut self) {
println!("Resetting player settings!");
let default = Self::default();
self.rotation_stabilizer_active = default.rotation_stabilizer_active;
self.third_person = default.third_person;
self.is_zooming = default.is_zooming;
}
pub fn get_reply_keys(&self) -> [KeyCode; 10] {
return [
self.key_reply1,