From 79223740b3529a10c2270bdccbd0af738f6eba3b Mon Sep 17 00:00:00 2001 From: shekohex Date: Sun, 24 Nov 2024 22:46:47 +0200 Subject: [PATCH] fix: Hot Reloading Issue --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 51cc900..638bcd6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -199,7 +199,7 @@ fn handle_map_events( mut commands: Commands, mut map_events: EventReader>, tile_storage_query: Query<(Entity, &TileStorage)>, - mut map_query: Query<(Entity, &Handle, &mut TiledIdStorage)>, + mut map_query: Query<(Entity, &TiledMapHandle, &mut TiledIdStorage)>, layer_query: Query<(Entity, &TiledMapLayer), With>, ) { for event in map_events.read() { @@ -207,7 +207,7 @@ fn handle_map_events( AssetEvent::Modified { id } => { log::info!("Map changed: {id}"); for (map_entity, map_handle, _) in map_query.iter() { - if map_handle.id() == *id { + if map_handle.0.id() == *id { commands.entity(map_entity).insert(RespawnTiledMap); } } @@ -230,16 +230,16 @@ fn handle_map_events( fn remove_map_by_asset_id( commands: &mut Commands, tile_storage_query: &Query<(Entity, &TileStorage)>, - map_query: &mut Query<(Entity, &Handle, &mut TiledIdStorage)>, + map_query: &mut Query<(Entity, &TiledMapHandle, &mut TiledIdStorage)>, layer_query: &Query<(Entity, &TiledMapLayer), With>, asset_id: &AssetId, ) { log::info!("removing map by asset id: {}", asset_id); for (_, map_handle, mut tiled_id_storage) in map_query.iter_mut() { - log::info!("checking layer to remove: {}", map_handle.id()); + log::info!("checking layer to remove: {}", map_handle.0.id()); // Only process the map that was removed. - if map_handle.id() != *asset_id { + if map_handle.0.id() != *asset_id { continue; }