fix(engine): resolve StatsUpdate system-set scheduling cycle
CI / Test & Lint (push) Failing after 16s
CI / Release Build (push) Has been skipped

update_stats_on_new_game and handle_forfeit ran .before(GameMutation)
while being inside StatsUpdate.  win_summary_plugin constrains
cache_win_data.before(StatsUpdate), which forces the entire StatsUpdate
set to run after GameMutation — creating an unsolvable cycle that panicked
Bevy 0.18's schedule solver at startup.

Only update_stats_on_win (post-GameMutation) belongs in StatsUpdate.
The pre-GameMutation systems still run before GameMutation but outside
the set, so external .before(StatsUpdate)/.after(StatsUpdate) constraints
remain consistent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-04-29 04:05:26 +00:00
parent 7cda2a9f1a
commit efec6f22d5
+7 -5
View File
@@ -82,12 +82,14 @@ impl Plugin for StatsPlugin {
.add_message::<ForfeitEvent>() .add_message::<ForfeitEvent>()
.add_message::<InfoToastEvent>() .add_message::<InfoToastEvent>()
// record_abandoned must read `move_count` BEFORE handle_new_game // record_abandoned must read `move_count` BEFORE handle_new_game
// clobbers it with a fresh game. // clobbers it with a fresh game. These are NOT in StatsUpdate because
// StatsUpdate (as a set) is ordered after GameMutation by external
// constraints (win_summary_plugin: cache_win_data.before(StatsUpdate)),
// and a system cannot be both inside a set and individually before a
// set-level ordering constraint.
.add_systems( .add_systems(
Update, Update,
update_stats_on_new_game update_stats_on_new_game.before(GameMutation),
.before(GameMutation)
.in_set(StatsUpdate),
) )
.add_systems( .add_systems(
Update, Update,
@@ -95,7 +97,7 @@ impl Plugin for StatsPlugin {
) )
.add_systems( .add_systems(
Update, Update,
handle_forfeit.before(GameMutation).in_set(StatsUpdate), handle_forfeit.before(GameMutation),
) )
.add_systems(Update, toggle_stats_screen.after(GameMutation)); .add_systems(Update, toggle_stats_screen.after(GameMutation));
} }