Phase 5 cabin polish — door, floor, interior crate, double-render fix

Make the demo cabin readable as a real building so the rendering pattern
is solid before Phase 6+ adds more building types.

Demo seed (world.gd._seed_phase5_demo_buildings):
- 8×6 stone cabin at (44, 23) — 23 walls (perimeter minus door slot) +
  1 door (south wall centre at (47, 28)) + 24 wood-floor designations
  for the interior. ConstructionProvider picks them all up; pawns build
  the whole thing.
- One pre-built crate inside at (50, 24) so the interior reads as a
  furnished room on first frame.
- Two external stockpile-target crates unchanged at (17, 60) / (18, 60).

Door visual rewrite (door.gd):
- Was the old 16×24 bottom-anchored shape that encroached on the cell
  above. Now fits strictly within its 16×16 tile, matching the wall's
  3/4 band layout (5 px lit lintel + 11 px shaded frame + inset panel
  + hinge dot). Door and walls now share a top horizon line so they
  line up visually.

Designation gained TOOL_BUILD_DOOR + atlas mapping; world.gd's
_on_designation_added now branches on build_door to spawn a Door entity.

THE DOUBLE-RENDER BUG (caught by MCP inspection):
- World.mark_floor_tile stamps the Floor TileMap with atlas (2, 0) which
  is *stone-grey* in the placeholder atlas, regardless of material name.
- The Floor TileMap layer was visible=true with z_index=1, so it drew
  ON TOP of the brown Floor entity sprites underneath.
- Result before fix: interior tiles looked gray-stone, not wood.
- Fix: set Floor TileMap layer visible=false (data-only, same as Wall).
  Entities own the visual; the TileMap retains tile-level data for
  Phase 13's room detection + Phase 16's save format.

Pattern locked for future building types: 'render at entity level,
TileMap layers are data-only'. Phase 13's roof and any future wall
materials follow the same template.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-10 22:46:27 +01:00
parent 6d04c8229b
commit 96f4982dd3
4 changed files with 69 additions and 26 deletions

View file

@ -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 ───────────────────────────────────────────────────────────────────