Skip to content

Instantly share code, notes, and snippets.

@BoxyUwU
Created June 19, 2020 07:30
Show Gist options
  • Save BoxyUwU/2acae16fc8d555d1f8fdd33daca76fa0 to your computer and use it in GitHub Desktop.
Save BoxyUwU/2acae16fc8d555d1f8fdd33daca76fa0 to your computer and use it in GitHub Desktop.
pub fn delete_entites(mut all_storages: AllStoragesViewMut) {
let mut to_kill = vec![];
all_storages.run(|healths: View<Health>,| {
for (id, (health)) in (&healths).iter().with_id() {
if health.0 < 0 {
to_kill.push(id);
}
}
});
for id in to_kill.into_iter() {
all_storages.delete(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment