Phase 13: Rooms + Auto-roof + Beauty + Dirtiness + Cleaning
Three-agent fan-out — Opus pre-wrote Room class, World.rooms/room_at_tile/is_indoor, 4 EventBus signals before dispatch so the slices ran fully parallel. DECISION: Big-room UX = bump auto-roof cap to 16, banner above. Cabin (24 tiles) intentionally exceeds cap to exercise the warning path; a 5×5 test shed (9 interior tiles) was added to exercise the roof path. Room detection (Agent A): - scenes/world/room.gd — class_name Room, tiles/bounds/is_under_roof, contains_tile() bounds-then-list-checked, recompute_bounds() - scenes/world/room_detector.gd — class_name RoomDetector, BFS 4-dir from floor/door tiles, walls/terrain as boundary, doors counted as room interior. Detects up to 4× cap; auto-roofs only ≤16. - World.mark_wall_tile/mark_floor_tile/mark_door_tile hook BFS recompute - Door._complete() now erases wall-layer stamp + registers door tile - Designation.TOOL_NO_ROOF paint mode wired (UI button deferred Phase 17) - EventBus.room_changed / room_too_large signals Indoor/Shelter (Agent B): - Pawn._is_sheltered() rerouted: World.is_indoor() first, floor-proxy fallback - IndoorTintOverlay Node2D — _draw fills roofed-room tiles at α=0.10 warm - Crop._on_sim_tick skips stage advance when World.is_indoor(tile) Beauty + Dirtiness + Cleaning + Room thoughts (Agent C): - BeautySystem sparse map, linear falloff radius=3, Quality multiplier (SHODDY 0.5 → LEGENDARY 2.5). Base: Bed +2, Workbench +1, Torch +3, Hearth +4 - DirtinessSystem 0-100, tier crossings (clean<25/dirty<60/filthy≥60) emit tile_dirtiness_changed. bump/bump_clean/bump_pawn_traffic API - CleaningProvider priority=2, KIND_CLEAN toil, 2.5 dirt/tick for ~40 ticks - Bed/Torch/Workbench _complete() now register with BeautySystem - 7 room mood thoughts: clean_room (+2), dirty_room (-3), filthy_room (-6), beautiful_room (+4), ugly_room (-3), slept_in_room (+3 EVENT, wires Ph 17), ate_without_table (-3 EVENT, wires Ph 17) - Pawn._sync_room_thoughts called from _process_thoughts after cold block, defensive against null rooms/systems Integration recovery (Opus): - Agent C's BeautySystem/DirtinessSystem/CleaningProvider/IndoorTintOverlay instantiation in world.gd never landed (only field declarations + entity hooks survived). Added preloads + runtime add_child + autoload bindings + CleaningProvider registration + furniture pre-seed in _ready - Added _prestamp_test_shed_for_room_detector with _spawn_complete_wall/floor helpers so a 5×5 visible shed exercises the auto-roof path at boot MCP runtime verified: - Rooms: cabin Room#2 size=24 roofed=false (room_too_large fires), shed Room#3 size=9 roofed=true (auto-roof active) - beauty_map size=50 around prebuilt furniture; bed at (47,24) beauty=4.0 - Bram teleported to (36, 25) in shed → indoor=true, sheltered=true, thoughts=[clean_room +2], mood=52.0 - Screenshot: shed walls + brown floor visible; cabin warmly torch-lit; Spring 1/12 indicator; Day 1 07:52 Delegation: 3× gdscript-refactor (Sonnet) agents in parallel; integration recovery + MCP verify on Opus. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
92f4e5c945
commit
9cf9b7dbfd
28 changed files with 1286 additions and 28 deletions
|
|
@ -136,6 +136,12 @@ var statuses: Array = [] # Array[Status]
|
|||
var _wet_accum: float = 0.0
|
||||
var _cold_accum: float = 0.0
|
||||
|
||||
# Phase 13 — shelter debug tracking.
|
||||
## When SHELTER_DEBUG is true, any false→true or true→false transition in
|
||||
## _is_sheltered() emits an Audit.log line. Off by default — debug noise.
|
||||
const SHELTER_DEBUG: bool = false
|
||||
var _shelter_prev: bool = false
|
||||
|
||||
var _path: Array[Vector2i] = []
|
||||
var _step_progress: float = 0.0
|
||||
var _selected: bool = false
|
||||
|
|
@ -400,6 +406,9 @@ func _process_thoughts() -> void:
|
|||
_sync_persistent_thought(&"soaked", has_status(&"wet") and _wet_severity() == StatusCatalog.WET_SOAKED_LEVEL, ThoughtCatalog.soaked())
|
||||
# Phase 12 — cold mood thought (any cold severity triggers the single cold thought).
|
||||
_sync_persistent_thought(&"cold", has_status(&"cold"), ThoughtCatalog.cold_thought())
|
||||
# Phase 13 — room beauty and dirtiness thoughts.
|
||||
# Defensive: World.room_at_tile returns null if rooms are empty (Agent A may land later).
|
||||
_sync_room_thoughts()
|
||||
# 3. Recompute if EVENT thoughts expired (persistent syncs call _recompute_mood internally).
|
||||
if dirty:
|
||||
_recompute_mood()
|
||||
|
|
@ -407,6 +416,62 @@ func _process_thoughts() -> void:
|
|||
_process_sulking()
|
||||
|
||||
|
||||
## Phase 13 — sync beauty and dirtiness room thoughts for this pawn's current tile.
|
||||
## Called from _process_thoughts() after the cold/damp/soaked block.
|
||||
## Defensive: returns early if rooms or the beauty/dirtiness systems are not yet wired
|
||||
## (Agent A's RoomDetector may land slightly after this code during startup).
|
||||
##
|
||||
## Beauty thoughts (mutually exclusive — only one fires):
|
||||
## avg beauty >= 4.0 → beautiful_room
|
||||
## avg beauty < 0.0 → ugly_room (Phase 14 corpses drive this below 0)
|
||||
## else → neither
|
||||
##
|
||||
## Dirtiness thoughts (mutually exclusive — only one fires):
|
||||
## avg dirt < 25 → clean_room
|
||||
## avg dirt 25..60 → dirty_room
|
||||
## avg dirt >= 60 → filthy_room
|
||||
func _sync_room_thoughts() -> void:
|
||||
var room = World.room_at_tile(tile)
|
||||
|
||||
# ── no room (outdoors or RoomDetector not yet live) → clear all room thoughts ──
|
||||
if room == null:
|
||||
_sync_persistent_thought(&"beautiful_room", false, ThoughtCatalog.beautiful_room())
|
||||
_sync_persistent_thought(&"ugly_room", false, ThoughtCatalog.ugly_room())
|
||||
_sync_persistent_thought(&"clean_room", false, ThoughtCatalog.clean_room())
|
||||
_sync_persistent_thought(&"dirty_room", false, ThoughtCatalog.dirty_room())
|
||||
_sync_persistent_thought(&"filthy_room", false, ThoughtCatalog.filthy_room())
|
||||
return
|
||||
|
||||
# ── beauty ──────────────────────────────────────────────────────────────────
|
||||
var avg_beauty: float = 0.0
|
||||
var bs = World.get("beauty_system")
|
||||
if bs != null and room.tiles.size() > 0:
|
||||
var beauty_sum: float = 0.0
|
||||
for rt in room.tiles:
|
||||
beauty_sum += bs.beauty_at(rt)
|
||||
avg_beauty = beauty_sum / float(room.tiles.size())
|
||||
|
||||
_sync_persistent_thought(&"beautiful_room", avg_beauty >= 4.0, ThoughtCatalog.beautiful_room())
|
||||
_sync_persistent_thought(&"ugly_room", avg_beauty < 0.0, ThoughtCatalog.ugly_room())
|
||||
|
||||
# ── dirtiness ───────────────────────────────────────────────────────────────
|
||||
var avg_dirt: float = 0.0
|
||||
var ds = World.get("dirtiness_system")
|
||||
if ds != null and room.tiles.size() > 0:
|
||||
var dirt_sum: float = 0.0
|
||||
for rt in room.tiles:
|
||||
dirt_sum += ds.dirt_at(rt)
|
||||
avg_dirt = dirt_sum / float(room.tiles.size())
|
||||
|
||||
# Mutually exclusive — only one fires (filthy wins over dirty wins over clean).
|
||||
var is_filthy: bool = avg_dirt >= 60.0
|
||||
var is_dirty: bool = avg_dirt >= 25.0 and not is_filthy
|
||||
var is_clean: bool = avg_dirt < 25.0
|
||||
_sync_persistent_thought(&"filthy_room", is_filthy, ThoughtCatalog.filthy_room())
|
||||
_sync_persistent_thought(&"dirty_room", is_dirty, ThoughtCatalog.dirty_room())
|
||||
_sync_persistent_thought(&"clean_room", is_clean, ThoughtCatalog.clean_room())
|
||||
|
||||
|
||||
## Add or remove a PERSISTENT thought based on a boolean state flag.
|
||||
## Calls add_thought() / remove_thought_by_id() (which recompute mood) only
|
||||
## when the presence actually needs to change — avoids redundant recomputes.
|
||||
|
|
@ -590,12 +655,25 @@ func _sync_cold_status() -> void:
|
|||
break
|
||||
|
||||
|
||||
## Phase 12 — returns true if the pawn's current tile has a floor beneath it.
|
||||
## This is a Phase 13 stand-in for full Room/Roof detection. A tile is considered
|
||||
## sheltered when World.floor_layer reports a valid cell at the pawn's tile position.
|
||||
## Replace with Room.contains(tile) once the Room BFS system lands (Phase 13+).
|
||||
## Phase 13 — returns true if the pawn's current tile is inside an enclosed,
|
||||
## roofed Room (via World.is_indoor). Falls back to the Phase 12 has-floor proxy
|
||||
## during the brief window before RoomDetector populates the registry (boot,
|
||||
## mid-build, cabin not-yet-enclosed). The fallback is graceful enough for those
|
||||
## transient states and produces no false positives on open terrain.
|
||||
##
|
||||
## Callers: _tick_wet() and _tick_cold() both call this once per sim tick.
|
||||
## If SHELTER_DEBUG is true, false→true and true→false transitions emit Audit lines.
|
||||
func _is_sheltered() -> bool:
|
||||
return World.floor_layer.get_cell_source_id(tile) != -1
|
||||
var sheltered: bool
|
||||
if World.is_indoor(tile):
|
||||
sheltered = true
|
||||
else:
|
||||
sheltered = World.floor_layer.get_cell_source_id(tile) != -1
|
||||
if SHELTER_DEBUG and sheltered != _shelter_prev:
|
||||
var direction := "→sheltered" if sheltered else "→unsheltered"
|
||||
Audit.log("pawn", "%s shelter transition %s at %s" % [pawn_name, direction, tile])
|
||||
_shelter_prev = sheltered
|
||||
return sheltered
|
||||
|
||||
|
||||
# ── save / load ─────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue