Implement world memory filtering in AgentHarness to ensure character kills/deaths are excluded from World Memory. Update Chronicle documentation for clarity and remove obsolete legend promotion logic. Adjust test scenarios to validate new world memory behavior.

This commit is contained in:
DazedAnon 2026-07-14 22:06:50 -05:00
parent 7876321391
commit 88cf59a6aa
4 changed files with 34 additions and 44 deletions

View file

@ -1518,6 +1518,33 @@ public static class AgentHarness
detail = $"ageId='{Chronicle.CurrentAgeId}' ageName='{Chronicle.CurrentAgeName}' memory={Chronicle.MemoryCount}";
break;
}
case "world_memory_world_only":
{
// World tab must not mix in character Kill/Death/Lover rows.
IReadOnlyList<ChronicleEntry> snap = Chronicle.SnapshotMemory();
int bad = 0;
int worldRows = 0;
for (int i = 0; i < snap.Count; i++)
{
ChronicleEntry e = snap[i];
if (e == null || e.Kind == ChronicleKind.AgeChapter)
{
continue;
}
if (e.Kind == ChronicleKind.World)
{
worldRows++;
continue;
}
bad++;
}
pass = bad == 0;
detail = $"badKinds={bad} worldRows={worldRows} memory={snap.Count}";
break;
}
case "dossier_favorite":
case "is_favorite":
{

View file

@ -53,7 +53,7 @@ public sealed class ChronicleEntry
public string AssetId = "";
public string AgeId = "";
public string AgeName = "";
/// <summary>True when this row is a curated character legend in World Memory.</summary>
/// <summary>True when this row is styled as a highlighted World Memory landmark.</summary>
public bool IsLegend;
/// <summary>Vanilla <see cref="AttackType"/> name when <see cref="Kind"/> is Death.</summary>
public string AttackTypeName = "";
@ -960,7 +960,7 @@ public static class Chronicle
ChronicleHud.UpdateLive();
}
/// <summary>Killer POV - character history only (may promote to Memory if notable).</summary>
/// <summary>Killer POV - character history only.</summary>
public static void NoteKill(Actor killer, Actor victim)
{
if (!ModSettings.ChronicleEnabled || killer == null || victim == null)
@ -1723,46 +1723,6 @@ public static class Chronicle
}
LogService.LogInfo($"[IdleSpectator][CHRONICLE][History:{subjectId}] {entry.DisplayLine}");
if (ShouldPromoteLegend(kind, subject, other))
{
AppendLandmark(
kind,
subject,
other,
line,
lore,
subject.current_position,
"legend:" + kind,
isLegend: true);
}
}
private static bool ShouldPromoteLegend(ChronicleKind kind, Actor subject, Actor other)
{
if (kind == ChronicleKind.Other || kind == ChronicleKind.AgeChapter)
{
return false;
}
return IsNotable(subject) || IsNotable(other);
}
private static bool IsNotable(Actor actor)
{
if (actor == null)
{
return false;
}
try
{
return actor.isFavorite() || actor.isKing() || actor.isCityLeader();
}
catch
{
return false;
}
}
private static void AppendLandmark(

View file

@ -440,6 +440,8 @@ internal static class HarnessScenarios
Step("ch16f", "assert", expect: "chronicle_latest_contains", value: "Drown"),
Step("ch16g", "chronicle_death_sample", value: "Fire"),
Step("ch16h", "assert", expect: "chronicle_latest_contains", value: "Burned"),
// Character kills/deaths must stay on character history, not World Memory.
Step("ch16i", "assert", expect: "world_memory_world_only"),
// World Memory landmarks (replaces History|World tabs)
Step("ch17a", "chronicle_world_force", label: "War: harness_alpha vs harness_beta"),
@ -447,6 +449,7 @@ internal static class HarnessScenarios
Step("ch17c", "assert", expect: "world_memory_contains", value: "harness_alpha"),
Step("ch17d", "assert", expect: "chronicle_latest_contains", value: "Burned"),
Step("ch17e", "assert", expect: "world_memory_age"),
Step("ch17e2", "assert", expect: "world_memory_world_only"),
// Selecting a world event pans to its recorded place (even with no unit there).
Step("ch17j", "lore_jump_world"),
Step("ch17k", "wait", wait: 0.2f),

View file

@ -1,7 +1,7 @@
{
"name": "IdleSpectator",
"author": "dazed",
"version": "0.12.16",
"description": "AFK Idle Spectator (I) + Lore (L). World events pan to location; Living/Fallen tabs.",
"version": "0.12.17",
"description": "AFK Idle Spectator (I) + Lore (L). World tab is world events only.",
"GUID": "com.dazed.idlespectator"
}