Chop/mine designation gate + reachability gates on Doctor & Eat
Player reported pawns ignoring chop designations. Root cause: ChopProvider/MineProvider iterated World.trees/World.rocks unconditionally — paint set a null sentinel and never touched the entity, so designation was cosmetic only. Pawns auto-chopped nearest unfelled tree. * Added chop_designated: bool to Tree, mine_designated: bool to Rock and BigRock (footprint-aware: paint on any of the 4 footprint cells flags the boulder). Save/load round-trips the flag. * world.gd._on_designation_added 'chop'/'mine' cases now find the entity at the painted tile and flip the flag. _on_designation_cleared inverts. * Boot seed auto-designates SAMPLE_TREES / SAMPLE_ROCKS / SAMPLE_BIG_ROCKS so the cabin demo still produces wood + stone end-to-end without requiring the player to paint first. Also from the same audit (researcher mapped all 11 WorkProviders): * DoctorProvider + EatProvider now pre-check reachability with pathfinder.find_path before issuing a job, mirroring HaulingProvider's pattern. Previously they handed out doomed walks that JobRunner had to cancel, busy-spinning at 20 Hz. Verified end-to-end via MCP runtime: undesignated tree/rock returns null from provider; paint flips the flag and provider returns a chop/mine job; un-paint clears the flag; BigRock footprint paint works on any of the 4 cells. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
922f269a6c
commit
a4163ba222
9 changed files with 80 additions and 10 deletions
|
|
@ -23,6 +23,9 @@ const STONE_DROPS_ON_MINE: int = 1
|
|||
var tile: Vector2i = Vector2i.ZERO
|
||||
## 0..MINE_TICKS. Advanced by on_mine_tick(); rock is mined when equal to MINE_TICKS.
|
||||
var mine_progress: int = 0
|
||||
## True once a player has painted a mine designation on this rock. MineProvider
|
||||
## ignores undesignated rocks (Rimworld parity — pawns don't auto-mine).
|
||||
var mine_designated: bool = false
|
||||
|
||||
# Preloaded scene for spawned stone items.
|
||||
const ITEM_SCENE: PackedScene = preload("res://scenes/entities/item.tscn")
|
||||
|
|
@ -130,6 +133,7 @@ func to_dict() -> Dictionary:
|
|||
"tile_x": tile.x,
|
||||
"tile_y": tile.y,
|
||||
"mine_progress": mine_progress,
|
||||
"mine_designated": mine_designated,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -138,6 +142,7 @@ static func from_dict(d: Dictionary) -> Dictionary:
|
|||
"tile_x": int(d.get("tile_x", 0)),
|
||||
"tile_y": int(d.get("tile_y", 0)),
|
||||
"mine_progress": int(d.get("mine_progress", 0)),
|
||||
"mine_designated": bool(d.get("mine_designated", false)),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue