fix: correct inverted logic in prepare_paths - entities without paths were being skipped

The condition 'if ambulatory.current_path.is_none() || pending_async.is_some()' was backwards.
It should skip entities that ALREADY have a path, not entities WITHOUT a path.

Fixed to properly skip entities with existing paths or pending async tasks.
This commit is contained in:
2026-03-18 16:47:51 +00:00
parent c902cff908
commit d2ec1fb5dc
2 changed files with 42 additions and 17726 deletions
File diff suppressed because it is too large Load Diff
+10 -3
View File
@@ -176,10 +176,18 @@ pub fn prepare_paths(
tilemap: Res<TileMap>,
) {
for (entity, mut ambulatory, transform, pending_async) in query.iter_mut() {
if let Some(target) = ambulatory.target {
if ambulatory.current_path.is_none() || pending_async.is_some() {
if ambulatory.current_path.is_some() {
continue;
}
if pending_async.is_some() {
continue;
}
if ambulatory.target.is_none() {
continue;
}
let Some(target) = ambulatory.target else {
continue;
};
let start = transform.translation.as_ivec3();
let goal = target.as_ivec3() - ivec3(0, 0, ITILE_SIZE);
let distance = octile_distance_3d(start, goal) / ITILE_SIZE;
@@ -216,7 +224,6 @@ pub fn prepare_paths(
}
}
}
}
}
pub fn splice_completed_async_paths(