mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 06:49:22 +00:00
[DesktopVRIK] Fixes for r173
This commit is contained in:
parent
0d4e6e6331
commit
892ff611b5
8 changed files with 72 additions and 23 deletions
|
@ -1,5 +1,6 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Systems.IK;
|
||||
using HarmonyLib;
|
||||
using NAK.DesktopVRIK.IK;
|
||||
using UnityEngine;
|
||||
|
@ -100,6 +101,26 @@ internal class PlayerSetupPatches
|
|||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(IKSystem), nameof(IKSystem.OffsetMovementParent))]
|
||||
private static void Prefix_IKSystem_OffsetMovementParent(CVRMovementParent currentParent, ref IKSystem __instance, ref bool __runOriginal)
|
||||
{
|
||||
try
|
||||
{
|
||||
__runOriginal = true;
|
||||
if (IKManager.Instance == null || !IKManager.Instance.IsAvatarInitialized())
|
||||
return;
|
||||
|
||||
if (currentParent != null && currentParent._referencePoint != null)
|
||||
__runOriginal = IKManager.Instance.OnPlayerHandleMovementParent(currentParent);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DesktopVRIK.Logger.Error($"Error during the patched method {nameof(Prefix_IKSystem_OffsetMovementParent)}");
|
||||
DesktopVRIK.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.ResetIk))]
|
||||
private static void Prefix_PlayerSetup_ResetIk(ref PlayerSetup __instance, ref bool __runOriginal)
|
||||
|
@ -112,9 +133,9 @@ internal class PlayerSetupPatches
|
|||
|
||||
CVRMovementParent currentParent = __instance._movementSystem._currentParent;
|
||||
if (currentParent != null && currentParent._referencePoint != null)
|
||||
IKManager.Instance.OnPlayerHandleMovementParent(currentParent);
|
||||
__runOriginal = IKManager.Instance.OnPlayerHandleMovementParent(currentParent);
|
||||
else
|
||||
IKManager.Instance.OnPlayerTeleported();
|
||||
__runOriginal = IKManager.Instance.OnPlayerTeleported();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue