Phase 17/18 closure: stockpile filter UI + day summary + atmospheric audio
Three-agent fan-out (gdscript-refactor x3) closing deferred polish: - Stockpile chip filter UI: new StockpilePanel (layer 18, right-anchored, mirrors WorkbenchPanel). 5-priority segmented control + 21-chip 4-col filter grid using Item.ALL_TYPES; wildcard (empty accepted_types) shows all chips checked with 'All' hint, first explicit pick switches to explicit-list mode. Selection chain extended to pawn → workbench → stockpile with mutual exclusion. 12 ui.stockpile.* + 13 item.* keys. - DaySummaryCard: layer-19 modal auto-opens at dusk→night via day_ended, auto-pauses sim, shows day+season header, weather row, stats grid with green/yellow/red tension bar, Continue dismiss + backdrop tap. Settings 'Show end-of-day summary' toggle persists via GameState. - Atmospheric audio: rain ambient loop (Cozy Melodies Pack 6) on weather_changed rain/storm with 0.5s fade-out on clear; thunder sting (Magic and Spells 6) on rain→storm transition; raid warning sting (Sword Pack 1, 'blades drawn') on EventBus.wolf_spawned. All on SFX bus — inherits existing slider + suspend mute. Contracts pre-written before fan-out: EventBus.stockpile_selected / stockpile_deselected / wolf_spawned signals; WolfSpawner._trigger_raid + _on_request_wolf_spawn now emit wolf_spawned with the spawned array. MCP runtime verified: StockpilePanel opens with 21 chips, DaySummaryCard renders weather row + tension bar + auto-pause, rain_player.playing=true on weather_changed(rain), all three new SFX keys in Audio.SFX_FILES. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
88e3fa9364
commit
bba1ce4334
18 changed files with 935 additions and 18 deletions
|
|
@ -17,6 +17,8 @@ var _selected_pawn: Pawn = null
|
|||
## Currently selected workbench, or null. Mutually exclusive with _selected_pawn —
|
||||
## selecting one clears the other (see _select / _select_workbench).
|
||||
var _selected_workbench: Workbench = null
|
||||
## Currently selected stockpile zone, or null. Mutually exclusive with the above.
|
||||
var _selected_stockpile = null # StockpileZone (duck-typed to avoid circular preload)
|
||||
var _camera = null # Camera2D (CameraRig) — set via bind_camera(); duck-typed to avoid circular preload
|
||||
|
||||
# When Designation paint mode is active this flag is raised by Designation so
|
||||
|
|
@ -76,12 +78,17 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
get_viewport().set_input_as_handled()
|
||||
Audit.log("selection", "escape: deselected workbench")
|
||||
return
|
||||
if _selected_stockpile != null:
|
||||
_deselect_stockpile()
|
||||
get_viewport().set_input_as_handled()
|
||||
Audit.log("selection", "escape: deselected stockpile")
|
||||
return
|
||||
|
||||
# ── Mouse: only handle button events below ───────────────────────────────────
|
||||
if not (event is InputEventMouseButton):
|
||||
return
|
||||
|
||||
# ── Right-click: cancel designation (if active) or deselect pawn / workbench ──
|
||||
# ── Right-click: cancel designation (if active) or deselect pawn / workbench / stockpile ──
|
||||
if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
|
||||
# Designation cancellation is handled by Designation._input; if we see
|
||||
# this right-click, no designation was active. Deselect whatever is selected.
|
||||
|
|
@ -91,6 +98,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
elif _selected_workbench != null:
|
||||
_deselect_workbench()
|
||||
get_viewport().set_input_as_handled()
|
||||
elif _selected_stockpile != null:
|
||||
_deselect_stockpile()
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
|
||||
if event.button_index != MOUSE_BUTTON_LEFT:
|
||||
|
|
@ -139,10 +149,18 @@ func _handle_click(screen_pos: Vector2) -> void:
|
|||
_select_workbench(hit_workbench)
|
||||
return
|
||||
|
||||
# Empty tile with no current pawn selection → also clear any workbench selection.
|
||||
# Click on a stockpile zone → open the filter editor panel.
|
||||
var hit_stockpile = World.stockpile_at_tile(tile)
|
||||
if hit_stockpile != null:
|
||||
_select_stockpile(hit_stockpile)
|
||||
return
|
||||
|
||||
# Empty tile with no current pawn selection → also clear any workbench / stockpile selection.
|
||||
if _selected_pawn == null:
|
||||
if _selected_workbench != null:
|
||||
_deselect_workbench()
|
||||
if _selected_stockpile != null:
|
||||
_deselect_stockpile()
|
||||
return
|
||||
|
||||
# Empty walkable tile with a selection → queue a forced job. Decision picks
|
||||
|
|
@ -161,9 +179,11 @@ func _handle_click(screen_pos: Vector2) -> void:
|
|||
func _select(pawn: Pawn) -> void:
|
||||
if _selected_pawn == pawn:
|
||||
return
|
||||
# Mutual exclusion with workbench selection: clear it before promoting pawn.
|
||||
# Mutual exclusion with workbench and stockpile: clear them before promoting pawn.
|
||||
if _selected_workbench != null:
|
||||
_deselect_workbench()
|
||||
if _selected_stockpile != null:
|
||||
_deselect_stockpile()
|
||||
if _selected_pawn != null:
|
||||
_selected_pawn.set_selected(false)
|
||||
EventBus.pawn_deselected.emit()
|
||||
|
|
@ -184,12 +204,14 @@ func _deselect() -> void:
|
|||
|
||||
|
||||
## Select a workbench → opens the bill-editor panel via EventBus.
|
||||
## Mutually exclusive with pawn selection: clears _selected_pawn first.
|
||||
## Mutually exclusive with pawn and stockpile selections.
|
||||
func _select_workbench(wb) -> void:
|
||||
if _selected_workbench == wb:
|
||||
return
|
||||
if _selected_pawn != null:
|
||||
_deselect()
|
||||
if _selected_stockpile != null:
|
||||
_deselect_stockpile()
|
||||
if _selected_workbench != null:
|
||||
EventBus.workbench_deselected.emit()
|
||||
_selected_workbench = wb
|
||||
|
|
@ -205,6 +227,30 @@ func _deselect_workbench() -> void:
|
|||
EventBus.workbench_deselected.emit()
|
||||
|
||||
|
||||
## Select a stockpile zone → opens the filter editor panel via EventBus.
|
||||
## Mutually exclusive with pawn and workbench selections.
|
||||
func _select_stockpile(zone) -> void:
|
||||
if _selected_stockpile == zone:
|
||||
return
|
||||
if _selected_pawn != null:
|
||||
_deselect()
|
||||
if _selected_workbench != null:
|
||||
_deselect_workbench()
|
||||
if _selected_stockpile != null:
|
||||
EventBus.stockpile_deselected.emit()
|
||||
_selected_stockpile = zone
|
||||
EventBus.stockpile_selected.emit(zone)
|
||||
Audit.log("selection", "selected stockpile at %s" % str(zone.position))
|
||||
|
||||
|
||||
func _deselect_stockpile() -> void:
|
||||
if _selected_stockpile == null:
|
||||
return
|
||||
Audit.log("selection", "deselected stockpile")
|
||||
_selected_stockpile = null
|
||||
EventBus.stockpile_deselected.emit()
|
||||
|
||||
|
||||
## Cycle the selection forward (dir=1) or backward (dir=-1) through World.pawns.
|
||||
## Wraps around. If no pawn currently selected, picks World.pawns[0].
|
||||
## Pans the camera to the newly selected pawn's tile.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue