This commit is contained in:
Noah Pilarski 2022-11-26 15:45:16 -05:00
parent 22ab1b4381
commit 6847471536
2 changed files with 6 additions and 12 deletions

View File

@ -13,11 +13,15 @@ namespace NewHorizons.OtherMods.AchievementsPlus.NH
public static void Init()
{
AchievementHandler.Register(UNIQUE_ID, false, Main.Instance);
GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnPlayerDeath);
}
public static void Earn()
public static void OnPlayerDeath(DeathType deathType)
{
AchievementHandler.Earn(UNIQUE_ID);
if (deathType == DeathType.Energy && Locator.GetPlayerDetector().GetComponent<FluidDetector>()._activeVolumes.Any(fluidVolume => fluidVolume is TornadoFluidVolume or TornadoBaseFluidVolume or HurricaneFluidVolume))
{
AchievementHandler.Earn(UNIQUE_ID);
}
}
}
}

View File

@ -8,16 +8,6 @@ namespace NewHorizons.Patches
[HarmonyPatch]
public static class AchievementPatches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(DeathManager), nameof(DeathManager.KillPlayer))]
public static void DeathManager_KillPlayer(DeathType deathType)
{
if (deathType == DeathType.Energy && Locator.GetPlayerDetector().GetComponent<FluidDetector>()._activeVolumes.Any(fluidVolume => fluidVolume is TornadoFluidVolume or TornadoBaseFluidVolume or HurricaneFluidVolume))
{
SuckedIntoLavaByTornadoAchievement.Earn();
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ProbeDestructionDetector), nameof(ProbeDestructionDetector.FixedUpdate))]
public static bool ProbeDestructionDetector_FixedUpdate(ProbeDestructionDetector __instance)