From cd190061cff783393c2f32bb265eeecbbb810572 Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 28 Jun 2024 11:12:51 +0100 Subject: [PATCH] Improved ragdoll patch to only apply changes when vectors y and magnitude values match + y is over 5 - Appears to stop altering non-flying bot bots --- project/SPT.Custom/Patches/ClampRagdollPatch.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/project/SPT.Custom/Patches/ClampRagdollPatch.cs b/project/SPT.Custom/Patches/ClampRagdollPatch.cs index 89ec2d4..d6e3db7 100644 --- a/project/SPT.Custom/Patches/ClampRagdollPatch.cs +++ b/project/SPT.Custom/Patches/ClampRagdollPatch.cs @@ -6,6 +6,9 @@ using UnityEngine; namespace SPT.Custom.Patches { + /// + /// On death some bots have a habit of flying upwards. We have found this occurs when the velocity y and magnitude match + /// public class ClampRagdollPatch : ModulePatch { protected override MethodBase GetTargetMethod() @@ -16,7 +19,11 @@ namespace SPT.Custom.Patches [PatchPrefix] private static void PatchPreFix(ref Vector3 velocity) { - velocity.y = Mathf.Clamp(velocity.y, -2f, 2f); + if (velocity.magnitude == velocity.y && velocity.y > 5) + { + // Probably flying upwards + velocity.y = 1; + } } } }