0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
Dev 181f2328a5 Updated to support
One error left that prevents build: LighthouseProgressionClass.cs
2023-07-07 10:37:47 +01:00

36 lines
1.2 KiB
C#

using EFT;
using Comfort.Common;
using System.Reflection;
using Aki.Reflection.Patching;
using System.Collections;
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(ActiveHealthControllerClass)
.GetMethod("FindActiveEffect", BindingFlags.Instance | BindingFlags.Public)
.MakeGenericMethod(typeof(ActiveHealthControllerClass)
.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;
}
}
}