0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 05:10:45 -05:00

Fix Grenade fuses being longer than they should be

This commit is contained in:
Kaeno 2024-08-01 21:27:35 +01:00
parent 104cb02b58
commit 9b86d8624a

View File

@ -1,24 +1,25 @@
using HarmonyLib; using HarmonyLib;
using SPT.Reflection.Patching; using SPT.Reflection.Patching;
using System;
using System.Reflection; using System.Reflection;
namespace SPT.Custom.Patches namespace SPT.Custom.Patches
{ {
/// <summary> /// <summary>
/// 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. /// Waiting on BSG Fix.
/// </summary> /// </summary>
public class StunGrenadeExplosionPatch : ModulePatch public class StunGrenadeExplosionPatch : ModulePatch
{ {
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
return AccessTools.Method(typeof(ObservedStunGrenade), nameof(ObservedStunGrenade.method_4)); return AccessTools.Method(typeof(ObservedStunGrenade), nameof(ObservedStunGrenade.StartTimer));
} }
[PatchPrefix] [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; return false;
} }
} }
@ -27,13 +28,13 @@ namespace SPT.Custom.Patches
{ {
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
return AccessTools.Method(typeof(ObservedGrenade), nameof(ObservedGrenade.method_4)); return AccessTools.Method(typeof(ObservedGrenade), nameof(ObservedGrenade.StartTimer));
} }
[PatchPrefix] [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; return false;
} }
} }