From 1d78c211adb60a3aa2b4edd1c26280a7865467b4 Mon Sep 17 00:00:00 2001 From: popertots Date: Mon, 6 Apr 2026 00:23:09 +0100 Subject: [PATCH] fix: cargo standability and clear old task target - Make is_standable return true for cargo tiles (logs, rocks can be stood on) - Clear ambulatory.target when assigning new task to prevent old targets persisting These fixes address the 'Lost Signal' bug where dorfs would freeze: 1. Cargo tiles were incorrectly flagged as non-standable, blocking pathfinding 2. Old Idle task targets persisted when new jobs assigned, causing dorfs to path to wrong locations --- src/entities/tasks/job_pathfinding.rs | 1 + src/world/tiles/tilemap.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/entities/tasks/job_pathfinding.rs b/src/entities/tasks/job_pathfinding.rs index 1d1595a..33d9718 100644 --- a/src/entities/tasks/job_pathfinding.rs +++ b/src/entities/tasks/job_pathfinding.rs @@ -301,6 +301,7 @@ pub fn job_pathfinding_system( *state = TaskState::Pending; ambulatory.current_path = None; ambulatory.path_index = 0; + ambulatory.target = None; // Clear old target from previous task info!( "[PATHFIND] SUCCESS: Assigned job {:?} to dorf {:?} with approach {:?}", diff --git a/src/world/tiles/tilemap.rs b/src/world/tiles/tilemap.rs index a2fe3c3..ade0a84 100644 --- a/src/world/tiles/tilemap.rs +++ b/src/world/tiles/tilemap.rs @@ -309,6 +309,11 @@ impl TileMap { /// O(1) standability check using bit-packed chunk data. /// Returns false if chunk is not loaded (unloaded chunks have no valid tiles). pub fn is_standable(&self, world_pos: IVec3) -> bool { + // Cargo tiles override chunk standability - dorfs can stand on cargo to pick it up. + if self.cargo_tiles.contains_key(&world_pos) { + return true; + } + let chunk_pos = world_to_chunk(world_pos); let Some(chunk) = self.chunks.get(&chunk_pos) else { return false;