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:
@@ -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 {:?}",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user