Skip to content

Commit

Permalink
de_pathing: Use Has<> in a query (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 authored Jul 25, 2023
1 parent 5f33e03 commit dca41f4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/pathing/src/pplugin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use ahash::AHashMap;
use bevy::{
ecs::query::Has,
prelude::*,
tasks::{AsyncComputeTaskPool, Task},
};
Expand Down Expand Up @@ -169,11 +170,11 @@ fn cleanup(mut commands: Commands) {
fn update_existing_paths(
finder: Res<FinderRes>,
mut state: ResMut<UpdatePathsState>,
entities: Query<(Entity, &Transform, &PathTarget, Option<&ScheduledPath>)>,
entities: Query<(Entity, &Transform, &PathTarget, Has<ScheduledPath>)>,
) {
for (entity, transform, target, path) in entities.iter() {
for (entity, transform, target, has_path) in entities.iter() {
let position = transform.translation.to_flat();
if path.is_none() && !state.contains(entity) {
if !has_path && !state.contains(entity) {
let current_distance = position.distance(target.location());
let desired_distance = target.properties().distance();
if (current_distance - desired_distance).abs() <= TARGET_TOLERANCE {
Expand Down

0 comments on commit dca41f4

Please sign in to comment.