From 2fbaef5eff2b9065d98979770d393d699fa9c3ae Mon Sep 17 00:00:00 2001 From: Kaeno Date: Mon, 1 Apr 2024 14:03:10 +0100 Subject: [PATCH] Clamp the Y velocity so bots dont go flying into the air. --- project/Aki.Custom/AkiCustomPlugin.cs | 1 + .../Aki.Custom/Patches/ClampRagdollPatch.cs | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 project/Aki.Custom/Patches/ClampRagdollPatch.cs diff --git a/project/Aki.Custom/AkiCustomPlugin.cs b/project/Aki.Custom/AkiCustomPlugin.cs index 5180f76..e3d39f8 100644 --- a/project/Aki.Custom/AkiCustomPlugin.cs +++ b/project/Aki.Custom/AkiCustomPlugin.cs @@ -75,6 +75,7 @@ namespace Aki.Custom new ResetTraderServicesPatch().Enable(); new CultistAmuletRemovalPatch().Enable(); new HalloweenExtractPatch().Enable(); + new ClampRagdollPatch().Enable(); HookObject.AddOrGetComponent(); } diff --git a/project/Aki.Custom/Patches/ClampRagdollPatch.cs b/project/Aki.Custom/Patches/ClampRagdollPatch.cs new file mode 100644 index 0000000..266eb40 --- /dev/null +++ b/project/Aki.Custom/Patches/ClampRagdollPatch.cs @@ -0,0 +1,22 @@ +using Aki.Reflection.Patching; +using EFT.Interactive; +using HarmonyLib; +using System.Reflection; +using UnityEngine; + +namespace Aki.Custom.Patches +{ + public class ClampRagdollPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(Corpse), nameof(Corpse.method_16)); + } + + [PatchPrefix] + private static void PatchPreFix(ref Vector3 velocity) + { + velocity.y = Mathf.Clamp(velocity.y, -1f, 1f); + } + } +}