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