🐛 Nisse stuck idle: keeps retrying unreachable trees in dense forest #22
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
Nisse repeatedly pick a chop/mine job, fail to pathfind, and loop every ~1.5 s. Work log fills up with identical "Walking to chop at (X, Y)" entries; the Nisse never actually works and stands idle in the stockpile.
Root cause
A* allows the goal tile to be impassable (the
isGoalbypass in pathfinding.ts line 50), but it still needs at least one passable neighbour of the goal tile to jump from. Trees deep inside a dense forest cluster have all 8 adjacent tiles set to FOREST (impassable) — A* can never reach the goal, returnsnullevery time. The Nisse then unclams the target and retries after 1.5 s, creating an infinite loop.Fix
pickJobnow filters out any chop/mine target wherehasAdjacentPassable()returns false — trees/rocks with no reachable neighbour are never added to the candidate list.idleScanTimeron pathfind failure increased 1 500 ms → 4 000 ms as an additional safety net for edge cases where the adjacent check passes but the full path still fails (e.g. isolated pocket unreachable from the Nisse's current position).