fix(engine): Restore-prompt resolution suppresses Home auto-show
Resolving the Welcome-back / Restore prompt (either Continue or New game) cleared `PendingRestoredGame` and despawned the modal, but the launch-time Home auto-show then fired the next frame and stacked itself over the player's chosen path — clicking "New game" would deal a fresh game AND immediately pop the mode picker on top. `LaunchHomeShown` becomes pub so `handle_restore_prompt` can flip it to `true` after either resolution; `M` still re-opens the picker on demand. Headless tests already pre-set the flag to true via `HomePlugin::headless()`, so they're unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -586,6 +586,7 @@ fn handle_restore_prompt(
|
||||
mut game: ResMut<GameStateResource>,
|
||||
mut changed: MessageWriter<StateChangedEvent>,
|
||||
mut new_game: MessageWriter<NewGameRequestEvent>,
|
||||
mut launch_home_shown: Option<ResMut<crate::home_plugin::LaunchHomeShown>>,
|
||||
) {
|
||||
if screens.is_empty() {
|
||||
return;
|
||||
@@ -605,7 +606,7 @@ fn handle_restore_prompt(
|
||||
.any(|i| *i == Interaction::Pressed);
|
||||
let click_new = new_game_buttons.iter().any(|i| *i == Interaction::Pressed);
|
||||
|
||||
if key_continue || click_continue {
|
||||
let resolved = if key_continue || click_continue {
|
||||
if let Some(restored) = pending.0.take() {
|
||||
game.0 = restored;
|
||||
changed.write(StateChangedEvent);
|
||||
@@ -613,6 +614,7 @@ fn handle_restore_prompt(
|
||||
for entity in &screens {
|
||||
commands.entity(entity).despawn();
|
||||
}
|
||||
true
|
||||
} else if key_new || click_new {
|
||||
pending.0 = None;
|
||||
for entity in &screens {
|
||||
@@ -623,6 +625,19 @@ fn handle_restore_prompt(
|
||||
mode: None,
|
||||
confirmed: true,
|
||||
});
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
// The player has just made an explicit launch-time choice (continue
|
||||
// saved game, or start a fresh deal). Suppress the launch-time Home
|
||||
// auto-show so it doesn't pop on top of the resolution they picked.
|
||||
// `M` still re-opens the picker on demand.
|
||||
if resolved
|
||||
&& let Some(ref mut shown) = launch_home_shown
|
||||
{
|
||||
shown.0 = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user