fix: move collision_delay after step_recovery to prevent deadlock
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).
This commit is contained in:
@@ -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 let Some(path) = &ambulatory.current_path {
|
||||||
if ambulatory.path_index < path.len() {
|
if ambulatory.path_index < path.len() {
|
||||||
let next_point = path[ambulatory.path_index];
|
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 current_crowded = occupancy.count_at(transform.translation) > 2;
|
||||||
let occupied = !current_crowded && occupancy.count_at(next_point) > 0;
|
let occupied = !current_crowded && occupancy.count_at(next_point) > 0;
|
||||||
if occupied {
|
if occupied {
|
||||||
|
|||||||
Reference in New Issue
Block a user