RESOURCE_NODE_MIGRATION.md:
- Add progress overview table with per-phase completion status
- Document key divergences from original plan (zone fallback removal,
navigation_failed signal, stale-path prevention, duplicate detection)
- Add bug log table (11 bugs found and fixed during implementation)
- Mark completed phases 1-3 with checkmarks
- Split phase 4 into 4a (wood, done) and 4b (player parity, not started)
- Replace flat implementation order with checkable table
- Update definition-of-done with per-criterion status
PROJECT_CONTEXT.md:
- Advance snapshot commit reference from e30d208 to b8752f8
- Note that gather_food/gather_wood now use ResourceNode instances
- Explain zone marker status (player use only, NPCs use nodes)
- Update runtime flow diagram with navigation_failed pathway
- Add resource_nodes/ to repository map
- Update technical debt entries to reflect current state
NpcVisual:
- Add navigation_failed(sim_id) signal distinct from arrived_at_target
so the simulation layer can distinguish genuine arrival from failure
- Replace integer stuck_counter with delta-based stuck_time and
exported stuck_timeout (1.5s) for frame-rate-independent detection
- Add path_request_id / path_pending mechanism to reject stale
async path results when a new target is set or NPC dies
- On empty path or stuck movement, emit navigation_failed instead
of arriving; only emit arrived_at_target when truly close to target
- Reduce arrival_distance back to 0.6 now that navigation_failure
is properly signalled (no longer needed as a workaround)
- clamp arrival_distance reference in apply_dead_visual_state
SimNPC:
- Remove retry_count (replaced by navigation_failed signal pathway)
- Move last_task assignment from set_task() to task completion in
SimulationManager so it reflects the task that actually finished
SimulationManager:
- Add notify_npc_navigation_failed(): release reservation, record
last_task, send NPC to wander for 2s, emit task_changed signal
- Add notify_npc_target_unavailable() as public alias of above
- Guard extraction with node.reserved_by == npc.id to prevent
stale/illegitimate extraction when reservation is lost
- Guard fallback zone task completion (apply_npc_task) so it only
fires for non-resource tasks (gather_food/wood with no target
silently skip instead of applying zone values)
- Remove retry_count safety net (fully replaced by signal pipeline)
WorldViewManager:
- Connect navigation_failed signal in spawn_npc_visual()
- Skip target assignment for empty/idle/dead task states
- When no resource node available for gather_food/wood, call
notify_npc_target_unavailable() so NPC wanders instead of idling
- Add _on_npc_visual_navigation_failed handler delegating to
SimulationManager.notify_npc_navigation_failed()
- Remove retry_count references
- Push error and disable node when duplicate node_id is registered
to prevent silent conflict during find_available()
- Use interaction_point.global_position instead of self.global_position
in find_available() so distance is measured to the marker NPCs
actually navigate toward
Phase 3 of ResourceNode migration:
- Add apply_resource_delta to SimVillage for clean resource changes
- Extract from reserved ResourceNode on task completion instead of
hard-coded apply_npc_task for gather_food/gather_wood
- Detect depleted/unavailable targets on arrival and replan
Phase 1-2 of the ResourceNode migration plan:
- Create ResourceNode class (world/resource_nodes/) with extraction,
reservation, nearest-available selection, and debug label
- Place 4 resource instances in main.tscn (2 berry bushes, 2 trees)
- Add target_id to SimNPC for tracking which node an NPC is using
- Add set_npc_target_id and release_npc_reservation to SimulationManager
with cleanup on task change, completion, and death
- Update WorldViewManager to query available ResourceNodes first,
falling back to zone markers with a logged warning