Do not panic on failed setting of GameOver state in AlienCakeAddict (#3411)

# Objective

- Tentatively fixes #2525.

## Solution

- The panic seems to occur when the game-over state occurs nearly instantly.
- Discard the `Result`, rather than panicking. We could probably handle this better, but I want to see if this works first. Ping @qarmin.
This commit is contained in:
Alice Cecile 2021-12-22 00:49:15 +00:00
parent 004bbe9f04
commit b5d7ff2d75

View file

@ -308,7 +308,8 @@ fn spawn_bonus(
commands.entity(entity).despawn_recursive();
game.bonus.entity = None;
if game.score <= -5 {
state.set(GameState::GameOver).unwrap();
// We don't particularly care if this operation fails
let _ = state.overwrite_set(GameState::GameOver);
return;
}
}