Cards stuck at scatter positions when new game is started during win cascade #7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
If the player starts a new game while the win-cascade
CardAnimationis still running, the newly dealt cards can end up frozen at the cascade's off-screen scatter endpoints instead of their dealt positions.Affected files
solitaire_engine/src/card_plugin.rs—sync_cards/update_card_entitysolitaire_engine/src/animation_plugin.rs—handle_win_cascadeRoot Cause
sync_cardschecks for the curve-basedCardAnimationcomponent (used by drag-rejection returns and the win cascade). When present,has_card_animation = trueandupdate_card_entityskips the transform /CardAniminsertion path entirely to avoid fighting the curve animation.If a new game starts while the cascade
CardAnimationis still on the card entities:sync_cardsfires with the new game state.CardAnimation,update_card_entityskips applying the new position.CardAnimation, snapping the card to its scatter endpoint (anim.end) — not the dealt position.StateChangedEventfires, sosync_cardsnever re-runs to correct the positions.The result is a frozen, visually broken board at the start of the new game.
Suggested Fix
When a new-game event is detected (or when
sync_cardsruns after a game reset), forcibly remove any in-flightCardAnimationcomponents before processing positions. This allowsupdate_card_entityto apply dealt positions immediately without racing the cascade.Alternatively, have
handle_win_cascadelisten for a new-game event and cancel all its spawnedCardAnimationcomponents early.