Bug-triage patch — fix torch builds, idle-pawn traps, floor render order
Three playtest-reported bugs fixed out-of-phase before Phase 18: * Furniture build-queue gap: Torch / Bed / Crate / Workbench / CremationPyre were missing World.register_build_site(self) in _ready, so newly-painted designations never entered ConstructionProvider's iteration. The seeded cabin pre-built everything via _spawn_complete_* helpers, masking the gap until a player painted a fresh furniture designation. * Wall-trap regression for bystanders + walk-through pawns: Wall._complete now dislodges any pawn on the tile via new Pathfinder.find_nearest_walkable BFS helper; Pawn._advance_walk re-checks next tile walkability before stepping, aborts walk + cancels job + lets Decision reroute. Phase 6's adjacent-stand fix only protected the BUILDING pawn. * Floor / Pawn Y-sort ambiguity: Floor was anchored at tile-center (same Y as Pawn), so Y-sort tiebreak fell to scene-tree order and Floor (spawned later) drew over Pawn. Moved Floor origin to top-of-tile so Floor.y < Pawn.y under Y-sort; _draw rect offsets compensate. All three verified via MCP runtime: torch built end-to-end, all 3 pawns working on different jobs with no idle traps, pawn renders over floor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d41778a483
commit
922f269a6c
9 changed files with 97 additions and 14 deletions
|
|
@ -50,10 +50,12 @@ func _exit_tree() -> void:
|
|||
func setup(p_tile: Vector2i, p_material: StringName) -> void:
|
||||
tile = p_tile
|
||||
floor_material = p_material
|
||||
# Floor renders at tile centre (not bottom-anchored).
|
||||
# Top-anchor (origin at tile's top edge) so Y-sort places the floor under
|
||||
# pawns standing on the same tile (pawns anchor at mid-tile, so pawn.y > floor.y).
|
||||
# _draw offsets compensate (rects span y=0..TILE_SIZE_PX, not -half..+half).
|
||||
position = Vector2(
|
||||
tile.x * TILE_SIZE_PX + TILE_SIZE_PX / 2.0,
|
||||
tile.y * TILE_SIZE_PX + TILE_SIZE_PX / 2.0
|
||||
tile.y * TILE_SIZE_PX
|
||||
)
|
||||
queue_redraw()
|
||||
Audit.log("floor", "%s floor ghost placed at %s" % [floor_material, tile])
|
||||
|
|
@ -124,40 +126,43 @@ func _draw() -> void:
|
|||
|
||||
|
||||
func _draw_wood_floor(alpha: float, half: float) -> void:
|
||||
# Top-anchored origin: rect spans (-half, 0) to (+half, TILE_SIZE_PX).
|
||||
var base := Color(0.58, 0.40, 0.20, alpha)
|
||||
var plank := Color(0.50, 0.34, 0.16, alpha)
|
||||
|
||||
draw_rect(Rect2(Vector2(-half, -half), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), base)
|
||||
draw_rect(Rect2(Vector2(-half, 0.0), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), base)
|
||||
|
||||
# Horizontal plank lines.
|
||||
for y_offset in [-3.0, 2.0]:
|
||||
# Horizontal plank lines (offsets are from tile centre = +half from origin).
|
||||
for y_offset in [5.0, 10.0]:
|
||||
draw_line(
|
||||
Vector2(-half, y_offset),
|
||||
Vector2(half, y_offset),
|
||||
plank, 1.0
|
||||
)
|
||||
|
||||
draw_rect(Rect2(Vector2(-half, -half), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), Color(0.0, 0.0, 0.0, 0.3 * alpha), false, 1.0)
|
||||
draw_rect(Rect2(Vector2(-half, 0.0), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), Color(0.0, 0.0, 0.0, 0.3 * alpha), false, 1.0)
|
||||
|
||||
|
||||
func _draw_stone_floor(alpha: float, half: float) -> void:
|
||||
# Top-anchored origin: rect spans (-half, 0) to (+half, TILE_SIZE_PX).
|
||||
var base := Color(0.60, 0.60, 0.57, alpha)
|
||||
var joint := Color(0.45, 0.45, 0.43, alpha)
|
||||
|
||||
draw_rect(Rect2(Vector2(-half, -half), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), base)
|
||||
draw_rect(Rect2(Vector2(-half, 0.0), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), base)
|
||||
|
||||
# Stone tile grid lines.
|
||||
draw_line(Vector2(0.0, -half), Vector2(0.0, half), joint, 1.0)
|
||||
draw_line(Vector2(-half, 0.0), Vector2(half, 0.0), joint, 1.0)
|
||||
# Stone tile grid lines (cross at tile centre).
|
||||
draw_line(Vector2(0.0, 0.0), Vector2(0.0, TILE_SIZE_PX), joint, 1.0)
|
||||
draw_line(Vector2(-half, half), Vector2(half, half), joint, 1.0)
|
||||
|
||||
draw_rect(Rect2(Vector2(-half, -half), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), Color(0.0, 0.0, 0.0, 0.3 * alpha), false, 1.0)
|
||||
draw_rect(Rect2(Vector2(-half, 0.0), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), Color(0.0, 0.0, 0.0, 0.3 * alpha), false, 1.0)
|
||||
|
||||
|
||||
func _draw_dirt_floor(alpha: float, half: float) -> void:
|
||||
# Top-anchored origin: rect spans (-half, 0) to (+half, TILE_SIZE_PX).
|
||||
var base := Color(0.42, 0.30, 0.18, alpha)
|
||||
|
||||
draw_rect(Rect2(Vector2(-half, -half), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), base)
|
||||
draw_rect(Rect2(Vector2(-half, -half), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), Color(0.0, 0.0, 0.0, 0.25 * alpha), false, 1.0)
|
||||
draw_rect(Rect2(Vector2(-half, 0.0), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), base)
|
||||
draw_rect(Rect2(Vector2(-half, 0.0), Vector2(TILE_SIZE_PX, TILE_SIZE_PX)), Color(0.0, 0.0, 0.0, 0.25 * alpha), false, 1.0)
|
||||
|
||||
|
||||
# ── internal ───────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue