Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JackCrumpLeys committed Sep 4, 2023
1 parent 1377440 commit 9651515
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/energy/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ fn remove_old_nodes(
mut death_events: EventReader<DespawnedComponentsEvent<NearbyUnits>>,
) {
for event in death_events.iter() {
power_grid.graph.remove_node(event.entity);

for neighbor in power_grid.graph.neighbors(event.entity) {
if let Ok(mut nearby_units) = nearby_units_query.get_mut(neighbor) {
nearby_units.remove_matching(event.entity.into());
}
}

power_grid.graph.remove_node(event.entity);
}
}

Expand Down

0 comments on commit 9651515

Please sign in to comment.