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.
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ const SEASON_TINTS: Dictionary = {
|
|||
@onready var pathfinder: Pathfinder = $Pathfinder
|
||||
@onready var selection: Selection = $Selection
|
||||
@onready var designation_ctl: Designation = $DesignationCtl
|
||||
@onready var rest_provider: RestProvider = $RestProvider
|
||||
@onready var chop_provider: ChopProvider = $ChopProvider
|
||||
@onready var mine_provider: MineProvider = $MineProvider
|
||||
@onready var hauling_provider: HaulingProvider = $HaulingProvider
|
||||
|
|
@ -216,9 +215,9 @@ func _ready() -> void:
|
|||
# completion (Tree.fell, Wall._complete, etc.).
|
||||
World.designation_ctl = designation_ctl
|
||||
|
||||
# Register all 10 providers — Decision iterates by .priority desc.
|
||||
# Register all 9 providers — Decision iterates by .priority desc.
|
||||
# doctor=9 > sleep=8 > eat=7 > construction=6 > chop=5 ≈ plant=5 > mine=4
|
||||
# ≈ crafting=4 > haul=3 > rest=0.
|
||||
# ≈ crafting=4 > haul=3 > clean=2.
|
||||
# Phase 17 will tune these via the work-priority matrix UI.
|
||||
World.register_work_provider(doctor_provider)
|
||||
World.register_work_provider(sleep_provider)
|
||||
|
|
@ -229,8 +228,7 @@ func _ready() -> void:
|
|||
World.register_work_provider(crafting_provider)
|
||||
World.register_work_provider(plant_provider)
|
||||
World.register_work_provider(hauling_provider)
|
||||
World.register_work_provider(cleaning) # priority 2 — between haul (3) and rest (0)
|
||||
World.register_work_provider(rest_provider)
|
||||
World.register_work_provider(cleaning) # priority 2 — between haul (3) and idle
|
||||
|
||||
# Phase 5: bridge designation paint events → spawn the ghost-state entity
|
||||
# at that tile and register it as a build site.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
[ext_resource type="PackedScene" uid="uid://rimlike_camera_rig" path="res://scenes/world/camera_rig.tscn" id="2_camera"]
|
||||
[ext_resource type="Script" path="res://scenes/world/pathfinder.gd" id="3_pathfinder"]
|
||||
[ext_resource type="Script" path="res://scenes/world/selection.gd" id="4_selection"]
|
||||
[ext_resource type="Script" path="res://scenes/ai/rest_provider.gd" id="5_rest_provider"]
|
||||
[ext_resource type="Script" path="res://scenes/ai/chop_provider.gd" id="6_chop_provider"]
|
||||
[ext_resource type="Script" path="res://scenes/ai/mine_provider.gd" id="7_mine_provider"]
|
||||
[ext_resource type="Script" path="res://scenes/ai/hauling_provider.gd" id="8_hauling_provider"]
|
||||
|
|
@ -60,10 +59,6 @@ script = ExtResource("4_selection")
|
|||
[node name="DesignationCtl" type="Node" parent="."]
|
||||
script = ExtResource("10_designation")
|
||||
|
||||
[node name="RestProvider" type="Node" parent="."]
|
||||
script = ExtResource("5_rest_provider")
|
||||
rest_tile = Vector2i(50, 50)
|
||||
|
||||
[node name="ChopProvider" type="Node" parent="."]
|
||||
script = ExtResource("6_chop_provider")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue