mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-07 08:49:15 +00:00
Compare commits
No commits in common. "364de89b30037b6fc6587cb80a16a8142338eae2" and "6249696efaa00151708201b07259ea5cd5284e4d" have entirely different histories.
364de89b30
...
6249696efa
3 changed files with 23 additions and 18 deletions
|
@ -6,7 +6,6 @@ using ABI.CCK.Components;
|
|||
using HarmonyLib;
|
||||
using NAK.RelativeSync.Components;
|
||||
using NAK.RelativeSync.Networking;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.RelativeSync.Patches;
|
||||
|
||||
|
@ -28,6 +27,20 @@ internal static class PuppetMasterPatches
|
|||
{
|
||||
__instance.AddComponentIfMissing<RelativeSyncController>();
|
||||
}
|
||||
|
||||
private static bool ShouldProcessAvatarVisibility { get; set; }
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PuppetMaster), nameof(PuppetMaster.ProcessAvatarVisibility))]
|
||||
private static bool Prefix_PuppetMaster_ProcessAvatarVisibility()
|
||||
=> ShouldProcessAvatarVisibility;
|
||||
|
||||
public static void ForceProcessAvatarVisibility(PuppetMaster puppetMaster)
|
||||
{
|
||||
ShouldProcessAvatarVisibility = true;
|
||||
puppetMaster.ProcessAvatarVisibility();
|
||||
ShouldProcessAvatarVisibility = false;
|
||||
}
|
||||
}
|
||||
|
||||
internal static class CVRSeatPatches
|
||||
|
@ -91,18 +104,16 @@ internal static class NetIKController_Patches
|
|||
{
|
||||
if (!RelativeSyncManager.NetIkControllersToRelativeSyncControllers.TryGetValue(__instance,
|
||||
out RelativeSyncController syncController))
|
||||
{
|
||||
// Process visibility only after applying network IK
|
||||
PuppetMasterPatches.ForceProcessAvatarVisibility(__instance._puppetMaster);
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply relative sync after the network IK has been applied
|
||||
syncController.OnPostNetIkControllerLateUpdate();
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NetIKController), nameof(NetIKController.GetLocalPlayerPosition))]
|
||||
private static bool Prefix_NetIKController_GetLocalPlayerPosition(ref NetIKController __instance, ref Vector3 __result)
|
||||
{
|
||||
// why is the original method so bad
|
||||
__result = PlayerSetup.Instance.activeCam.transform.position;
|
||||
return false;
|
||||
|
||||
// Process visibility after we have moved the remote player
|
||||
PuppetMasterPatches.ForceProcessAvatarVisibility(__instance._puppetMaster);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Systems.Movement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.RelativeSync.Components;
|
||||
|
@ -63,7 +62,7 @@ public class RelativeSyncController : MonoBehaviour
|
|||
Animator animator = puppetMaster._animator;
|
||||
if (animator == null)
|
||||
return;
|
||||
|
||||
|
||||
Transform avatarTransform = animator.transform;
|
||||
Transform hipTrans = (animator.avatar != null && animator.isHuman)
|
||||
? animator.GetBoneTransform(HumanBodyBones.Hips) : null;
|
||||
|
@ -98,11 +97,6 @@ public class RelativeSyncController : MonoBehaviour
|
|||
hipTrans.position = transform.position + transform.rotation * relativeHipPos;
|
||||
hipTrans.rotation = transform.rotation * relativeHipRot;
|
||||
}
|
||||
|
||||
// Reprocess the root distance so we don't fuck avatar distance hider
|
||||
NetIKController netIkController = puppetMaster.netIkController;
|
||||
netIkController._rootDistance = Vector3.Distance((netIkController._collider.transform.position + netIkController._collider.center),
|
||||
netIkController.GetLocalPlayerPosition()) - (netIkController._collider.radius + BetterBetterCharacterController.Instance.Radius);
|
||||
}
|
||||
|
||||
private void ApplyRelativeRotation(Transform avatarTransform, Transform hipTransform, float lerp)
|
||||
|
|
|
@ -18,6 +18,6 @@
|
|||
],
|
||||
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r46/RelativeSync.dll",
|
||||
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/RelativeSync/",
|
||||
"changelog": "- Recompiled for 2025r179\n- Fixed execution order of RelativeSyncController so moving at high speeds with passengers does not disrupt voice or avatar distance hider",
|
||||
"changelog": "- Recompiled for 2025r179\n- Fixed execution order of RelativeSyncController & PuppetMaster.ProcessAvatarVisibility, so moving at high speeds with passengers does not disrupt voice or avatar distance hider",
|
||||
"embedcolor": "#f61963"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue