Bring collision monitoring in line with visibility blocking.
This commit is contained in:
parent
e28f21c351
commit
6eabdf52ab
|
@ -372,17 +372,17 @@ fn remove_monitors_collisions(
|
|||
) {
|
||||
for entity in removed.iter() {
|
||||
for (map, mut collisions_monitored) in map.iter_mut() {
|
||||
let prev = prev_index.get(&entity).cloned();
|
||||
prev_index.remove(&entity);
|
||||
if let Some(prev) = prev {
|
||||
set_monitors_collisions(
|
||||
&map,
|
||||
prev,
|
||||
&monitors_collisions,
|
||||
&mut collisions_monitored,
|
||||
);
|
||||
}
|
||||
if let Ok(coordinates) = coordinates.get_component::<Coordinates>(entity) {
|
||||
let prev = prev_index.get(&entity).cloned();
|
||||
prev_index.remove(&entity);
|
||||
if let Some(prev) = prev {
|
||||
set_monitors_collisions(
|
||||
&map,
|
||||
prev,
|
||||
&monitors_collisions,
|
||||
&mut collisions_monitored,
|
||||
);
|
||||
}
|
||||
let idx = coordinates.to_index(map.width());
|
||||
set_monitors_collisions(&map, idx, &monitors_collisions, &mut collisions_monitored);
|
||||
}
|
||||
|
|
|
@ -143,20 +143,14 @@ fn remove_blocks_visibility(
|
|||
) {
|
||||
for entity in removed.iter() {
|
||||
for (map, mut visibility_blocked) in map.iter_mut() {
|
||||
let prev = prev_index.get(&entity).cloned();
|
||||
if let Some(prev) = prev {
|
||||
prev_index.remove(&entity);
|
||||
set_visibility_blocked(&map, prev, &blocks_visibility, &mut visibility_blocked);
|
||||
}
|
||||
if let Ok(coordinates) = coordinates.get_component::<Coordinates>(entity) {
|
||||
let prev = prev_index.get(&entity).cloned();
|
||||
if let Some(prev) = prev {
|
||||
prev_index.remove(&entity);
|
||||
set_visibility_blocked(
|
||||
&map,
|
||||
prev,
|
||||
&blocks_visibility,
|
||||
&mut visibility_blocked,
|
||||
);
|
||||
};
|
||||
let idx = coordinates.to_index(map.width());
|
||||
set_visibility_blocked(&map, idx, &blocks_visibility, &mut visibility_blocked);
|
||||
prev_index.insert(entity, idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user