From e60d0572767d15ee580e4675899c77938b81dc03 Mon Sep 17 00:00:00 2001 From: popertots Date: Sat, 21 Mar 2026 01:45:36 +0000 Subject: [PATCH] fix: move collision_delay after step_recovery to prevent deadlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit collision_delay was placed before the walk_speed/step_recovery block, causing step_recovery to never tick when collision_delay was active — entities stayed permanently pre-empted at path_index=0. Correct order: step_recovery (must tick every frame) before collision_delay (only checked when entity is ready to move). --- src/entities/shared_systems/pathfinding.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/entities/shared_systems/pathfinding.rs b/src/entities/shared_systems/pathfinding.rs index c71fc22..f62fe46 100644 --- a/src/entities/shared_systems/pathfinding.rs +++ b/src/entities/shared_systems/pathfinding.rs @@ -592,15 +592,15 @@ pub fn movement( } } + if ambulatory.collision_delay > 0 { + ambulatory.collision_delay -= 1; + return; + } + if let Some(path) = &ambulatory.current_path { if ambulatory.path_index < path.len() { let next_point = path[ambulatory.path_index]; - if ambulatory.collision_delay > 0 { - ambulatory.collision_delay -= 1; - return; - } - let current_crowded = occupancy.count_at(transform.translation) > 2; let occupied = !current_crowded && occupancy.count_at(next_point) > 0; if occupied {