fix(simulation): fix triangle state save/load and persist contamination

Three save/load bugs fixed:
- ContaminationActive not persisted in SaveStateV1 — caused double-fire
  of contamination pressure on reload after tick 300.
- Loaded triangle entities missing ActiveSim marker — made them
  invisible to escalation and contamination systems after any load.
- Existing triangle entities not despawned before load — created
  duplicates, doubling tension escalation per tick.

Also: HashSet → BTreeSet for D-010 compliance, defensive event queue
reset on load, and three regression tests for triangle roundtrip.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 23:24:56 +01:00
co-authored by Claude Opus 4.6
parent 70de959ac3
commit 339f112c8f
4 changed files with 160 additions and 6 deletions
@@ -419,6 +419,7 @@ fn minimal_save() -> SaveStateV1 {
triangle_states: vec![],
open_doors: vec![],
modifications: vec![],
contamination_active: false,
}
}
+1
View File
@@ -207,6 +207,7 @@ fn save_state_npc_kg_isolation() {
triangle_states: vec![],
open_doors: vec![],
modifications: vec![],
contamination_active: false,
};
// Roundtrip: serialize → deserialize.