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:
megaproxy 2026-05-11 17:19:23 +01:00
parent 92f4e5c945
commit 9cf9b7dbfd
28 changed files with 1286 additions and 28 deletions

View file

@ -280,3 +280,8 @@ func _complete() -> void:
_completed = true
queue_redraw()
Audit.log("bed", "%s built at %s" % [label_text, tile])
# Phase 13 — notify BeautySystem so nearby tile beauty scores update.
var bs = World.get("beauty_system")
if bs != null:
bs.register_furniture(self)
bs.recompute_around(tile)

View file

@ -33,6 +33,10 @@ var stage: Stage = Stage.SOWN
## Progress within the current growth stage; 0..STAGE_TICKS.
var stage_progress: int = 0
# Phase 13 — "no growth indoors" rule. True once we've logged the first
# indoor detection for this crop instance so we don't flood the audit log.
var _logged_indoor: bool = false
const ITEM_SCENE: PackedScene = preload("res://scenes/entities/item.tscn")
@ -101,10 +105,19 @@ func on_sow_tick() -> void:
# ── growth ────────────────────────────────────────────────────────────────────
func _on_sim_tick(_n: int) -> void:
# Phase 7 simplification: crops always grow regardless of roofing.
# Phase 13 "no growth indoors" rule lands when Roof flag system is live.
if stage == Stage.READY or stage == Stage.TILLED:
return
# Phase 13 — crops don't grow indoors (no sunlight under a roof).
# World.is_indoor() returns false while RoomDetector has not yet fired, so
# outdoor crops planted during boot are unaffected.
if World.is_indoor(tile):
if not _logged_indoor:
Audit.log("crop", "%s at %s won't grow (indoor)" % [crop_kind, tile])
_logged_indoor = true
return
# Crop has moved outdoors or was never indoors — reset the log flag so a
# future re-roofing produces another audit line.
_logged_indoor = false
stage_progress += 1
if stage_progress >= STAGE_TICKS:
stage_progress = 0

View file

@ -136,7 +136,16 @@ func _draw() -> void:
func _complete() -> void:
_completed = true
# Doors are walkable — do NOT call set_cell_walkable(false).
# Phase 13 — erase any wall-layer stamp at this tile. The demo seed
# pre-stamps the door slot as a wall so BFS can detect the cabin at boot;
# the real door completing supersedes that. Must happen before register_door
# so the BFS in mark_door_tile sees the correct wall-layer state.
if World.wall_layer != null:
World.wall_layer.erase_cell(tile)
# Register so future open/close logic can locate this door by tile.
World.register_door(self)
# Phase 13 — notify RoomDetector so the door tile is eligible as an
# interior boundary tile for room BFS.
World.mark_door_tile(tile)
queue_redraw()
Audit.log("door", "door completed at %s" % tile)

View file

@ -243,3 +243,8 @@ func _complete() -> void:
_light.enabled = _is_on
queue_redraw()
Audit.log("torch", "built at %s" % tile)
# Phase 13 — notify BeautySystem so nearby tile beauty scores update.
var bs = World.get("beauty_system")
if bs != null:
bs.register_furniture(self)
bs.recompute_around(tile)

View file

@ -405,6 +405,13 @@ func _complete() -> void:
_light.enabled = is_on()
queue_redraw()
Audit.log("workbench", "%s built at %s" % [label_text, tile])
# Phase 13 — notify BeautySystem so nearby tile beauty scores update.
# Hearth gets base beauty 4 (warm glow); other benches get 1.
# Beauty lookup key is label_text ("Hearth", "Carpenter", etc.).
var bs = World.get("beauty_system")
if bs != null:
bs.register_furniture(self)
bs.recompute_around(tile)
# ── Phase 11: internal light helpers ─────────────────────────────────────────