From f0cb86e73c4fcc1d043c9866bd60be9d39e0855f Mon Sep 17 00:00:00 2001 From: popertots Date: Sat, 21 Mar 2026 10:35:35 +0000 Subject: [PATCH] fix: compare next vs current occupancy counts instead of absolute threshold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two entities on the same tile (16,-0.0) each saw count=2 and blocked each other with occupied=true since 2>1. The collision check was treating the entity's own presence as a blocker. Now: only trigger avoidance when next_tile has strictly more entities than current_tile. Handles path[0]=current_pos (count equal → move), two entities passing through same tile (counts stay equal → move), and genuinely crowded destinations (next has more → dodge). Also raise crowded threshold to 4+. --- src/entities/shared_systems/pathfinding.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/entities/shared_systems/pathfinding.rs b/src/entities/shared_systems/pathfinding.rs index d94ff09..ee32237 100644 --- a/src/entities/shared_systems/pathfinding.rs +++ b/src/entities/shared_systems/pathfinding.rs @@ -596,8 +596,10 @@ pub fn movement( if ambulatory.path_index < path.len() { let next_point = path[ambulatory.path_index]; - let current_crowded = occupancy.count_at(transform.translation) > 2; - let occupied = !current_crowded && occupancy.count_at(next_point) > 1; + let current_count = occupancy.count_at(transform.translation); + let next_count = occupancy.count_at(next_point); + let current_crowded = current_count > 3; + let occupied = !current_crowded && next_count > current_count; if occupied { let move_dir = next_point - transform.translation; if move_dir.length_squared() > 0.0 {