ConstructionProvider: skip unreachable build sites
Player reported pawns ignoring chop designations. Root cause was a lingering door designation at (36, 27) — painted on the test shed wall, which is pre-built and impassable. ConstructionProvider (priority 6) kept offering the doomed job; Decision picked it over chop (priority 5); JobRunner cancelled the empty walk each tick. Busy-spin starved all elective work. Mirrors the reachability pattern from HaulingProvider / DoctorProvider / EatProvider. For pathing-blocking sites (walls) we probe from an adjacent walkable cell; for other sites (doors / beds / crates / torches) we probe the site tile directly. Unreachable sites are skipped silently so the queue can sit dormant without starving lower-priority work. Verified via MCP: with a deliberately-unreachable door designation in the queue, all three pawns successfully picked up chop jobs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a4163ba222
commit
69a1c0de44
1 changed files with 13 additions and 0 deletions
|
|
@ -48,6 +48,19 @@ func find_best_for(pawn) -> Job:
|
||||||
continue
|
continue
|
||||||
if Job.is_target_taken_by_other(site, pawn):
|
if Job.is_target_taken_by_other(site, pawn):
|
||||||
continue
|
continue
|
||||||
|
# Reachability — same pattern as HaulingProvider. Without this gate, an
|
||||||
|
# unreachable build site (e.g. a door painted on a tile that already has
|
||||||
|
# a pre-built wall) is offered every tick, Decision picks it over lower-
|
||||||
|
# priority work like chop, and JobRunner cancels the doomed walk each
|
||||||
|
# tick — a busy-spin that starves all elective work. For pathing-blocking
|
||||||
|
# sites (walls) we check from an adjacent tile; for others, from the tile.
|
||||||
|
var probe_tile: Vector2i = site.tile
|
||||||
|
if site.has_method("blocks_pathing_when_complete") and site.blocks_pathing_when_complete():
|
||||||
|
probe_tile = _find_adjacent_walkable(site.tile, pawn.tile)
|
||||||
|
if probe_tile == site.tile:
|
||||||
|
continue # no walkable neighbour at all → boxed-in site, skip silently
|
||||||
|
if pawn.tile != probe_tile and World.pathfinder.find_path(pawn.tile, probe_tile).is_empty():
|
||||||
|
continue
|
||||||
var d: int = abs(site.tile.x - pawn.tile.x) + abs(site.tile.y - pawn.tile.y)
|
var d: int = abs(site.tile.x - pawn.tile.x) + abs(site.tile.y - pawn.tile.y)
|
||||||
if d < best_dist:
|
if d < best_dist:
|
||||||
best_dist = d
|
best_dist = d
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue