mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[RelativeSync] Changes
This commit is contained in:
parent
ce6582ae18
commit
d22bc80b4d
5 changed files with 39 additions and 19 deletions
|
@ -20,13 +20,13 @@ using System.Reflection;
|
||||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
[assembly: MelonColor(255, 125, 126, 129)]
|
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
|
||||||
[assembly: MelonAuthorColor(255, 158, 21, 32)]
|
[assembly: MelonAuthorColor(255, 158, 21, 32)] // red
|
||||||
[assembly: HarmonyDontPatchAll]
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
namespace NAK.RelativeSync.Properties;
|
namespace NAK.RelativeSync.Properties;
|
||||||
internal static class AssemblyInfoParams
|
internal static class AssemblyInfoParams
|
||||||
{
|
{
|
||||||
public const string Version = "1.0.3";
|
public const string Version = "1.0.4";
|
||||||
public const string Author = "NotAKidoS";
|
public const string Author = "NotAKidoS";
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace NAK.RelativeSync.Components;
|
namespace NAK.RelativeSync.Components;
|
||||||
|
|
||||||
[DefaultExecutionOrder(int.MaxValue)] // make sure this runs after NetIKController
|
[DefaultExecutionOrder(9000)] // make sure this runs after NetIKController, but before Totally Wholesome LineController (9999)
|
||||||
public class RelativeSyncController : MonoBehaviour
|
public class RelativeSyncController : MonoBehaviour
|
||||||
{
|
{
|
||||||
private const float MaxMagnitude = 750000000000f;
|
private const float MaxMagnitude = 750000000000f;
|
||||||
|
@ -35,12 +35,15 @@ public class RelativeSyncController : MonoBehaviour
|
||||||
|
|
||||||
private void LateUpdate()
|
private void LateUpdate()
|
||||||
{
|
{
|
||||||
if (puppetMaster._isHidden)
|
// if (puppetMaster._isHidden)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (_relativeSyncMarker == null)
|
if (_relativeSyncMarker == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!_relativeSyncMarker.IsComponentActive)
|
||||||
|
return;
|
||||||
|
|
||||||
Animator animator = puppetMaster._animator;
|
Animator animator = puppetMaster._animator;
|
||||||
if (animator == null)
|
if (animator == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using ABI_RC.Core.Player;
|
using ABI_RC.Core.InteractionSystem;
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
using ABI_RC.Core.Savior;
|
using ABI_RC.Core.Savior;
|
||||||
using ABI.CCK.Components;
|
using ABI.CCK.Components;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -9,10 +10,15 @@ public class RelativeSyncMarker : MonoBehaviour
|
||||||
{
|
{
|
||||||
public int pathHash { get; private set; }
|
public int pathHash { get; private set; }
|
||||||
|
|
||||||
|
public bool IsComponentActive
|
||||||
|
=> _component.isActiveAndEnabled;
|
||||||
|
|
||||||
public bool ApplyRelativePosition = true;
|
public bool ApplyRelativePosition = true;
|
||||||
public bool ApplyRelativeRotation = true;
|
public bool ApplyRelativeRotation = true;
|
||||||
public bool OnlyApplyRelativeHeading;
|
public bool OnlyApplyRelativeHeading;
|
||||||
|
|
||||||
|
private MonoBehaviour _component;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
string path = GetGameObjectPath(transform);
|
string path = GetGameObjectPath(transform);
|
||||||
|
@ -43,7 +49,11 @@ public class RelativeSyncMarker : MonoBehaviour
|
||||||
private void ConfigureForPotentialMovementParent()
|
private void ConfigureForPotentialMovementParent()
|
||||||
{
|
{
|
||||||
if (!gameObject.TryGetComponent(out CVRMovementParent movementParent))
|
if (!gameObject.TryGetComponent(out CVRMovementParent movementParent))
|
||||||
|
{
|
||||||
|
_component = GetComponent<CVRSeat>(); // users cant animate enabled state so i dont think matters
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
_component = movementParent;
|
||||||
|
|
||||||
// TODO: a refactor may be needed to handle the orientation mode being animated
|
// TODO: a refactor may be needed to handle the orientation mode being animated
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,21 @@ public static class RelativeSyncManager
|
||||||
public static void ApplyRelativeSync(string userId, int target, Vector3 position, Vector3 rotation)
|
public static void ApplyRelativeSync(string userId, int target, Vector3 position, Vector3 rotation)
|
||||||
{
|
{
|
||||||
if (!RelativeSyncControllers.TryGetValue(userId, out RelativeSyncController controller))
|
if (!RelativeSyncControllers.TryGetValue(userId, out RelativeSyncController controller))
|
||||||
|
{
|
||||||
if (CVRPlayerManager.Instance.GetPlayerPuppetMaster(userId, out PuppetMaster pm))
|
if (CVRPlayerManager.Instance.GetPlayerPuppetMaster(userId, out PuppetMaster pm))
|
||||||
|
{
|
||||||
controller = pm.AddComponentIfMissing<RelativeSyncController>();
|
controller = pm.AddComponentIfMissing<RelativeSyncController>();
|
||||||
|
RelativeSyncMod.Logger.Msg($"Found PuppetMaster for user {userId}. This user is now eligible for relative sync.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RelativeSyncControllers.Add(userId, null); // add null controller to prevent future lookups
|
||||||
|
RelativeSyncMod.Logger.Warning($"Failed to find PuppetMaster for user {userId}. This is likely because the user is blocked or has blocked you. This user will not be eligible for relative sync until next game restart.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (controller == null)
|
if (controller == null)
|
||||||
{
|
|
||||||
RelativeSyncMod.Logger.Error($"Failed to apply relative sync for user {userId}");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// find target transform
|
// find target transform
|
||||||
RelativeSyncMarker syncMarker = null;
|
RelativeSyncMarker syncMarker = null;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_id": 211,
|
"_id": 211,
|
||||||
"name": "RelativeSync",
|
"name": "RelativeSync",
|
||||||
"modversion": "1.0.3",
|
"modversion": "1.0.4",
|
||||||
"gameversion": "2024r175",
|
"gameversion": "2024r175",
|
||||||
"loaderversion": "0.6.1",
|
"loaderversion": "0.6.1",
|
||||||
"modtype": "Mod",
|
"modtype": "Mod",
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"None"
|
"None"
|
||||||
],
|
],
|
||||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r29/RelativeSync.dll",
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r34/RelativeSync.dll",
|
||||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/RelativeSync/",
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/RelativeSync/",
|
||||||
"changelog": "- Enabled the Experimental settings to fix **local** jitter on Movement Parents by default\n- Adjusted BBCC No Interpolation fix to account for potential native fix (now respects initial value)",
|
"changelog": "- Fixed log spam when receiving relative sync data from a blocked user (thanks Mod Network for still forwarding that data -_-).\n- Adjusted execution order to apply relative sync before Totally Wholesomes LineController.\n- Adjusted Relative Sync to still apply to avatar distance-hidden users.\n- Adjusted Relative Sync to not apply if the CVRSeat or Movement Parent is disabled on receiving client.",
|
||||||
"embedcolor": "#507e64"
|
"embedcolor": "#f61963"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue