From 32456e0055015d055771edd99fb4394dd09ac39f Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:26:03 -0500 Subject: [PATCH] [DesktopVRIK] Cleanup --- DesktopVRIK/HarmonyPatches.cs | 9 +++++---- DesktopVRIK/IK/IKHandlers/IKHandler.cs | 1 + DesktopVRIK/IK/IKHandlers/IKHandlerDesktop.cs | 8 ++------ DesktopVRIK/IK/IKManager.cs | 10 ++++++---- DesktopVRIK/format.json | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/DesktopVRIK/HarmonyPatches.cs b/DesktopVRIK/HarmonyPatches.cs index adb30a3..77776a6 100644 --- a/DesktopVRIK/HarmonyPatches.cs +++ b/DesktopVRIK/HarmonyPatches.cs @@ -107,13 +107,14 @@ internal class PlayerSetupPatches try { __runOriginal = true; - if (IKManager.Instance == null) + if (IKManager.Instance == null || !IKManager.Instance.IsAvatarInitialized()) return; CVRMovementParent currentParent = __instance._movementSystem._currentParent; - __runOriginal = (currentParent != null && currentParent._referencePoint != null) - ? IKManager.Instance.OnPlayerHandleMovementParent(currentParent) - : IKManager.Instance.OnPlayerTeleported(); + if (currentParent != null && currentParent._referencePoint != null) + IKManager.Instance.OnPlayerHandleMovementParent(currentParent); + else + IKManager.Instance.OnPlayerTeleported(); } catch (Exception e) { diff --git a/DesktopVRIK/IK/IKHandlers/IKHandler.cs b/DesktopVRIK/IK/IKHandlers/IKHandler.cs index 650141a..85426b5 100644 --- a/DesktopVRIK/IK/IKHandlers/IKHandler.cs +++ b/DesktopVRIK/IK/IKHandlers/IKHandler.cs @@ -142,6 +142,7 @@ internal abstract class IKHandler public virtual void Reset() { _ikSimulatedRootAngle = _vrik.transform.eulerAngles.y; + if(ModSettings.EntryResetFootstepsOnIdle.Value) VRIKUtils.ResetToInitialFootsteps(_vrik, _locomotionData, _scaleDifference); diff --git a/DesktopVRIK/IK/IKHandlers/IKHandlerDesktop.cs b/DesktopVRIK/IK/IKHandlers/IKHandlerDesktop.cs index f4183ba..6da0a63 100644 --- a/DesktopVRIK/IK/IKHandlers/IKHandlerDesktop.cs +++ b/DesktopVRIK/IK/IKHandlers/IKHandlerDesktop.cs @@ -115,14 +115,10 @@ internal class IKHandlerDesktop : IKHandler private void ResetSolverIfNeeded() { - if (_wasTrackingLocomotion == BodySystem.TrackingLocomotionEnabled) - return; - + if (_wasTrackingLocomotion == BodySystem.TrackingLocomotionEnabled) return; _wasTrackingLocomotion = BodySystem.TrackingLocomotionEnabled; - if (ModSettings.EntryResetFootstepsOnIdle.Value) - VRIKUtils.ResetToInitialFootsteps(_vrik, _locomotionData, _scaleDifference); - _solver.Reset(); + Reset(); } #endregion diff --git a/DesktopVRIK/IK/IKManager.cs b/DesktopVRIK/IK/IKManager.cs index 4f2b0a8..1c06b0c 100644 --- a/DesktopVRIK/IK/IKManager.cs +++ b/DesktopVRIK/IK/IKManager.cs @@ -61,10 +61,7 @@ public class IKManager : MonoBehaviour private void Update() { - if (_ikHandler == null) - return; - - _ikHandler.UpdateWeights(); + _ikHandler?.UpdateWeights(); } #endregion @@ -214,6 +211,11 @@ public class IKManager : MonoBehaviour #region Public Methods + public bool IsAvatarInitialized() + { + return _isAvatarInitialized; + } + public Vector3 GetPlayerPosition() { if (!MetaPort.Instance.isUsingVr) diff --git a/DesktopVRIK/format.json b/DesktopVRIK/format.json index 555a075..ccbdfe5 100644 --- a/DesktopVRIK/format.json +++ b/DesktopVRIK/format.json @@ -1,7 +1,7 @@ { "_id": 117, "name": "DesktopVRIK", - "modversion": "4.2.6", + "modversion": "4.2.7", "gameversion": "2023r172", "loaderversion": "0.6.1", "modtype": "Mod", @@ -17,8 +17,8 @@ "requirements": [ "BTKUILib" ], - "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r21/DesktopVRIK.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r22/DesktopVRIK.dll", "sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/DesktopVRIK/", - "changelog": "- Movement Parent IK handling now respects new orientation mode.\n- Changed avatar initialization patch location to resolve a potential mod conflict.", + "changelog": "- Fixed Prone Thrusting option ignoring set Body Leaning weight.\n- Potential fix for avatars feet randomly targeting far away while stutter-stepping.", "embedcolor": "#9b59b6" } \ No newline at end of file