From 0bac8c541c72f5249c72284c0157157bca04e0ad Mon Sep 17 00:00:00 2001 From: skye Date: Wed, 10 May 2023 13:05:37 +0300 Subject: [PATCH] fix(client): despawn supply piles before spawning --- client/src/plugins/game/supply/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/plugins/game/supply/mod.rs b/client/src/plugins/game/supply/mod.rs index 20ab8f7..8c68bf3 100644 --- a/client/src/plugins/game/supply/mod.rs +++ b/client/src/plugins/game/supply/mod.rs @@ -34,12 +34,18 @@ fn spawn_supply_piles( mut commands: Commands, game_data: Res, mut psp_ev_w: EventWriter, + mut pile_query: Query>, ) { 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 { -- 2.44.1