|
|
b9093dd24b
|
Phase 17: Touch UX (PawnDetail+BuildDrawer+WorkMatrix+AlertsLog+Settings)
Three-agent fan-out shipping the major touch UI surfaces. Opus pre-wrote
6 EventBus signals (pawn_selected/deselected, pawn_priority_changed,
alert_added, request_wolf_spawn, day_ended) + Pawn.work_priorities
Dictionary stub before dispatch. Pattern proven across Phases 12-17.
Pawn detail + Settings (Agent A):
- scenes/ui/pawn_detail_panel.gd — right-side CanvasLayer (layer 18),
~360px wide, opens on EventBus.pawn_selected. Renders portrait,
HP/Hunger/Sleep bars with threshold colors, current job, mood +
sulking, statuses, top 5 mood thoughts, full skill table,
read-only work-priorities row. Live-refreshes each sim tick.
- scenes/ui/settings_menu.gd — modal CanvasLayer (layer 26), opened
via Settings button. Auto-pause toggles (Threat/Wanderer/Pawn-Down/
Modal), audio sliders (stubs for Phase 18), accessibility checkboxes.
Persists via GameState.apply_settings.
- scenes/world/selection.gd — extended to emit pawn_selected/deselected
through EventBus on tap.
Build drawer + 12 new Designation tools (Agent B):
- scenes/ui/build_drawer.gd — bottom-sheet CanvasLayer (layer 16) with
4 tabs (Designate/Build/Stockpile/Cancel) + FAB ⊕ open button.
Each tab has HFlowContainer of 80×80 buttons with procedural colored
icons + label. Tap → Designation.set_active_tool + alert + auto-close.
- Designation: added TOOL_CHOP, TOOL_MINE, TOOL_BUILD_CRATE,
TOOL_BUILD_BED, TOOL_BUILD_TORCH, 5× TOOL_BUILD_WORKBENCH_* variants,
TOOL_PAINT_STOCKPILE. Plus tool_material override for wall/floor.
- World._on_designation_added: extended dispatch for all 12 new tools;
added _spawn_workbench() helper for the 5 bench kinds.
Work matrix + Alerts log + Decision refactor + Wolf signal (Agent C):
- scenes/ai/decision.gd: Layer 4 now filters by pawn.work_priorities
(0=OFF skip, sort by level ascending with provider.priority tiebreak).
NEEDS_CATEGORIES (rest/eat/sleep) bypass the filter — a pawn can
never starve from misconfiguration. Audit log prefixes work decisions
with (pri=N).
- scenes/ui/work_priority_matrix.gd — CanvasLayer (layer 17) bottom-sheet
grid: rows=pawns × cols=8 work categories. Each cell tap-cycles
1→2→3→4→0→1, color-coded (red/orange/yellow/blue/gray). Writes back
to pawn.work_priorities + emits pawn_priority_changed.
- scenes/ui/alerts_log.gd — CanvasLayer (layer 19) ring buffer 50
entries. Newest first, severity icon (info/warn/danger), Day HH:MM
timestamp, Go-there camera pan. Listens to alert_added +
storyteller_event_fired + day_ended.
- EventBus.request_wolf_spawn wired end-to-end: EventCatalog
_spawn_wolves emits; WolfSpawner._on_request_wolf_spawn force-spawns
bypassing the darkness/cooldown gates.
- Clock emits EventBus.day_ended(summary) at dusk→night transition.
Top bar buttons added in order: ‖ / 1× / 5× / 12× / Save / Load /
Settings / Build / Work / Log[N]. Plus the ⊕ FAB at bottom-right.
MCP runtime verified all 4 surfaces via screenshot:
- PawnDetailPanel: Bram shows Crafting=8 / Cooking=2 / Manual=0
matching seed; bars green; Mood: 50; work-priorities readout
- BuildDrawer: 4 tabs visible, Designate tab shows Chop/Mine/Dig grave/
No roof buttons with procedural icons
- WorkPriorityMatrix: 3 pawns × 8 categories, all '3' (NORMAL default)
cells in yellow, tap-to-cycle ready
- AlertsLog: 4 entries — red 'Wolf pack approaching!' danger, blue
'Bram is at the cabin' info, yellow 'Test alert' warn, blue 'Spring
Awakens' from boot storyteller roll. Go-there button per entry.
Mouse drag-paint works as-is (user noted). Existing
Selection/Designation _unhandled_input handles drag.
Deferred to Phase 17.5 polish:
- Per-pawn/per-job view layers on the matrix
- Stockpile 4×4 chip filter UI (paint creates 1×1 zones today)
- Bill UI for workbenches (programmatic only today)
- 'No stockpile accepts X' / 'Bill blocked' alert emit wiring
- DaySummaryCard visual (signal emits today, no card UI)
- Wanderer recruit UI, resource buff system
Delegation: 3× gdscript-refactor (Sonnet) agents in parallel;
integration + MCP verify on Opus.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-11 19:45:35 +01:00 |
|
|
|
3da7353387
|
Phase 15: Storyteller (25 events, daily roll, banner+modal UI)
Three-agent fan-out reusing the contracts-first pattern: Opus pre-wrote
EventDef class + 5 EventBus signals + Storyteller autoload stub before
dispatch. Pattern proven across Phases 12/13/14/15.
EventDef + 25-event corpus (Agent A):
- scenes/storyteller/event_def.gd — data class with id/title/body/
category/display/cooldown_days/base_weight/choices/auto_pause/
focus_tile/trigger_predicate/on_resolve
- scenes/storyteller/event_catalog.gd — class_name EventCatalog with
register_all() dispatcher + 25 _event_NN() static factories covering
all 8 categories (nudge×4, seasonal×4, wanderer×4, threat×4, disease×3,
resource×3, lore×2, milestone×1)
- Strings catalog: 50 keys added (event.<id>.title + event.<id>.body)
+ ui.go_there / ui.dismiss for UI buttons
- on_resolve effects: real-wired for a_bad_cut (StatusCatalog.bleeding),
one_year_survived + refugee_family + sleeplessness (colony mood thoughts);
stubbed-with-log for wanderer spawns (Phase 17 recruit UI), resource
buffs (Phase 17 work-buff system), wolf spawn (EventBus signal pending),
fever (StatusCatalog.sick pending), seasonal effects
Storyteller real implementation (Agent B):
- autoload/storyteller.gd — replaced stub with full logic:
* Daily 6 AM roll via Clock.phase_changed(&dawn), one-per-day guard
* Per-event cooldown via _event_last_fired Dict; per-category via
_category_last_fired Dict + CATEGORY_COOLDOWN_DAYS (nudge=2,
seasonal=12, wanderer=5, threat=3, disease=4, resource=3, lore=6,
milestone=30) — both gates must pass
* Tension model: 0..100, −3/roll decay, +15 on THREAT fire (net +12)
Category multipliers: THREAT = lerp(2.0, 0.3, t/100),
RESOURCE = lerp(0.5, 1.5, t/100), others = 1.0
* State-trigger 3× weight boost when predicate currently true
* Auto-pause Sim before showing UI for auto_pause events
* Ghost state: _on_pawn_died flips on World.pawns empty,
_ghost_wanderer_target_day = today + randi_range(3, 5),
daily roll bypasses pool and force-fires WANDERER (prefers a_traveler)
* Full save/load round-trip incl. cooldown dicts (StringName↔String)
Banner + Modal UI (Agent C):
- scenes/ui/storyteller_banner.gd — class_name StorytellerBanner extends
CanvasLayer (layer 15), top-center under top-bar, 6-sec auto-dismiss
Timer, tap-to-dismiss-early, internal queue for back-to-back events
- scenes/ui/storyteller_modal.gd — class_name StorytellerModal extends
CanvasLayer (layer 20), center PanelContainer, full-screen 0.45 dim
ColorRect, 0/1/2 choice button layouts
- camera_rig.gd: pan_to_tile(tile) public helper using existing
_centre_on tween slot
- Both UI scenes runtime-instantiated in main.gd as CanvasLayer children
(no .tscn edit needed)
- %pawn% substitution at display time (World.pawns[0].pawn_name fallback)
Modal auto-hide-on-resolve fix (Opus mid-flight):
- Original Agent C modal only hid on internal button click. Added
EventBus.storyteller_event_resolved subscriber → _set_visible(false)
so external resolve_current calls (test scripts, ghost-state auto-fire)
also dismiss the dialog.
MCP runtime verified across two boots:
- Boot 1: day 0 roll → lone_wolf THREAT, modal 'A starving wolf circles
your livestock.' with Prepare/Dismiss + auto-pause (tick 1 frozen).
Resolve → tension 27→42, sim resumed.
- Boot 2: day 0 roll → an_old_map LORE, top-center banner, non-blocking.
Banner path + modal path both visually confirmed.
Deferred to Phase 17 polish:
- EventBus.request_wolf_spawn signal — wolf-spawn effects log-stub today
- Wanderer recruit UI (modal currently dismisses, pawn add deferred)
- Resource buff system (next-N-jobs multipliers)
- 3+ choice modals (current UI renders first 2)
- .tres event resources (currently code-as-data factories)
Delegation: 3× gdscript-refactor (Sonnet) agents in parallel;
modal-hide fix on Opus; integration + MCP verify on Opus.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-11 19:01:35 +01:00 |
|