worldbox-observer-mod/IdleSpectator/ActorChroniclePatches.cs
DazedAnon 739cc6492c feat(spectator): make narrative threads own camera direction
- Route confirmed life events into evidence-based threads, consequences, and Legacy chapters
- Schedule episode shots with critical interrupts, replay guards, and a combat budget
- Admit emerging main characters through story momentum instead of spectacle
- Remove causal heat, hard-arc memory writes, and synthetic epilogue continuity
- Expand narrative harness coverage, soak auditing, and product documentation
2026-07-23 12:17:18 -05:00

84 lines
2.6 KiB
C#

using HarmonyLib;
namespace IdleSpectator;
/// <summary>
/// Feeds character History from kills, deaths, lovers, and best friends.
/// </summary>
[HarmonyPatch]
public static class ActorChroniclePatches
{
[HarmonyPatch(typeof(Actor), "newKillAction")]
[HarmonyPostfix]
public static void PostfixNewKill(Actor __instance, Actor pDeadUnit)
{
LifeSagaMemory.RecordKill(__instance, pDeadUnit);
NarrativeDevelopmentRouter.Kill(__instance, pDeadUnit, "newKillAction");
Chronicle.NoteKill(__instance, pDeadUnit);
}
[HarmonyPatch(typeof(Actor), "die")]
[HarmonyPrefix]
public static void PrefixDie(Actor __instance, out Actor __state)
{
__state = null;
try
{
if (__instance == null)
{
return;
}
// Capture living dossier before die() clears state - used by Fallen archive.
Chronicle.CaptureFinalDossier(__instance);
BaseSimObject attacker = __instance.attackedBy;
if (attacker != null && !attacker.isRekt() && attacker.isActor() && attacker != __instance)
{
__state = attacker.a;
}
}
catch
{
__state = null;
}
}
[HarmonyPatch(typeof(Actor), "die")]
[HarmonyPostfix]
public static void PostfixDie(Actor __instance, AttackType pType, bool pCountDeath, Actor __state)
{
if (!pCountDeath || __instance == null)
{
return;
}
LifeSagaMemory.RecordDeath(__instance, __state, pType.ToString());
NarrativeDevelopmentRouter.Death(__instance, __state, pType.ToString(), "die");
Chronicle.NoteDeath(__instance, pType, __state);
GraveMarkers.AddDeath(__instance);
}
[HarmonyPatch(typeof(Actor), nameof(Actor.becomeLoversWith))]
[HarmonyPostfix]
public static void PostfixLovers(Actor __instance, Actor pTarget)
{
LifeSagaMemory.RecordBondFormed(__instance, pTarget, "becomeLoversWith");
NarrativeDevelopmentRouter.BondFormed(__instance, pTarget, "becomeLoversWith");
Chronicle.NoteLovers(__instance, pTarget);
}
[HarmonyPatch(typeof(Actor), nameof(Actor.setBestFriend))]
[HarmonyPostfix]
public static void PostfixBestFriend(Actor __instance, Actor pActor, bool pNew)
{
if (!pNew)
{
return;
}
LifeSagaMemory.RecordFriendFormed(__instance, pActor);
NarrativeDevelopmentRouter.FriendFormed(__instance, pActor, "setBestFriend");
Chronicle.NoteBestFriends(__instance, pActor);
}
}