Theoretically restore old cache hit.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
38564fbebe
commit
43137cfb36
|
@ -280,7 +280,13 @@ fn update_viewshed<D: 'static + Clone + Default + Send + Sync>(
|
||||||
)>,
|
)>,
|
||||||
>,
|
>,
|
||||||
visible: Query<&Visible>,
|
visible: Query<&Visible>,
|
||||||
mut viewers: Query<(Entity, &mut Viewshed, &mut VisibleEntities, &Coordinates)>,
|
mut viewers: Query<(
|
||||||
|
Entity,
|
||||||
|
&mut Viewshed,
|
||||||
|
&mut VisibleEntities,
|
||||||
|
&Coordinates,
|
||||||
|
Option<&LastCoordinates>,
|
||||||
|
)>,
|
||||||
map: Query<&Map<D>>,
|
map: Query<&Map<D>>,
|
||||||
query_pipeline: Res<QueryPipeline>,
|
query_pipeline: Res<QueryPipeline>,
|
||||||
collider_query: QueryPipelineColliderComponentsQuery,
|
collider_query: QueryPipelineColliderComponentsQuery,
|
||||||
|
@ -322,7 +328,23 @@ fn update_viewshed<D: 'static + Clone + Default + Send + Sync>(
|
||||||
if visible.get(entity).is_err() {
|
if visible.get(entity).is_err() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (viewer_entity, viewshed, visible_entities, viewer_coordinates) in viewers.iter_mut() {
|
for (
|
||||||
|
viewer_entity,
|
||||||
|
viewshed,
|
||||||
|
visible_entities,
|
||||||
|
viewer_coordinates,
|
||||||
|
viewer_last_coordinates,
|
||||||
|
) in viewers.iter_mut()
|
||||||
|
{
|
||||||
|
if let (Some(last_coordinates), Some(viewer_last_coordinates)) =
|
||||||
|
(last_coordinates, viewer_last_coordinates)
|
||||||
|
{
|
||||||
|
if viewer_coordinates.i32() == **viewer_last_coordinates
|
||||||
|
&& coordinates.i32() == **last_coordinates
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if viewer_entity != entity
|
if viewer_entity != entity
|
||||||
&& (viewer_coordinates.distance(&coordinates) <= viewshed.range as f32
|
&& (viewer_coordinates.distance(&coordinates) <= viewshed.range as f32
|
||||||
|| visible_entities.contains(&entity))
|
|| visible_entities.contains(&entity))
|
||||||
|
@ -333,7 +355,7 @@ fn update_viewshed<D: 'static + Clone + Default + Send + Sync>(
|
||||||
}
|
}
|
||||||
let mut cache = HashMap::new();
|
let mut cache = HashMap::new();
|
||||||
for entity in to_update.iter() {
|
for entity in to_update.iter() {
|
||||||
if let Ok((viewer_entity, mut viewshed, mut visible_entities, viewer_coordinates)) =
|
if let Ok((viewer_entity, mut viewshed, mut visible_entities, viewer_coordinates, _)) =
|
||||||
viewers.get_mut(*entity)
|
viewers.get_mut(*entity)
|
||||||
{
|
{
|
||||||
if let Ok(map) = map.get_single() {
|
if let Ok(map) = map.get_single() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user