patch a different thing for OnRevealFact

This commit is contained in:
JohnCorby 2023-08-26 19:22:19 -07:00 committed by Nick
parent f4cbe67678
commit b61c25ff35
2 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,6 @@
using HarmonyLib;
using NewHorizons.Handlers;
using NewHorizons.OtherMods.AchievementsPlus;
namespace NewHorizons.Patches.ShipLogPatches
{
@ -20,5 +21,13 @@ namespace NewHorizons.Patches.ShipLogPatches
return true;
}
}
[HarmonyPostfix]
[HarmonyPatch(nameof(ShipLogFact.Reveal))]
public static void ShipLogFact_Reveal(ShipLogFact __instance)
{
StarChartHandler.OnRevealFact(__instance.GetID());
AchievementHandler.OnRevealFact();
}
}
}

View File

@ -2,7 +2,6 @@ using HarmonyLib;
using NewHorizons.Builder.ShipLog;
using NewHorizons.External;
using NewHorizons.Handlers;
using NewHorizons.OtherMods.AchievementsPlus;
using NewHorizons.Utility.OWML;
using System.Collections.Generic;
using UnityEngine;
@ -75,6 +74,7 @@ namespace NewHorizons.Patches.ShipLogPatches
[HarmonyPatch(nameof(ShipLogManager.IsFactRevealed))]
public static bool ShipLogManager_IsFactRevealed(ShipLogManager __instance, ref bool __result, string id)
{
// normally throws an error on not found
if (__instance._factDict != null && __instance._factDict.ContainsKey(id))
{
__result = __instance._factDict[id].IsRevealed();
@ -126,13 +126,5 @@ namespace NewHorizons.Patches.ShipLogPatches
return false;
}
}
[HarmonyPostfix]
[HarmonyPatch(nameof(ShipLogManager.RevealFact))]
public static void ShipLogManager_RevealFact(string id)
{
StarChartHandler.OnRevealFact(id);
AchievementHandler.OnRevealFact();
}
}
}