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
This commit is contained in:
2026-04-06 00:23:09 +01:00
parent 9eecd3e49d
commit 1d78c211ad
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -301,6 +301,7 @@ pub fn job_pathfinding_system(
*state = TaskState::Pending; *state = TaskState::Pending;
ambulatory.current_path = None; ambulatory.current_path = None;
ambulatory.path_index = 0; ambulatory.path_index = 0;
ambulatory.target = None; // Clear old target from previous task
info!( info!(
"[PATHFIND] SUCCESS: Assigned job {:?} to dorf {:?} with approach {:?}", "[PATHFIND] SUCCESS: Assigned job {:?} to dorf {:?} with approach {:?}",
+5
View File
@@ -309,6 +309,11 @@ impl TileMap {
/// O(1) standability check using bit-packed chunk data. /// O(1) standability check using bit-packed chunk data.
/// Returns false if chunk is not loaded (unloaded chunks have no valid tiles). /// Returns false if chunk is not loaded (unloaded chunks have no valid tiles).
pub fn is_standable(&self, world_pos: IVec3) -> bool { 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 chunk_pos = world_to_chunk(world_pos);
let Some(chunk) = self.chunks.get(&chunk_pos) else { let Some(chunk) = self.chunks.get(&chunk_pos) else {
return false; return false;