- Keep LifeSagaSession across Clear; wipe on map load/clear with bind key - Soft-bias Prefer/cross-MC/cast and prefer roster MCs in aftermath/recover/park - Resolve war/plot principals plus discrete/WorldLog labels from live libraries - Amortize roster world scans, gate Relayout, and add hitch probe/save-slot helpers
36 lines
856 B
C#
36 lines
856 B
C#
using HarmonyLib;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
/// <summary>Reset life-saga session when the live map finishes loading or is cleared.</summary>
|
|
[HarmonyPatch]
|
|
public static class LifeSagaSessionPatches
|
|
{
|
|
[HarmonyPatch(typeof(MapBox), nameof(MapBox.finishingUpLoading))]
|
|
[HarmonyPostfix]
|
|
public static void PostfixFinishingUpLoading()
|
|
{
|
|
try
|
|
{
|
|
LifeSagaSession.OnWorldLoadFinished();
|
|
}
|
|
catch
|
|
{
|
|
// Load path must not throw into the game.
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(MapBox), nameof(MapBox.clearWorld))]
|
|
[HarmonyPrefix]
|
|
public static void PrefixClearWorld()
|
|
{
|
|
try
|
|
{
|
|
LifeSagaSession.ResetForWorldChange("clear-world");
|
|
}
|
|
catch
|
|
{
|
|
// Teardown path must not throw into the game.
|
|
}
|
|
}
|
|
}
|