@@ 34,12 34,18 @@ fn spawn_supply_piles(
mut commands: Commands,
game_data: Res<GameData>,
mut psp_ev_w: EventWriter<PositionSupplyPilesEvent>,
+ mut pile_query: Query<Entity, With<visual_card_kind::Supply>>,
) {
let Some(status) = &game_data.game_status else {
warn!("game_status was none");
return;
};
+ // despawn possible existing supply piles
+ for entity in pile_query.iter() {
+ commands.entity(entity).despawn_recursive();
+ }
+
for (index, pile) in status.supply_piles.iter().enumerate() {
commands
.spawn(VisualCardBundle {