diff --git a/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs b/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs new file mode 100644 index 0000000..58fb157 --- /dev/null +++ b/project/SPT.Custom/Patches/StunGrenadeExplosionPatch.cs @@ -0,0 +1,40 @@ +using HarmonyLib; +using SPT.Reflection.Patching; +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. + /// Waiting on BSG Fix. + /// + public class StunGrenadeExplosionPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(ObservedStunGrenade), nameof(ObservedStunGrenade.method_4)); + } + + [PatchPrefix] + private static bool PatchPrefix(ObservedStunGrenade __instance) + { + __instance.InvokeBlowUpEvent(); + return false; + } + } + + public class GrenadeExplosionPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(ObservedGrenade), nameof(ObservedGrenade.method_4)); + } + + [PatchPrefix] + private static bool PatchPrefix(ObservedGrenade __instance) + { + __instance.InvokeBlowUpEvent(); + return false; + } + } +} diff --git a/project/SPT.Custom/SPTCustomPlugin.cs b/project/SPT.Custom/SPTCustomPlugin.cs index 92aed21..d383ee9 100644 --- a/project/SPT.Custom/SPTCustomPlugin.cs +++ b/project/SPT.Custom/SPTCustomPlugin.cs @@ -53,8 +53,10 @@ namespace SPT.Custom new LocationLootCacheBustingPatch().Enable(); new VersionLabelPatch().Enable(); new FixBotgroupMarkofTheUnknown().Enable(); + new StunGrenadeExplosionPatch().Enable(); + new GrenadeExplosionPatch().Enable(); - HookObject.AddOrGetComponent(); + HookObject.AddOrGetComponent(); } catch (Exception ex) {