From 86734fdc72ff86181a927e989e66ddbe9903fdfb Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 13 May 2024 21:49:30 +0200 Subject: [PATCH] fix menu not getting updated after toggling settings --- src/game.rs | 2 +- src/menu.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game.rs b/src/game.rs index 23ac10d..de4f2a2 100644 --- a/src/game.rs +++ b/src/game.rs @@ -64,7 +64,7 @@ impl Turn { } } -fn handle_game_event( +pub fn handle_game_event( mut settings: ResMut, mut er_game: EventReader, mut ew_sfx: EventWriter, diff --git a/src/menu.rs b/src/menu.rs index 8ee95bd..12b0e3b 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -22,10 +22,12 @@ impl Plugin for MenuPlugin { app.add_systems(Startup, setup.after(hud::setup)); app.add_systems(PreUpdate, show_deathscreen.run_if(on_event::())); app.add_systems(Update, handle_deathscreen_input); - app.add_systems(PreUpdate, update_menu.run_if(on_event::())); + app.add_systems(PreUpdate, update_menu + .after(game::handle_game_event) + .run_if(on_event::())); app.add_systems(Update, handle_input.run_if(alive)); app.insert_resource(DeathScreenInputDelayTimer( - Timer::from_seconds(1.0, TimerMode::Once))); + Timer::from_seconds(1.0, TimerMode::Once))); app.insert_resource(MenuState::default()); app.add_event::(); app.add_event::();