From 9b86d8624a4864536af1ee573438dfc0f2082690 Mon Sep 17 00:00:00 2001 From: Kaeno Date: Thu, 1 Aug 2024 21:27:35 +0100 Subject: [PATCH] Fix Grenade fuses being longer than they should be --- .../Patches/StunGrenadeExplosionPatch.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs b/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs index 58fb157..ceca1ca 100644 --- a/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs +++ b/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs @@ -1,24 +1,25 @@ using HarmonyLib; using SPT.Reflection.Patching; +using System; using System.Reflection; namespace SPT.Custom.Patches { /// - /// BSG has had the wonderful idea of not letting grenades explode. Delay for the grenades are really long for some reason. + /// BSG has had the wonderful idea of not letting grenades explode. /// Waiting on BSG Fix. /// public class StunGrenadeExplosionPatch : ModulePatch { protected override MethodBase GetTargetMethod() { - return AccessTools.Method(typeof(ObservedStunGrenade), nameof(ObservedStunGrenade.method_4)); + return AccessTools.Method(typeof(ObservedStunGrenade), nameof(ObservedStunGrenade.StartTimer)); } [PatchPrefix] - private static bool PatchPrefix(ObservedStunGrenade __instance) + private static bool PatchPrefix(ObservedStunGrenade __instance, float ___float_4) { - __instance.InvokeBlowUpEvent(); + __instance.StartBehaviourTimer(__instance.WeaponSource.GetExplDelay - ___float_4, new Action(__instance.InvokeBlowUpEvent)); return false; } } @@ -27,13 +28,13 @@ namespace SPT.Custom.Patches { protected override MethodBase GetTargetMethod() { - return AccessTools.Method(typeof(ObservedGrenade), nameof(ObservedGrenade.method_4)); + return AccessTools.Method(typeof(ObservedGrenade), nameof(ObservedGrenade.StartTimer)); } [PatchPrefix] - private static bool PatchPrefix(ObservedGrenade __instance) + private static bool PatchPrefix(ObservedGrenade __instance, float ___float_4) { - __instance.InvokeBlowUpEvent(); + __instance.StartBehaviourTimer(__instance.WeaponSource.GetExplDelay - ___float_4, new Action(__instance.InvokeBlowUpEvent)); return false; } }