0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 08:50:43 -05:00
modules/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs

42 lines
1.1 KiB
C#

using HarmonyLib;
using SPT.Reflection.Patching;
using System;
using System.Reflection;
namespace SPT.Custom.Patches
{
/// <summary>
/// BSG has had the wonderful idea of not letting grenades explode.
/// Waiting on BSG Fix.
/// </summary>
public class StunGrenadeExplosionPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(ObservedStunGrenade), nameof(ObservedStunGrenade.StartTimer));
}
[PatchPrefix]
private static bool PatchPrefix(ObservedStunGrenade __instance, float ___float_4)
{
__instance.StartBehaviourTimer(__instance.WeaponSource.GetExplDelay - ___float_4, new Action(__instance.InvokeBlowUpEvent));
return false;
}
}
public class GrenadeExplosionPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(ObservedGrenade), nameof(ObservedGrenade.StartTimer));
}
[PatchPrefix]
private static bool PatchPrefix(ObservedGrenade __instance, float ___float_4)
{
__instance.StartBehaviourTimer(__instance.WeaponSource.GetExplDelay - ___float_4, new Action(__instance.InvokeBlowUpEvent));
return false;
}
}
}