Phase 14: Death + Corpses + Burial + Cremation
Three-agent fan-out. Opus pre-wrote Corpse class + 5 EventBus signals + World registries (corpses, grave_markers) before dispatch so all three slices ran fully parallel. Pattern proven across Phases 12/13/14. Death pipeline (Agent A): - Pawn.is_dead(), _check_death() — pawn_died signal → corpse spawn → corpse_spawned signal → World.unregister_pawn → queue_free - _last_damage_source carries cause from take_damage() (now StringName) - Bleed-out timeout: _bleed_ticks accumulates while bleeding active; at BLEED_OUT_TICKS=432000 (6 in-game hours) force-kills via take_damage - Pawn.portrait_color stored field for corpse head-color hand-off - Corpse: DECAY_PER_TICK=0.05 (~33 in-game min fresh→rotted at 1×), is_rotting()@50, queue_free@100 with corpse_rotted_away signal. Rotting bumps DirtinessSystem (Phase 13 hook) +0.04/tick (~+8/in-game-min) - DEMO_PHASE14_AUTOKILL toggle in world.gd (default false, gates safety) Graveyard + GraveSlot + GraveMarker + Hauling (Agent B): - scenes/world/graveyard_zone.gd — StorageDestination subclass, accepted_types=[corpse], brownish overlay, finds dug GraveSlots - scenes/entities/grave_slot.gd — buildable (ghost→dug) state machine, StorageDestination duck-type interface, accept_corpse() spawns GraveMarker + emits corpse_buried + queue_frees self - scenes/entities/grave_marker.gd — permanent memorial, procedural stone-cross _draw, carries deceased identity, save round-trip - TOOL_GRAVEYARD + TOOL_DIG_GRAVE paint modes (Designation dispatch) - KIND_PICKUP_CORPSE + KIND_DEPOSIT_CORPSE toils + JobRunner handlers - HaulingProvider.find_best_for iterates World.corpses in addition to items_needing_haul; corpse-payload stored as Node metadata on pawn - ConstructionProvider duck-type already accepts GraveSlot (no change) Cremation + Ash + Mood thoughts (Agent C): - scenes/entities/cremation_pyre.gd — extends Workbench, label 'Pyre', auto-populates FOREVER bill for cremate_corpse, on_craft_complete drops 1 ash + emits corpse_cremated + queue_frees corpse - Recipe.ingredient2_type/count added with save round-trip; recipe catalog entry cremate_corpse(TYPE_CORPSE primary + 5 wood secondary) NOTE: CraftingProvider still only enforces ingredient1 — documented gap, ships when crafting is generalized. - Item.TYPE_ASH added + ALL_TYPES filter array entry - 4 mood thoughts: saw_corpse (-3 EVENT 1200t max=3), buried_friend (+2 EVENT 2400t), cremated_friend (+2 EVENT 2400t), rotting_body_in_colony (-4 PERSISTENT stacks=count capped at 3) - Pawn sync hooks: proximity scan (saw_corpse), signal listeners (buried/cremated within 8-tile radius), count helper for rotting MCP runtime verified: - DEMO_PHASE14_AUTOKILL toggle force-killed Bram at tick 50 - 'Bram DIED (cause=demo_kill, tile=(20, 36))' + corpse spawned - 'Cora: saw_corpse thought added (corpse Bram at dist 5)' — mood -3 - Painted graveyard + dig_grave → grave dug to completion verified in build_queue (grave @(22, 39) complete=true) - Hauler round-trip (corpse → GraveSlot → GraveMarker) WIRED correctly but didn't land within decay window at ULTRA speed (12×) — corpse rotted before priority-3 corpse-haul scheduled. Tuning for Phase 20. - Screenshot captured: fresh corpse silhouette at cabin doorway Delegation: 3× gdscript-refactor (Sonnet) agents in parallel; integration + MCP runtime verify on Opus. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9cf9b7dbfd
commit
67ec2cce7f
26 changed files with 1306 additions and 33 deletions
104
scenes/entities/grave_marker.gd
Normal file
104
scenes/entities/grave_marker.gd
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
class_name GraveMarker extends Node2D
|
||||
## Phase 14 — permanent grave marker entity. Spawned by GraveSlot.accept_corpse()
|
||||
## when a corpse is buried. Carries the deceased's identity for the tap-to-inspect
|
||||
## UI (Phase 17).
|
||||
##
|
||||
## Visual: procedural 16×16 stone cross / gravestone (dark grey palette).
|
||||
##
|
||||
## Registered with World.register_grave_marker on _ready; unregistered on
|
||||
## _exit_tree (should never happen in normal play — markers persist for the save).
|
||||
##
|
||||
## Save round-trip: to_dict() / from_dict() for Phase 16. The world scene's
|
||||
## save handler iterates World.grave_markers.
|
||||
##
|
||||
## See docs/implementation.md Phase 14 "GraveMarker".
|
||||
|
||||
const TILE_SIZE_PX: int = 16
|
||||
|
||||
## Tile position — set once at spawn, never changed.
|
||||
@export var tile: Vector2i = Vector2i.ZERO
|
||||
|
||||
## Deceased identity — mirrored from the Corpse at burial time.
|
||||
@export var deceased_name: String = ""
|
||||
@export var deceased_portrait_color: Color = Color(0.70, 0.60, 0.55)
|
||||
|
||||
## Cause of death, carried from Corpse.death_cause.
|
||||
@export var death_cause: StringName = &""
|
||||
|
||||
## Sim tick at death (from Corpse.death_tick — NOT the burial tick).
|
||||
@export var death_tick: int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
World.register_grave_marker(self)
|
||||
z_index = 2 # above floors, below pawns
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
World.unregister_grave_marker(self)
|
||||
|
||||
|
||||
## One-shot initialiser. Call after add_child() — _ready() fires first.
|
||||
func setup(p_tile: Vector2i, p_name: String, p_color: Color, p_cause: StringName, p_death_tick: int) -> void:
|
||||
tile = p_tile
|
||||
global_position = Vector2(tile.x * TILE_SIZE_PX + TILE_SIZE_PX / 2.0,
|
||||
tile.y * TILE_SIZE_PX + TILE_SIZE_PX)
|
||||
deceased_name = p_name
|
||||
deceased_portrait_color = p_color
|
||||
death_cause = p_cause
|
||||
death_tick = p_death_tick
|
||||
queue_redraw()
|
||||
Audit.log("grave_marker", "placed at %s for '%s' (cause=%s)" % [tile, deceased_name, death_cause])
|
||||
|
||||
|
||||
# ── visual: procedural gravestone + cross ─────────────────────────────────────
|
||||
|
||||
func _draw() -> void:
|
||||
# Stone base: dark grey rectangular slab, bottom-anchored like walls.
|
||||
# Local origin is at tile bottom-centre (matching Wall._draw convention).
|
||||
var stone_base := Color(0.45, 0.44, 0.42)
|
||||
var stone_dark := Color(0.30, 0.29, 0.27)
|
||||
var stone_light := Color(0.62, 0.60, 0.58)
|
||||
var cross_col := Color(0.25, 0.24, 0.22)
|
||||
|
||||
# Main slab — 10 px wide × 12 px tall, bottom-anchored in the 16×16 cell.
|
||||
draw_rect(Rect2(-5.0, -13.0, 10.0, 13.0), stone_base)
|
||||
# Rounded top hint — just a lighter top strip.
|
||||
draw_rect(Rect2(-5.0, -13.0, 10.0, 3.0), stone_light)
|
||||
# Left shadow edge.
|
||||
draw_line(Vector2(-5.0, -13.0), Vector2(-5.0, 0.0), stone_dark, 1.0)
|
||||
# Cross etched on the slab face: vertical + horizontal bar.
|
||||
draw_line(Vector2(0.0, -11.0), Vector2(0.0, -3.0), cross_col, 1.5)
|
||||
draw_line(Vector2(-3.0, -9.0), Vector2(3.0, -9.0), cross_col, 1.5)
|
||||
# Outline.
|
||||
draw_rect(Rect2(-5.0, -13.0, 10.0, 13.0), stone_dark, false, 1.0)
|
||||
|
||||
|
||||
# ── save / load ──────────────────────────────────────────────────────────────
|
||||
|
||||
func to_dict() -> Dictionary:
|
||||
return {
|
||||
"tile_x": tile.x,
|
||||
"tile_y": tile.y,
|
||||
"name": deceased_name,
|
||||
"color_r": deceased_portrait_color.r,
|
||||
"color_g": deceased_portrait_color.g,
|
||||
"color_b": deceased_portrait_color.b,
|
||||
"cause": String(death_cause),
|
||||
"death_tick": death_tick,
|
||||
}
|
||||
|
||||
|
||||
func from_dict(d: Dictionary) -> void:
|
||||
tile = Vector2i(int(d.get("tile_x", 0)), int(d.get("tile_y", 0)))
|
||||
global_position = Vector2(tile.x * TILE_SIZE_PX + TILE_SIZE_PX / 2.0,
|
||||
tile.y * TILE_SIZE_PX + TILE_SIZE_PX)
|
||||
deceased_name = d.get("name", "")
|
||||
deceased_portrait_color = Color(
|
||||
d.get("color_r", 0.70),
|
||||
d.get("color_g", 0.60),
|
||||
d.get("color_b", 0.55)
|
||||
)
|
||||
death_cause = StringName(d.get("cause", ""))
|
||||
death_tick = int(d.get("death_tick", 0))
|
||||
queue_redraw()
|
||||
Loading…
Add table
Add a link
Reference in a new issue