mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
20 lines
736 B
C#
20 lines
736 B
C#
using HarmonyLib;
|
|
|
|
namespace NewHorizons.Patches
|
|
{
|
|
[HarmonyPatch]
|
|
public static class InvincibilityPatches
|
|
{
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(typeof(DeathManager), nameof(DeathManager.KillPlayer))]
|
|
[HarmonyPatch(typeof(PlayerResources), nameof(PlayerResources.ApplyInstantDamage))]
|
|
[HarmonyPatch(typeof(PlayerImpactAudio), nameof(PlayerImpactAudio.OnImpact))]
|
|
public static bool DeathManager_KillPlayer_Prefix()
|
|
{
|
|
// Base game _invincible is still overriden by high speed impacts
|
|
// We also are avoiding playing impact related effects by just skipping these methods
|
|
return !(Locator.GetDeathManager()?._invincible ?? false);
|
|
}
|
|
}
|
|
}
|