fix: remove collision_delay to eliminate movement deadlock

collision_delay was causing entities to skip step_recovery ticks, freezing
movement whenever the next tile was occupied. Combined with the ordering fix
(collision_delay placed before step_recovery), entities were stuck at
path_index=0 indefinitely in spawn clusters.

Remove collision_delay entirely — step_recovery already provides the
per-tick pacing, and the natural next-tick retry (via left-step or
normal movement) handles occupied tiles without an artificial delay.

Actual thresholds (grass weight=50): dorfs move after 6 ticks, pigs after
26 ticks, rabbits after 2 ticks. Without collision_delay interference,
movement is now governed purely by step_recovery.
This commit is contained in:
2026-03-21 10:21:44 +00:00
parent e60d057276
commit dd703f05f3
5 changed files with 11 additions and 24 deletions
-1
View File
@@ -30,7 +30,6 @@ impl Pig {
path_index: 0, path_index: 0,
step_recovery: 0, step_recovery: 0,
validation_cooldown: 0, validation_cooldown: 0,
collision_delay: 0,
}, },
sprite: Sprite { sprite: Sprite {
image: asset_server.load("pig.png"), image: asset_server.load("pig.png"),
-1
View File
@@ -27,7 +27,6 @@ impl Rabbit {
path_index: 0, path_index: 0,
step_recovery: 0, step_recovery: 0,
validation_cooldown: 0, validation_cooldown: 0,
collision_delay: 0,
}, },
sprite: Sprite { sprite: Sprite {
image: asset_server.load("rabbit.png"), image: asset_server.load("rabbit.png"),
-1
View File
@@ -27,7 +27,6 @@ impl Dorf {
path_index: 0, path_index: 0,
step_recovery: 0, step_recovery: 0,
validation_cooldown: 0, validation_cooldown: 0,
collision_delay: 0,
}, },
sprite: Sprite { sprite: Sprite {
image: asset_server.load("dorf.png"), image: asset_server.load("dorf.png"),
@@ -10,7 +10,6 @@ pub struct Ambulatory {
pub target: Option<Vec3>, pub target: Option<Vec3>,
pub step_recovery: u32, pub step_recovery: u32,
pub validation_cooldown: u8, pub validation_cooldown: u8,
pub collision_delay: u8,
} }
impl Default for Ambulatory { impl Default for Ambulatory {
@@ -23,7 +22,6 @@ impl Default for Ambulatory {
target: None, target: None,
step_recovery: 0, step_recovery: 0,
validation_cooldown: 0, validation_cooldown: 0,
collision_delay: 0,
} }
} }
} }
+2 -10
View File
@@ -592,11 +592,6 @@ 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];
@@ -624,13 +619,9 @@ pub fn movement(
transform.scale.x = -PIXEL_RATIO; transform.scale.x = -PIXEL_RATIO;
} }
transform.translation = left_point; transform.translation = left_point;
return;
} }
} }
ambulatory.collision_delay = 1; } else {
return;
}
let direction = (next_point - transform.translation).normalize(); let direction = (next_point - transform.translation).normalize();
transform.translation = next_point; transform.translation = next_point;
@@ -643,6 +634,7 @@ pub fn movement(
if transform.translation.distance(next_point) < TILE_SIZE { if transform.translation.distance(next_point) < TILE_SIZE {
ambulatory.path_index += 1; ambulatory.path_index += 1;
} }
}
} else { } else {
ambulatory.current_path = None; ambulatory.current_path = None;
if let Some(target) = ambulatory.target { if let Some(target) = ambulatory.target {