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
|
|
@ -25,3 +25,9 @@ signal pawn_status_removed(pawn, status) ## Emitted by Pawn.remove_status_
|
|||
# Phase 12 — Seasons + Weather.
|
||||
signal season_changed(season: StringName) ## Emitted by Clock when current_season() rolls over (Spring → Summer → Autumn → Winter).
|
||||
signal weather_changed(weather: StringName) ## Emitted by Weather autoload when the daily roll resolves to a new weather kind.
|
||||
|
||||
# Phase 13 — Rooms + Roofing + Beauty + Dirtiness + Cleaning.
|
||||
signal room_changed(room_id: int) ## Emitted when a room is created, destroyed, or recomputed (id may be invalid post-destroy).
|
||||
signal room_too_large(top_left: Vector2i, cell_count: int) ## Emitted when BFS hits ROOM_MAX_CELLS — surfaces the "split with interior wall" banner.
|
||||
signal tile_beauty_changed(tile: Vector2i, beauty: float) ## Emitted when beauty recomputes for a tile (Phase 13 beauty system).
|
||||
signal tile_dirtiness_changed(tile: Vector2i, dirt: float) ## Emitted when dirtiness crosses a tier threshold (clean/dirty/filthy).
|
||||
|
|
|
|||
|
|
@ -262,6 +262,9 @@ func mark_wall_tile(tile: Vector2i, material: StringName) -> void:
|
|||
# Real material→atlas mapping lands when assets are imported.
|
||||
var atlas := Vector2i(2, 0) if material == &"stone" else Vector2i(3, 0)
|
||||
wall_layer.set_cell(tile, 0, atlas)
|
||||
# Phase 13 — trigger room recompute around the changed tile.
|
||||
if room_detector != null:
|
||||
room_detector.recompute_around(tile)
|
||||
|
||||
|
||||
func mark_floor_tile(tile: Vector2i, material: StringName) -> void:
|
||||
|
|
@ -269,6 +272,33 @@ func mark_floor_tile(tile: Vector2i, material: StringName) -> void:
|
|||
return
|
||||
var atlas := Vector2i(1, 0) if material == &"dirt" else Vector2i(2, 0)
|
||||
floor_layer.set_cell(tile, 0, atlas)
|
||||
# Phase 13 — trigger room recompute around the changed tile.
|
||||
if room_detector != null:
|
||||
room_detector.recompute_around(tile)
|
||||
|
||||
|
||||
## Phase 13 — Called by Door._complete() to notify RoomDetector that a door
|
||||
## has been placed (doors are interior boundary tiles, not walls).
|
||||
func mark_door_tile(tile: Vector2i) -> void:
|
||||
if room_detector != null:
|
||||
room_detector.recompute_around(tile)
|
||||
|
||||
|
||||
## Phase 13 — Toggle a tile's no-roof designation. Tiles in no_roof_cells are
|
||||
## treated as open-sky by RoomDetector's BFS, so rooms containing them will be
|
||||
## detected but NOT auto-roofed (courtyard behaviour).
|
||||
## This is also the test-helper entry point the spec asks for:
|
||||
## World.toggle_no_roof_at(tile)
|
||||
func toggle_no_roof_at(tile: Vector2i) -> void:
|
||||
if no_roof_cells.has(tile):
|
||||
no_roof_cells.erase(tile)
|
||||
Audit.log("room", "no-roof cleared at %s" % tile)
|
||||
else:
|
||||
no_roof_cells[tile] = true
|
||||
Audit.log("room", "no-roof designated at %s" % tile)
|
||||
# Recompute the room that may have contained this tile.
|
||||
if room_detector != null:
|
||||
room_detector.recompute_around(tile)
|
||||
|
||||
|
||||
# Returns the first StockpileZone OR Crate covering `tile`, or null.
|
||||
|
|
@ -279,3 +309,52 @@ func stockpile_at_tile(tile: Vector2i):
|
|||
if sp.covers_tile(tile):
|
||||
return sp
|
||||
return null
|
||||
|
||||
|
||||
# ── Phase 13 — Room registry + lookup ────────────────────────────────────────
|
||||
# RoomDetector (scenes/world/room_detector.gd) populates this dict.
|
||||
# Keys = stable room ids (int), values = Room class instances.
|
||||
# Callers should treat this as read-only.
|
||||
|
||||
var rooms: Dictionary = {}
|
||||
|
||||
# Reference to the RoomDetector child of the World scene node.
|
||||
# Set by World._ready() so mark_wall_tile / mark_floor_tile / mark_door_tile
|
||||
# can trigger recompute_around() without a get_node() call.
|
||||
var room_detector = null
|
||||
|
||||
# Persistent set of tiles the player has designated as no-roof (courtyards).
|
||||
# Keys are Vector2i, value is unused boolean. Written by toggle_no_roof_at().
|
||||
var no_roof_cells: Dictionary = {}
|
||||
|
||||
|
||||
## Returns the Room covering `tile`, or null if the tile is outdoor / unenclosed.
|
||||
## O(rooms) bounds-checked sweep — cheap at MVP scale (< 20 rooms).
|
||||
func room_at_tile(tile: Vector2i):
|
||||
for id in rooms:
|
||||
var r = rooms[id]
|
||||
if r.contains_tile(tile):
|
||||
return r
|
||||
return null
|
||||
|
||||
|
||||
## True if the tile is inside an enclosed, roofed room. Replaces Phase 12's
|
||||
## "has floor below" shelter proxy — Pawn._is_sheltered() will reroute here once
|
||||
## RoomDetector is live.
|
||||
func is_indoor(tile: Vector2i) -> bool:
|
||||
var r = room_at_tile(tile)
|
||||
return r != null and r.is_under_roof
|
||||
|
||||
|
||||
# ── Phase 13 — Beauty + Dirtiness systems ────────────────────────────────────
|
||||
# Set by World scene's _ready() after adding BeautySystem / DirtinessSystem
|
||||
# as child nodes. All callers use World.get("beauty_system") defensively.
|
||||
|
||||
## BeautySystem child of the World scene.
|
||||
## Exposes: beauty_at(tile), register_furniture(entity), recompute_around(tile).
|
||||
var beauty_system = null
|
||||
|
||||
## DirtinessSystem child of the World scene.
|
||||
## Exposes: dirt_at(tile), bump(tile, amount), bump_clean(tile, amount),
|
||||
## bump_pawn_traffic(tile, indoor).
|
||||
var dirtiness_system = null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue