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:
megaproxy 2026-05-16 18:38:14 +01:00
parent 2f76ae1639
commit fd6f958344
15 changed files with 157 additions and 62 deletions

View file

@ -316,7 +316,23 @@ func _tick_build(t) -> void:
## Finds the first unheld Item at pawn.tile in World.items.
## Transfers it into pawn.carried_item via set_being_carried(true).
## Completes in a single tick.
##
## Crafting-job race guard: if job.ingredient_item is set (cached at proposal time by
## CraftingProvider), validate that the cached item is still valid and not being carried
## before picking it up. If the item was taken by another pawn (or freed), cancel the
## job so Decision re-routes — prevents picking up the wrong item type.
func _tick_pickup(t) -> void:
# Validate cached ingredient ref (crafting jobs only).
if job != null and job.get("ingredient_item") != null:
var cached = job.ingredient_item
if not is_instance_valid(cached) or cached.being_carried:
Audit.log(
"job_runner",
"%s pickup: cached ingredient gone/taken — cancelling job" % pawn.pawn_name
)
cancel_job()
return
var item = null
for it in World.items:
if it.tile == pawn.tile and not it.being_carried:
@ -856,9 +872,8 @@ func _tick_treat(t) -> void:
## - Reduce dirt at the tile by DIRT_REDUCTION_PER_TICK via DirtinessSystem.bump_clean().
## - Done when dirt <= 0.
##
## DIRTY_THRESHOLD and DIRT_REDUCTION_PER_TICK mirror CleaningProvider constants.
## DIRT_REDUCTION_PER_TICK mirrors CleaningProvider / DirtinessSystem logic.
## 100.0 / 40 ticks = 2.5/tick ensures any tile (max 100 dirt) is clean in 40 ticks.
const _CLEAN_DIRTY_THRESHOLD: float = 25.0
const _DIRT_REDUCTION_PER_TICK: float = 2.5 # 100 / 40 ticks
func _tick_clean(t) -> void:
@ -873,7 +888,7 @@ func _tick_clean(t) -> void:
if not t.data.get("started", false):
# ── first-tick: validate tile is still worth cleaning ─────────────────
var current_dirt: float = ds.dirt_at(tile)
if current_dirt < _CLEAN_DIRTY_THRESHOLD:
if current_dirt < DirtinessSystem.DIRT_DIRTY_THRESHOLD:
Audit.log(
"job_runner",
"%s clean: tile %s already clean (dirt=%.1f) — skipping" % [pawn.pawn_name, tile, current_dirt]