LifecycleSystem¶
LifecycleSystem
| Phase · priority | Event |
| Reads | hunger, temperature at the NPC's location, on Mortal nodes |
| Writes | DestroyNode; drops carried items into the location; event npc_death { cause } |
| Settings | LethalHeat (°C), death at hunger ≥ 100 |
| Status | designed · Phase 1 (#34) |
| PLAN | §15 (Phase 0 scope), §5.5 (aging later), §13.5 |
| Player | Death |
Ends NPCs. In Phase 1, two causes: starvation (hunger at its upper bound) and lethal heat (the location's temperature above LethalHeat). Runs in the Event phase so it sees the tick's Environment and Agency results.
foreach (var npc in view.NodesWithComponent("Mortal"))
{
var cause = view.GetOrDefault(npc, "hunger", 0f) >= 100 ? "starvation"
: view.GetOrDefault(loc, "temperature", 0f) >= s.LethalHeat ? "lethal_heat" : null;
if (cause is null) continue;
foreach (var item in view.GetContents(npc)) yield return new AddEdgeIntent(loc, item, "contains"); // drop everything
yield return new DestroyNodeIntent(npc) { Inputs = … };
yield return new SimulationEvent("npc_death", npc, loc, data: { cause });
}
The trace's destroyed-node record keeps the NPC's kind, template, name and components at death, so the feed can say Mira didn't make it out of the smithy and her History still renders after the node is gone.
Later: birth and aging in sim-years (Survival phase) read world_time, not tick counts. Hot-toggle: off, NPCs accumulate starvation or heat without dying — useful for watching a mechanism without losing anyone.
History¶
| Phase | Change |
|---|---|
| 1 | Introduced: starvation and lethal heat; inventory dropped; destroyed-node summary in the trace. |
See also: HungerSystem · Causal trace