0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
chomp 1e238c426e 0.13.5.0 (!33)
Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Co-authored-by: CWX <CWX@noreply.dev.sp-tarkov.com>
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-authored-by: RaiRaiTheRaichu <rairaitheraichu@noreply.dev.sp-tarkov.com>
Co-authored-by: CWX <cwx@noreply.dev.sp-tarkov.com>
Co-authored-by: Kaeno <e>
Reviewed-on: SPT-AKI/Modules#33
2023-10-10 10:58:33 +00:00

37 lines
1.2 KiB
C#

using EFT;
using Comfort.Common;
using System.Reflection;
using Aki.Reflection.Patching;
using System.Collections;
using EFT.HealthSystem;
namespace Aki.SinglePlayer.Patches.RaidFix
{
public class TinnitusFixPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(BetterAudio).GetMethod("StartTinnitusEffect", BindingFlags.Instance | BindingFlags.Public);
}
// checks on invoke whether the player is stunned before allowing tinnitus
[PatchPrefix]
static bool PatchPrefix()
{
bool shouldInvoke = typeof(ActiveHealthController)
.GetMethod("FindActiveEffect", BindingFlags.Instance | BindingFlags.Public)
.MakeGenericMethod(typeof(ActiveHealthController)
.GetNestedType("Stun", BindingFlags.Instance | BindingFlags.NonPublic))
.Invoke(Singleton<GameWorld>.Instance.MainPlayer.ActiveHealthController, new object[] { EBodyPart.Common }) != null;
return shouldInvoke;
}
// prevent null coroutine exceptions
static IEnumerator CoroutinePassthrough()
{
yield return null;
yield break;
}
}
}