sprint A cleanup: accessibility, signals, race, debris
G: large_text scales global theme font (14→20 at 1.4×) via new GameState.get_font_scale + EventBus.settings_changed. reduce_motion gates ResumeToast fade (HintOverlay already gated). I: InspectTooltip long-press wired (500ms hold, 12px drift cancel, tap-to-clear pin). Stale Phase 19 TODO replaced with accurate doc. H: Pawn.arrived_at_destination now also emitted on EventBus.pawn_arrived_at_destination; DirtinessSystem subscribes and bumps indoor traffic dirt (BUMP_INDOOR_TRAFFIC = 0.2). Outdoor-tracked bump needs Pawn.prev_tile — flagged for Phase 20. P: CraftingProvider caches ingredient item ref on Job.ingredient_item; JobRunner._tick_pickup validates is_instance_valid + not being_carried before the tile scan, cancels cleanly if another pawn grabbed it. J: rest_provider.gd deleted. Removed @onready + register call from world.gd, ext_resource + node from world.tscn. Provider count comment updated to 9. M: DIRTY_THRESHOLD extracted — cleaning_provider and job_runner now reference DirtinessSystem.DIRT_DIRTY_THRESHOLD. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2f76ae1639
commit
fd6f958344
15 changed files with 157 additions and 62 deletions
|
|
@ -22,10 +22,9 @@ class_name DirtinessSystem extends Node
|
|||
## This keeps signal volume low since bumps fire 20×/s per pawn crossing.
|
||||
##
|
||||
## Pawn tile-change hook:
|
||||
## World scene calls bump_pawn_traffic(tile, indoor) each time a pawn advances
|
||||
## a tile. Indoor traffic adds 0.2; outdoor-tracked-in adds 0.5.
|
||||
## (world.gd bridges _advance_walk → DirtinessSystem via the arrived_at_destination
|
||||
## signal on each Pawn — wired in world.gd _spawn_sample_pawns / _on_pawn_ready.)
|
||||
## _ready() connects to EventBus.pawn_arrived_at_destination. Indoor arrivals bump
|
||||
## BUMP_INDOOR_TRAFFIC (0.2); outdoor arrivals are skipped. Phase 20 can upgrade to
|
||||
## BUMP_OUTDOOR_TRACKED (0.5) on outdoor→indoor transitions once Pawn.prev_tile lands.
|
||||
##
|
||||
## Wire as child of the World scene (after Pathfinder). world.gd exposes the
|
||||
## instance on the World autoload as World.dirtiness_system for entity code.
|
||||
|
|
@ -34,6 +33,10 @@ class_name DirtinessSystem extends Node
|
|||
## Keys = Vector2i tile coords; Values = float in [0, 100].
|
||||
var dirt_map: Dictionary = {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
EventBus.pawn_arrived_at_destination.connect(_on_pawn_arrived_at_destination)
|
||||
|
||||
## Tier boundaries (thresholds match design.md; tune Phase 20).
|
||||
const DIRT_DIRTY_THRESHOLD: float = 25.0
|
||||
const DIRT_FILTHY_THRESHOLD: float = 60.0
|
||||
|
|
@ -71,13 +74,23 @@ func bump_clean(tile: Vector2i, amount: float) -> void:
|
|||
_set_dirt(tile, old_val, new_val)
|
||||
|
||||
|
||||
## Traffic-driven dirt bump. Called by World when a pawn arrives at a new tile.
|
||||
## `indoor` = true when the tile is inside a roofed room (World.is_indoor check).
|
||||
## Traffic-driven dirt bump. Called internally by _on_pawn_arrived_at_destination.
|
||||
## `indoor` = true when the destination tile is inside a roofed room (World.is_indoor check).
|
||||
func bump_pawn_traffic(tile: Vector2i, indoor: bool) -> void:
|
||||
var amount := BUMP_INDOOR_TRAFFIC if indoor else BUMP_OUTDOOR_TRACKED
|
||||
bump(tile, amount)
|
||||
|
||||
|
||||
## Pawn arrival handler — wired to EventBus.pawn_arrived_at_destination in _ready().
|
||||
## Skips outdoor arrivals (no floor to dirty); bumps indoor tiles by BUMP_INDOOR_TRAFFIC.
|
||||
## Phase 20 follow-up: add Pawn.prev_tile tracking so an outdoor→indoor transition can
|
||||
## instead use BUMP_OUTDOOR_TRACKED (0.5) to model boots tracking mud in.
|
||||
func _on_pawn_arrived_at_destination(_pawn, dest_tile: Vector2i) -> void:
|
||||
if not World.is_indoor(dest_tile):
|
||||
return # Only dirtiness indoor floor tiles.
|
||||
bump_pawn_traffic(dest_tile, true)
|
||||
|
||||
|
||||
# ── save / load ───────────────────────────────────────────────────────────────
|
||||
|
||||
## Serialise the sparse dirt map as an array of {x, y, v} dicts.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue