diff --git a/scenes/entities/door.gd b/scenes/entities/door.gd index 663d071..1d85e73 100644 --- a/scenes/entities/door.gd +++ b/scenes/entities/door.gd @@ -106,25 +106,29 @@ static func from_dict(d: Dictionary) -> Dictionary: # ── render ───────────────────────────────────────────────────────────────────── func _draw() -> void: - # Door: 16 px wide, 24 px tall, bottom-anchored. Origin at bottom-centre. - # (Shorter than the full 32 px wall height — visually reads as a door opening.) + # 3/4-perspective door — fits strictly within the tile (16×16) so it + # slots cleanly between adjacent walls. Origin (0,0) is at the tile's + # bottom-centre. Tile spans local Y: -16 to 0. var alpha: float = 1.0 if _completed else 0.4 + # Matches Wall's 3/4-band layout so doors and walls share a top horizon. + var lintel_color := Color(0.55, 0.40, 0.22, alpha) # stone-warmed top lintel var frame_color := Color(0.32, 0.22, 0.10, alpha) var panel_color := Color(0.52, 0.36, 0.18, alpha) var hinge_color := Color(0.20, 0.18, 0.16, alpha) + var outline := Color(0.16, 0.10, 0.04, 0.7 * alpha) - # Door frame (slightly wider than the panel). - draw_rect(Rect2(Vector2(-8.0, -24.0), Vector2(16.0, 24.0)), frame_color) - - # Door panel (inset 2 px on each side). - draw_rect(Rect2(Vector2(-6.0, -22.0), Vector2(12.0, 20.0)), panel_color) - - # Hinge dot on the left side. - draw_circle(Vector2(-6.0, -18.0), 1.5, hinge_color) - - # Outline. - draw_rect(Rect2(Vector2(-8.0, -24.0), Vector2(16.0, 24.0)), Color(0.0, 0.0, 0.0, 0.5 * alpha), false, 1.0) + # Top lintel band (matches wall top-face height of 5 px so it lines up). + draw_rect(Rect2(Vector2(-8.0, -16.0), Vector2(16.0, 5.0)), lintel_color) + # Door frame — fills the front-face band (matches wall front 11 px). + draw_rect(Rect2(Vector2(-8.0, -11.0), Vector2(16.0, 11.0)), frame_color) + # Door panel (inset 1 px each side, leaves 2 px frame visible left/right). + draw_rect(Rect2(Vector2(-6.0, -10.0), Vector2(12.0, 10.0)), panel_color) + # Hinge dot. + draw_circle(Vector2(-5.0, -5.0), 1.0, hinge_color) + # Top/bottom borders + tile outline. + draw_line(Vector2(-8.0, -11.0), Vector2(8.0, -11.0), Color(0.20, 0.14, 0.06, alpha), 1.0) + draw_rect(Rect2(Vector2(-8.0, -16.0), Vector2(16.0, 16.0)), outline, false, 1.0) # ── internal ─────────────────────────────────────────────────────────────────── diff --git a/scenes/world/designation.gd b/scenes/world/designation.gd index 11ce220..cdec554 100644 --- a/scenes/world/designation.gd +++ b/scenes/world/designation.gd @@ -16,12 +16,15 @@ class_name Designation const TOOL_NONE: StringName = &"none" const TOOL_BUILD_WALL: StringName = &"build_wall" const TOOL_BUILD_FLOOR: StringName = &"build_floor" +const TOOL_BUILD_DOOR: StringName = &"build_door" # Atlas coords on the shared placeholder tileset (source 0). # build_wall → stone-grey (2, 0); build_floor → dirt-brown (1, 0). +# build_door → dark stone (3, 0) so the ghost reads visually distinct from walls. const _ATLAS_BY_TOOL: Dictionary = { &"build_wall": Vector2i(2, 0), &"build_floor": Vector2i(1, 0), + &"build_door": Vector2i(3, 0), } # Placeholder source ID — mirrors World.PLACEHOLDER_SOURCE_ID. @@ -60,7 +63,7 @@ func bind(paint_layer: TileMapLayer, selection: Selection = null) -> void: ## Activate a paint tool. Pass TOOL_NONE to deactivate. func set_active_tool(tool: StringName) -> void: assert( - tool in [TOOL_NONE, TOOL_BUILD_WALL, TOOL_BUILD_FLOOR], + tool in [TOOL_NONE, TOOL_BUILD_WALL, TOOL_BUILD_FLOOR, TOOL_BUILD_DOOR], "Designation.set_active_tool: unknown tool '%s'" % tool ) _tool = tool diff --git a/scenes/world/world.gd b/scenes/world/world.gd index eb843de..c28ee45 100644 --- a/scenes/world/world.gd +++ b/scenes/world/world.gd @@ -215,33 +215,64 @@ func _spawn_sample_harvestables() -> void: func _seed_phase5_demo_buildings() -> void: - # Pre-queue a small cabin outline as build designations so pawns visibly - # construct walls when they exit Chop/Mine work. Phase 17 will add real - # player-driven designation UI; for now the player sees the construction - # loop without needing to paint anything. + # Pre-queue a furnished cabin so the construction loop runs end-to-end + # without needing player-paint UI (deferred to Phase 17). # - # Layout: 8×6 wall ring at (44, 23) — interior 6×4 = 24 cells of real room. + # Layout — 8×6 stone cabin at (44, 23), south door, wood floor inside: + # • Perimeter walls (skipping the door slot) + # • Door at (47, 28) — middle of the south wall + # • Wood floor across the 6×4 interior + # • One pre-built crate inside (north-east corner of the interior) + # • Two stockpile-target crates outside (Phase 4 hauling target) var origin := Vector2i(44, 23) var w := 8 var h := 6 + var door_x := w / 2 - 1 # 3 → tile (47, y_bottom). Centred door. + var door_tile := origin + Vector2i(door_x, h - 1) + + # Perimeter walls — skip the door slot in the bottom row. + var wall_count := 0 for x in w: EventBus.designation_added.emit(origin + Vector2i(x, 0), Designation.TOOL_BUILD_WALL) - EventBus.designation_added.emit(origin + Vector2i(x, h - 1), Designation.TOOL_BUILD_WALL) - for y in h: + wall_count += 1 + var bottom_tile := origin + Vector2i(x, h - 1) + if bottom_tile != door_tile: + EventBus.designation_added.emit(bottom_tile, Designation.TOOL_BUILD_WALL) + wall_count += 1 + for y in range(1, h - 1): # left + right cols, skip corners (already painted as top/bottom rows) EventBus.designation_added.emit(origin + Vector2i(0, y), Designation.TOOL_BUILD_WALL) EventBus.designation_added.emit(origin + Vector2i(w - 1, y), Designation.TOOL_BUILD_WALL) - # Place a couple of crates at known tiles so the haul system has a target. + wall_count += 2 + + # Door at south wall centre. + EventBus.designation_added.emit(door_tile, Designation.TOOL_BUILD_DOOR) + + # Wood floor across the interior — 6×4 = 24 cells. + var floor_count := 0 + for x in range(1, w - 1): + for y in range(1, h - 1): + EventBus.designation_added.emit(origin + Vector2i(x, y), Designation.TOOL_BUILD_FLOOR) + floor_count += 1 + + # Pre-built crate inside the cabin (top-right corner of interior). + # Auto-built so the cabin shows furnished on first frame. + var interior_crate: Crate = CRATE_SCENE.instantiate() + add_child(interior_crate) + interior_crate.setup(origin + Vector2i(w - 2, 1)) # (50, 24) + while interior_crate.is_buildable(): + interior_crate.on_build_tick() + + # Two external stockpile-target crates south-west (Phase 4 haul destination). var crate_tiles: Array[Vector2i] = [Vector2i(17, 60), Vector2i(18, 60)] for t in crate_tiles: var c: Crate = CRATE_SCENE.instantiate() add_child(c) c.setup(t) - # Mark crate as already-built for the demo (skip the construction phase). - # Phase 17 player UI flow would walk it through a build designation first. while c.is_buildable(): c.on_build_tick() - Audit.log("world", "phase 5 demo: %d wall designations seeded + %d crates built" % [ - w * 2 + h * 2 - 4, crate_tiles.size() + + Audit.log("world", "phase 5 demo: %d walls + 1 door + %d floors queued; %d crates pre-built" % [ + wall_count, floor_count, 1 + crate_tiles.size() ]) @@ -289,6 +320,10 @@ func _on_designation_added(cell: Vector2i, tool: StringName) -> void: entity = FLOOR_SCENE.instantiate() add_child(entity) entity.setup(cell, &"wood") + &"build_door": + entity = DOOR_SCENE.instantiate() + add_child(entity) + entity.setup(cell) _: Audit.log("world", "unknown designation tool: %s" % tool) return diff --git a/scenes/world/world.tscn b/scenes/world/world.tscn index b135898..fb01bdc 100644 --- a/scenes/world/world.tscn +++ b/scenes/world/world.tscn @@ -20,6 +20,7 @@ z_index = 0 [node name="Floor" type="TileMapLayer" parent="."] z_index = 1 +visible = false [node name="Wall" type="TileMapLayer" parent="."] z_index = 2