Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter RemovedComponents for entities that no longer exist #510

Merged
merged 5 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/render/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,27 +377,27 @@ pub fn extract(

pub fn extract_removal(
mut commands: Commands,
removed_tiles_query: Extract<Query<&RemovedTileEntity>>,
removed_maps_query: Extract<Query<&RemovedMapEntity>>,
removed_tiles_query: Extract<Query<(Entity, &RemovedTileEntity)>>,
removed_maps_query: Extract<Query<(Entity, &RemovedMapEntity)>>,
) {
let mut removed_tiles: Vec<(Entity, ExtractedRemovedTileBundle)> = Vec::new();
for entity in removed_tiles_query.iter() {
for (entity, removed) in removed_tiles_query.iter() {
removed_tiles.push((
entity.0,
entity,
ExtractedRemovedTileBundle {
tile: ExtractedRemovedTile { entity: entity.0 },
tile: ExtractedRemovedTile { entity: removed.0 },
},
));
}

commands.insert_or_spawn_batch(removed_tiles);

let mut removed_maps: Vec<(Entity, ExtractedRemovedMapBundle)> = Vec::new();
for entity in removed_maps_query.iter() {
for (entity, removed) in removed_maps_query.iter() {
removed_maps.push((
entity.0,
entity,
ExtractedRemovedMapBundle {
map: ExtractedRemovedMap { entity: entity.0 },
map: ExtractedRemovedMap { entity: removed.0 },
},
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Plugin for TilemapRenderingPlugin {
app.add_systems(Update, set_texture_to_copy_src);

app.add_systems(First, clear_removed);
app.add_systems(PostUpdate, (removal_helper_tilemap, removal_helper));
app.add_systems(PostUpdate, (removal_helper, removal_helper_tilemap));

app.add_plugins(MaterialTilemapPlugin::<StandardTilemapMaterial>::default());

Expand Down
2 changes: 1 addition & 1 deletion src/render/texture_array_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl TextureArrayCache {
"Expected image to have finished loading if \
it is being extracted as a texture!",
);
let this_tile_size: TilemapTileSize = image.size_f32().try_into().unwrap();
let this_tile_size: TilemapTileSize = image.size_f32().into();
if this_tile_size != tile_size {
panic!(
"Expected all provided image assets to have size {tile_size:?}, \
Expand Down
Loading