This commit is contained in:
2026-03-22 01:52:20 +00:00
parent 9afcb0f612
commit adc236dc3d
4 changed files with 8 additions and 12 deletions
@@ -313,10 +313,15 @@ pub fn prepare_paths(
tilemap: Res<TileMap>,
chunk_map: Res<ChunkMap>,
) {
let mut paths_needed = 0;
let mut paths_computed = 0;
for (entity, mut ambulatory, transform) in query.iter_mut() {
if ambulatory.current_path.is_some() || ambulatory.target.is_none() {
continue;
}
paths_needed += 1;
let Some(target) = ambulatory.target else {
continue;
};
@@ -332,6 +337,7 @@ pub fn prepare_paths(
let path = calculate_path_benchmarked(&tilemap, start, goal);
ambulatory.current_path = Some(path);
ambulatory.path_index = 0;
paths_computed += 1;
} else if chunk_distance > PATHFINDER_HIERARCHICAL_THRESHOLD_CHUNKS {
let chunk_path = calculate_chunk_path(&chunk_map, start_chunk, goal_chunk);
let provisional_goal = goal;