From f3aa0bc72d3ba637f73cfb31447138e2ffc71129 Mon Sep 17 00:00:00 2001 From: SDraw Date: Fri, 26 Jan 2024 19:56:33 +0300 Subject: [PATCH] Game build 2023r174ex1 test --- ml_amt/AvatarParameter.cs | 5 -- ml_amt/MotionTweaker.cs | 30 +++----- ml_amt/Properties/AssemblyInfo.cs | 2 +- ml_amt/Utils.cs | 5 -- ml_amt/ml_amt.csproj | 12 ++- ml_asl/Main.cs | 2 +- ml_asl/Properties/AssemblyInfo.cs | 2 +- ml_asl/ml_asl.csproj | 1 + ml_dht/HeadTracked.cs | 3 +- ml_dht/Main.cs | 9 ++- ml_dht/Properties/AssemblyInfo.cs | 2 +- ml_dht/ml_dht.csproj | 2 +- ml_lme/LeapTracked.cs | 5 +- ml_lme/Properties/AssemblyInfo.cs | 2 +- ml_lme/ml_lme.csproj | 2 +- ml_pam/ArmMover.cs | 9 ++- ml_pam/Properties/AssemblyInfo.cs | 2 +- ml_pam/TPoseHelper.cs | 8 +- ml_pam/ml_pam.csproj | 2 +- ml_pin/Properties/AssemblyInfo.cs | 2 +- ml_pin/ml_pin.csproj | 2 +- ml_pmc/Main.cs | 4 +- ml_pmc/PoseCopycat.cs | 4 +- ml_pmc/Properties/AssemblyInfo.cs | 2 +- ml_pmc/ml_pmc.csproj | 12 ++- ml_prm/GravityInfluencer.cs | 29 ++++++++ ml_prm/Main.cs | 39 +++------- ml_prm/ModUi.cs | 10 +-- ml_prm/Properties/AssemblyInfo.cs | 2 +- ml_prm/RagdollController.cs | 117 ++++++++++++++++++------------ ml_prm/Utils.cs | 11 +-- ml_prm/ml_prm.csproj | 12 ++- ml_vei/Properties/AssemblyInfo.cs | 2 +- ml_vei/ml_vei.csproj | 2 +- 34 files changed, 202 insertions(+), 153 deletions(-) create mode 100644 ml_prm/GravityInfluencer.cs diff --git a/ml_amt/AvatarParameter.cs b/ml_amt/AvatarParameter.cs index 0430be6..5307c70 100644 --- a/ml_amt/AvatarParameter.cs +++ b/ml_amt/AvatarParameter.cs @@ -8,7 +8,6 @@ namespace ml_amt { public enum ParameterType { - GroundedRaw, Moving } @@ -42,10 +41,6 @@ namespace ml_amt { switch(m_type) { - case ParameterType.GroundedRaw: - SetBoolean(p_tweaker.GetGroundedRaw()); - break; - case ParameterType.Moving: SetBoolean(p_tweaker.GetMoving()); break; diff --git a/ml_amt/MotionTweaker.cs b/ml_amt/MotionTweaker.cs index cdc9e72..ae10b6a 100644 --- a/ml_amt/MotionTweaker.cs +++ b/ml_amt/MotionTweaker.cs @@ -1,7 +1,7 @@ using ABI_RC.Core.Player; using ABI_RC.Systems.IK; using ABI_RC.Systems.IK.SubSystems; -using ABI_RC.Systems.MovementSystem; +using ABI_RC.Systems.Movement; using RootMotion.FinalIK; using System.Collections.Generic; using UnityEngine; @@ -32,7 +32,6 @@ namespace ml_amt bool m_avatarReady = false; bool m_grounded = false; - bool m_groundedRaw = false; bool m_moving = false; bool m_locomotionOverride = false; @@ -90,9 +89,8 @@ namespace ml_amt { if(m_avatarReady) { - m_grounded = MovementSystem.Instance.IsGrounded(); - m_groundedRaw = MovementSystem.Instance.IsGroundedRaw(); - m_moving = !Mathf.Approximately(MovementSystem.Instance.movementVector.magnitude, 0f); + m_grounded = BetterBetterCharacterController.Instance.IsGrounded(); + m_moving = BetterBetterCharacterController.Instance.IsMoving(); UpdateIKLimits(); @@ -117,7 +115,6 @@ namespace ml_amt m_vrIk = null; m_locomotionLayer = -1; m_grounded = false; - m_groundedRaw = false; m_avatarReady = false; m_avatarScale = 1f; m_locomotionOffset = Vector3.zero; @@ -128,8 +125,8 @@ namespace ml_amt m_ikLimits = null; m_parameters.Clear(); - PlayerSetup.Instance.avatarCrouchLimit = Mathf.Clamp01(Settings.CrouchLimit); - PlayerSetup.Instance.avatarProneLimit = Mathf.Clamp01(Settings.ProneLimit); + BetterBetterCharacterController.Instance.avatarCrouchLimit = Mathf.Clamp01(Settings.CrouchLimit); + BetterBetterCharacterController.Instance.avatarProneLimit = Mathf.Clamp01(Settings.ProneLimit); } internal void OnSetupAvatar() @@ -140,7 +137,6 @@ namespace ml_amt m_avatarScale = Mathf.Abs(PlayerSetup.Instance._avatar.transform.localScale.y); // Parse animator parameters - m_parameters.Add(new AvatarParameter(AvatarParameter.ParameterType.GroundedRaw, PlayerSetup.Instance.animatorManager)); m_parameters.Add(new AvatarParameter(AvatarParameter.ParameterType.Moving, PlayerSetup.Instance.animatorManager)); m_parameters.RemoveAll(p => !p.IsValid()); @@ -225,21 +221,21 @@ namespace ml_amt if(!BodySystem.isCalibratedAsFullBody) { - if(PlayerSetup.Instance.avatarUpright <= PlayerSetup.Instance.avatarCrouchLimit) + if(BetterBetterCharacterController.Instance.AvatarUpright <= BetterBetterCharacterController.Instance.avatarCrouchLimit) { m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; l_locomotionOverride = true; } - if(m_ikOverrideFly && MovementSystem.Instance.flying) + if(m_ikOverrideFly && BetterBetterCharacterController.Instance.IsFlying()) { m_vrIk.solver.locomotion.weight = 0f; m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; m_vrIk.solver.rightLeg.useAnimatedBendNormal = true; l_locomotionOverride = true; } - if(m_ikOverrideJump && !m_grounded && !MovementSystem.Instance.flying) + if(m_ikOverrideJump && !m_grounded && !BetterBetterCharacterController.Instance.IsFlying()) { m_vrIk.solver.locomotion.weight = 0f; m_vrIk.solver.leftLeg.useAnimatedBendNormal = true; @@ -266,12 +262,12 @@ namespace ml_amt internal void SetCrouchLimit(float p_value) { if(m_ikLimits == null) - PlayerSetup.Instance.avatarCrouchLimit = Mathf.Clamp01(p_value); + BetterBetterCharacterController.Instance.avatarCrouchLimit = Mathf.Clamp01(p_value); } internal void SetProneLimit(float p_value) { if(m_ikLimits == null) - PlayerSetup.Instance.avatarProneLimit = Mathf.Clamp01(p_value); + BetterBetterCharacterController.Instance.avatarProneLimit = Mathf.Clamp01(p_value); } internal void SetIKOverrideFly(bool p_state) { @@ -302,14 +298,12 @@ namespace ml_amt if(m_ikLimits != null) { Vector3 l_values = m_ikLimits.localPosition; - PlayerSetup.Instance.avatarCrouchLimit = Mathf.Clamp01(l_values.x); - PlayerSetup.Instance.avatarProneLimit = Mathf.Clamp01(l_values.y); + BetterBetterCharacterController.Instance.avatarCrouchLimit = Mathf.Clamp01(l_values.x); + BetterBetterCharacterController.Instance.avatarProneLimit = Mathf.Clamp01(l_values.y); } } // Parameters access - public float GetUpright() => PlayerSetup.Instance.avatarUpright; - public bool GetGroundedRaw() => m_groundedRaw; public bool GetMoving() => m_moving; } } diff --git a/ml_amt/Properties/AssemblyInfo.cs b/ml_amt/Properties/AssemblyInfo.cs index 89aeb24..4273301 100644 --- a/ml_amt/Properties/AssemblyInfo.cs +++ b/ml_amt/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.3.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.3.7-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_amt/Utils.cs b/ml_amt/Utils.cs index d6d28b5..a228c13 100644 --- a/ml_amt/Utils.cs +++ b/ml_amt/Utils.cs @@ -1,6 +1,5 @@ using ABI.CCK.Components; using ABI_RC.Core.UI; -using ABI_RC.Systems.MovementSystem; using RootMotion.FinalIK; using System.Reflection; using UnityEngine; @@ -9,15 +8,11 @@ namespace ml_amt { static class Utils { - static readonly FieldInfo ms_grounded = typeof(MovementSystem).GetField("_isGrounded", BindingFlags.NonPublic | BindingFlags.Instance); - static readonly FieldInfo ms_groundedRaw = typeof(MovementSystem).GetField("_isGroundedRaw", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_hasToes = typeof(IKSolverVR).GetField("hasToes", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_view = typeof(CohtmlControlledViewWrapper).GetField("_view", BindingFlags.NonPublic | BindingFlags.Instance); public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded); - public static bool IsGroundedRaw(this MovementSystem p_instance) => (bool)ms_groundedRaw.GetValue(MovementSystem.Instance); - public static bool HasToes(this IKSolverVR p_instance) => (bool)ms_hasToes.GetValue(p_instance); public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying); diff --git a/ml_amt/ml_amt.csproj b/ml_amt/ml_amt.csproj index 2292594..7f1eb30 100644 --- a/ml_amt/ml_amt.csproj +++ b/ml_amt/ml_amt.csproj @@ -6,7 +6,7 @@ None AvatarMotionTweaker AvatarMotionTweaker - 1.3.6 + 1.3.7 x64 ml_amt @@ -63,6 +63,16 @@ false false + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\EasyCharacterMovement.CharacterMovement.dll + false + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\EasyCharacterMovement.Characters.dll + false + false + D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\MelonLoader.dll false diff --git a/ml_asl/Main.cs b/ml_asl/Main.cs index 66f77d0..968e458 100644 --- a/ml_asl/Main.cs +++ b/ml_asl/Main.cs @@ -18,7 +18,7 @@ namespace ml_asl static void OnPlayerAvatarMovementDataUpdate_Postfix(ref PlayerSetup __instance, PlayerAvatarMovementData ____playerAvatarMovementData) { - if(Settings.Enabled && (__instance.eyeMovement != null)) + if(Settings.Enabled && (__instance.EyeMovementController != null)) ____playerAvatarMovementData.EyeTrackingOverride = true; } } diff --git a/ml_asl/Properties/AssemblyInfo.cs b/ml_asl/Properties/AssemblyInfo.cs index 641578e..fcbf161 100644 --- a/ml_asl/Properties/AssemblyInfo.cs +++ b/ml_asl/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_asl.AvatarSyncedLook), "AvatarSyncedLook", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_asl.AvatarSyncedLook), "AvatarSyncedLook", "1.0.1-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_asl/ml_asl.csproj b/ml_asl/ml_asl.csproj index 0fc712e..2e5e075 100644 --- a/ml_asl/ml_asl.csproj +++ b/ml_asl/ml_asl.csproj @@ -7,6 +7,7 @@ SDraw None AvatarSyncedLook + 1.0.1 diff --git a/ml_dht/HeadTracked.cs b/ml_dht/HeadTracked.cs index dc27209..9e16cb1 100644 --- a/ml_dht/HeadTracked.cs +++ b/ml_dht/HeadTracked.cs @@ -1,5 +1,6 @@ using ABI.CCK.Components; using ABI_RC.Core.Player; +using ABI_RC.Core.Player.EyeMovement; using RootMotion.FinalIK; using System.Reflection; using UnityEngine; @@ -92,7 +93,7 @@ namespace ml_dht m_bindRotation = Quaternion.identity; } - internal void OnEyeControllerUpdate(CVREyeController p_component) + internal void OnEyeControllerUpdate(EyeMovementController p_component) { if(m_enabled) { diff --git a/ml_dht/Main.cs b/ml_dht/Main.cs index beeec86..02169f7 100644 --- a/ml_dht/Main.cs +++ b/ml_dht/Main.cs @@ -1,4 +1,5 @@ using ABI_RC.Core.Player; +using ABI_RC.Core.Player.EyeMovement; using ABI_RC.Core.Savior; using ABI_RC.Systems.FaceTracking; using System.Reflection; @@ -49,7 +50,7 @@ namespace ml_dht // If you think it's a joke to put patch here, go on, try to put it in OnInitializeMelon, you melon :> HarmonyInstance.Patch( - typeof(CVREyeController).GetMethod("Update", BindingFlags.Instance | BindingFlags.NonPublic), + typeof(EyeMovementController).GetMethod("Update", BindingFlags.Instance | BindingFlags.NonPublic), null, new HarmonyLib.HarmonyMethod(typeof(DesktopHeadTracking).GetMethod(nameof(OnEyeControllerUpdate_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) ); @@ -102,12 +103,12 @@ namespace ml_dht } } - static void OnEyeControllerUpdate_Postfix(ref CVREyeController __instance) => ms_instance?.OnEyeControllerUpdate(__instance); - void OnEyeControllerUpdate(CVREyeController p_component) + static void OnEyeControllerUpdate_Postfix(ref EyeMovementController __instance) => ms_instance?.OnEyeControllerUpdate(__instance); + void OnEyeControllerUpdate(EyeMovementController p_component) { try { - if(p_component.isLocal && (m_localTracked != null)) + if(p_component.IsLocal && (m_localTracked != null)) m_localTracked.OnEyeControllerUpdate(p_component); } catch(System.Exception e) diff --git a/ml_dht/Properties/AssemblyInfo.cs b/ml_dht/Properties/AssemblyInfo.cs index dbe24dc..7b7e58e 100644 --- a/ml_dht/Properties/AssemblyInfo.cs +++ b/ml_dht/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.2.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.2.1-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_dht/ml_dht.csproj b/ml_dht/ml_dht.csproj index fb08a1e..85d58d2 100644 --- a/ml_dht/ml_dht.csproj +++ b/ml_dht/ml_dht.csproj @@ -6,7 +6,7 @@ SDraw None DesktopHeadTracking - 1.2.0 + 1.2.1 x64 diff --git a/ml_lme/LeapTracked.cs b/ml_lme/LeapTracked.cs index 09b0cb4..e23ac8b 100644 --- a/ml_lme/LeapTracked.cs +++ b/ml_lme/LeapTracked.cs @@ -19,7 +19,6 @@ namespace ml_lme public Transform m_rightElbowTarget; } - static readonly float[] ms_tposeMuscles = typeof(ABI_RC.Systems.IK.SubSystems.BodySystem).GetField("TPoseMuscles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) as float[]; static readonly Quaternion ms_offsetLeft = Quaternion.Euler(0f, 90f, 0f); static readonly Quaternion ms_offsetRight = Quaternion.Euler(0f, 270f, 0f); @@ -170,7 +169,7 @@ namespace ml_lme if(m_hips != null) l_hipsPos = m_hips.localPosition; - if(!m_inVR) + if(m_vrIK == null) { // Force desktop avatar into T-Pose m_poseHandler = new HumanPoseHandler(PlayerSetup.Instance._animator.avatar, PlayerSetup.Instance._avatar.transform); @@ -183,7 +182,7 @@ namespace ml_lme muscles = new float[m_pose.muscles.Length] }; for(int i = 0; i < l_tPose.muscles.Length; i++) - l_tPose.muscles[i] = ms_tposeMuscles[i]; + l_tPose.muscles[i] = MusclePoses.TPoseMuscles[i]; m_poseHandler.SetHumanPose(ref l_tPose); } diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index b802899..2a759ab 100644 --- a/ml_lme/Properties/AssemblyInfo.cs +++ b/ml_lme/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.4.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.4.6-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonOptionalDependencies("ml_pmc")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] diff --git a/ml_lme/ml_lme.csproj b/ml_lme/ml_lme.csproj index 793413b..88208a6 100644 --- a/ml_lme/ml_lme.csproj +++ b/ml_lme/ml_lme.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 LeapMotionExtension - 1.4.5 + 1.4.6 SDraw None LeapMotionExtension diff --git a/ml_pam/ArmMover.cs b/ml_pam/ArmMover.cs index 9431725..47757f7 100644 --- a/ml_pam/ArmMover.cs +++ b/ml_pam/ArmMover.cs @@ -347,10 +347,13 @@ namespace ml_pam if(!m_inVR && PlayerSetup.Instance._animator.isHuman) { m_vrIK = PlayerSetup.Instance._animator.GetComponent(); - TPoseHelper l_tpHelper = new TPoseHelper(); - l_tpHelper.Assign(PlayerSetup.Instance._animator); - l_tpHelper.Apply(); + + if(m_vrIK == null) + { + l_tpHelper.Assign(PlayerSetup.Instance._animator); + l_tpHelper.Apply(); + } Transform l_leftHand = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.LeftHand); if(l_leftHand != null) diff --git a/ml_pam/Properties/AssemblyInfo.cs b/ml_pam/Properties/AssemblyInfo.cs index ebe5a6f..9bd9a57 100644 --- a/ml_pam/Properties/AssemblyInfo.cs +++ b/ml_pam/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.9", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.1.0-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPriority(1)] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] diff --git a/ml_pam/TPoseHelper.cs b/ml_pam/TPoseHelper.cs index 49e9e6f..19f1acb 100644 --- a/ml_pam/TPoseHelper.cs +++ b/ml_pam/TPoseHelper.cs @@ -1,13 +1,9 @@ -using System.Reflection; -using UnityEngine; -using ABI_RC.Systems.IK.SubSystems; +using UnityEngine; namespace ml_pam { class TPoseHelper { - static readonly float[] ms_tposeMuscles = typeof(BodySystem).GetField("TPoseMuscles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) as float[]; - HumanPoseHandler m_poseHandler = null; HumanPose m_oldPose; HumanPose m_newPose; @@ -45,7 +41,7 @@ namespace ml_pam m_newPose.bodyRotation = m_oldPose.bodyRotation; m_newPose.muscles = new float[m_oldPose.muscles.Length]; for(int i = 0, j = m_newPose.muscles.Length; i < j; i++) - m_newPose.muscles[i] = ms_tposeMuscles[i]; + m_newPose.muscles[i] = ABI_RC.Systems.IK.MusclePoses.TPoseMuscles[i]; m_poseHandler.SetHumanPose(ref m_newPose); } diff --git a/ml_pam/ml_pam.csproj b/ml_pam/ml_pam.csproj index 901ce8b..37228e9 100644 --- a/ml_pam/ml_pam.csproj +++ b/ml_pam/ml_pam.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 PickupArmMovement - 1.0.9 + 1.1.0 SDraw None PickupArmMovement diff --git a/ml_pin/Properties/AssemblyInfo.cs b/ml_pin/Properties/AssemblyInfo.cs index 99b7e2a..67b4925 100644 --- a/ml_pin/Properties/AssemblyInfo.cs +++ b/ml_pin/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "1.0.2-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_pin/ml_pin.csproj b/ml_pin/ml_pin.csproj index 150b487..9228213 100644 --- a/ml_pin/ml_pin.csproj +++ b/ml_pin/ml_pin.csproj @@ -7,7 +7,7 @@ SDraw None PlayersInstanceNotifier - 1.0.1 + 1.0.2 diff --git a/ml_pmc/Main.cs b/ml_pmc/Main.cs index d660e2c..62392e1 100644 --- a/ml_pmc/Main.cs +++ b/ml_pmc/Main.cs @@ -1,6 +1,6 @@ using ABI_RC.Core.Networking.IO.Social; using ABI_RC.Core.Player; -using ABI_RC.Systems.MovementSystem; +using ABI_RC.Systems.Movement; using System; using System.Collections.Generic; using System.Linq; @@ -70,7 +70,7 @@ namespace ml_pmc { if(CVRPlayerManager.Instance.GetPlayerPuppetMaster(p_id, out PuppetMaster l_puppetMaster)) { - if(IsInSight(MovementSystem.Instance.proxyCollider, l_puppetMaster.GetComponent(), Utils.GetWorldMovementLimit())) + if(IsInSight(BetterBetterCharacterController.Instance.KinematicTriggerProxy.Collider, l_puppetMaster.GetComponent(), Utils.GetWorldMovementLimit())) m_localCopycat.SetTarget(l_puppetMaster); else ModUi.ShowAlert("Selected player is too far away or obstructed"); diff --git a/ml_pmc/PoseCopycat.cs b/ml_pmc/PoseCopycat.cs index 16a4ece..d4400b4 100644 --- a/ml_pmc/PoseCopycat.cs +++ b/ml_pmc/PoseCopycat.cs @@ -2,7 +2,7 @@ using ABI_RC.Systems.IK; using ABI_RC.Systems.IK.SubSystems; using ABI_RC.Systems.InputManagement; -using ABI_RC.Systems.MovementSystem; +using ABI_RC.Systems.Movement; using RootMotion.FinalIK; using UnityEngine; @@ -57,7 +57,7 @@ namespace ml_pmc // Unity events void Update() { - m_sitting = (MovementSystem.Instance.lastSeat != null); + m_sitting = BetterBetterCharacterController.Instance.IsSitting(); if(m_active) { diff --git a/ml_pmc/Properties/AssemblyInfo.cs b/ml_pmc/Properties/AssemblyInfo.cs index d97b88d..518b369 100644 --- a/ml_pmc/Properties/AssemblyInfo.cs +++ b/ml_pmc/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_pmc.PlayerMovementCopycat), "PlayerMovementCopycat", "1.0.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_pmc.PlayerMovementCopycat), "PlayerMovementCopycat", "1.0.5-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPriority(3)] [assembly: MelonLoader.MelonAdditionalDependencies("BTKUILib")] diff --git a/ml_pmc/ml_pmc.csproj b/ml_pmc/ml_pmc.csproj index 9be3650..fb7fa59 100644 --- a/ml_pmc/ml_pmc.csproj +++ b/ml_pmc/ml_pmc.csproj @@ -7,7 +7,7 @@ SDraw None PlayerMovementCopycat - 1.0.4 + 1.0.5 @@ -45,6 +45,16 @@ false false + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\EasyCharacterMovement.CharacterMovement.dll + false + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\EasyCharacterMovement.Characters.dll + false + false + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\MelonLoader.dll false diff --git a/ml_prm/GravityInfluencer.cs b/ml_prm/GravityInfluencer.cs new file mode 100644 index 0000000..3645439 --- /dev/null +++ b/ml_prm/GravityInfluencer.cs @@ -0,0 +1,29 @@ +using ABI.CCK.Components; +using ABI_RC.Systems.Movement; +using UnityEngine; + +namespace ml_prm +{ + [DisallowMultipleComponent] + class GravityInfluencer : MonoBehaviour + { + Rigidbody m_rigidBody = null; + PhysicsInfluencer m_physicsInfluencer = null; + bool m_activeGravity = true; + + void Start() + { + m_rigidBody = this.GetComponent(); + m_physicsInfluencer = this.GetComponent(); + } + + void FixedUpdate() + { + m_rigidBody.useGravity = false; + if(m_activeGravity && ((m_physicsInfluencer == null) || !m_physicsInfluencer.enableInfluence || !m_physicsInfluencer.GetSubmerged())) + m_rigidBody.AddForce(BetterBetterCharacterController.Instance.GravityResult.AppliedGravity * m_rigidBody.mass); + } + + public void SetActiveGravity(bool p_state) => m_activeGravity = p_state; + } +} diff --git a/ml_prm/Main.cs b/ml_prm/Main.cs index f27879a..fda596e 100644 --- a/ml_prm/Main.cs +++ b/ml_prm/Main.cs @@ -4,8 +4,9 @@ using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.Player; using ABI_RC.Core.Util.AssetFiltering; using ABI_RC.Systems.Camera.VisualMods; +using ABI_RC.Systems.IK; using ABI_RC.Systems.IK.SubSystems; -using ABI_RC.Systems.MovementSystem; +using ABI_RC.Systems.Movement; using System; using System.Collections.Generic; using System.Linq; @@ -15,6 +16,8 @@ namespace ml_prm { public class PlayerRagdollMod : MelonLoader.MelonMod { + static readonly Type[] ms_teleportTypes = { typeof(UnityEngine.Vector3), typeof(bool), typeof(bool), typeof(UnityEngine.Quaternion?) }; + static PlayerRagdollMod ms_instance = null; RagdollController m_localController = null; @@ -63,19 +66,13 @@ namespace ml_prm null ); HarmonyInstance.Patch( - typeof(MovementSystem).GetMethod(nameof(MovementSystem.ChangeFlight)), + typeof(BetterBetterCharacterController).GetMethod(nameof(BetterBetterCharacterController.ChangeFlight)), null, new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnChangeFlight_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) ); HarmonyInstance.Patch( - typeof(MovementSystem).GetMethod(nameof(MovementSystem.TeleportToPosRot)), - null, - new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnPlayerTeleport_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) - ); - HarmonyInstance.Patch( - typeof(DroneMode).GetMethod(nameof(DroneMode.Disable)), - null, - new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnDroneModeDisable_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) + typeof(IKSystem).GetMethod("OnPreSolverUpdateActiveOffset", BindingFlags.Instance | BindingFlags.NonPublic), + new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnOffsetUpdate_Prefix), BindingFlags.Static | BindingFlags.NonPublic)) ); // Whitelist the toggle script @@ -228,32 +225,20 @@ namespace ml_prm } } - static void OnPlayerTeleport_Postfix() => ms_instance?.OnPlayerTeleport(); - void OnPlayerTeleport() + static bool OnOffsetUpdate_Prefix(ref IKSystem __instance) => ms_instance.OnOffsetUpdate(__instance); + bool OnOffsetUpdate(IKSystem p_instance) { + bool l_result = true; try { if(m_localController != null) - m_localController.OnPlayerTeleport(); - } - catch(Exception e) - { - MelonLoader.MelonLogger.Error(e); - } - } - - static void OnDroneModeDisable_Postfix() => ms_instance?.OnDroneModeDisable(); - void OnDroneModeDisable() - { - try - { - if(m_localController != null) - m_localController.OnDroneModeDisable(); + l_result = !m_localController.ShoudlDisableHeadOffset(); } catch(Exception e) { MelonLoader.MelonLogger.Error(e); } + return l_result; } } } diff --git a/ml_prm/ModUi.cs b/ml_prm/ModUi.cs index b19f00f..98a36bb 100644 --- a/ml_prm/ModUi.cs +++ b/ml_prm/ModUi.cs @@ -90,19 +90,19 @@ namespace ml_prm ms_uiElements.Add(l_modCategory.AddToggle("Fall damage", "Enable ragdoll when falling from height", Settings.FallDamage)); (ms_uiElements[(int)UiIndex.FallDamage] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.FallDamage, state); - ms_uiElements.Add(l_modRoot.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f)); + ms_uiElements.Add(l_modCategory.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f)); (ms_uiElements[(int)UiIndex.VelocityMultiplier] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.VelocityMultiplier, value); - ms_uiElements.Add(l_modRoot.AddSlider("Movement drag", "Movement resistance", Settings.MovementDrag, 0f, 50f)); + ms_uiElements.Add(l_modCategory.AddSlider("Movement drag", "Movement resistance", Settings.MovementDrag, 0f, 50f)); (ms_uiElements[(int)UiIndex.MovementDrag] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.MovementDrag, value); - ms_uiElements.Add(l_modRoot.AddSlider("Angular movement drag", "Rotation movement resistance", Settings.AngularDrag, 0f, 50f)); + ms_uiElements.Add(l_modCategory.AddSlider("Angular movement drag", "Rotation movement resistance", Settings.AngularDrag, 0f, 50f)); (ms_uiElements[(int)UiIndex.AngularDrag] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.AngularDrag, value); - ms_uiElements.Add(l_modRoot.AddSlider("Recover delay (seconds)", "Recover delay for automatic recover", Settings.RecoverDelay, 1f, 10f)); + ms_uiElements.Add(l_modCategory.AddSlider("Recover delay (seconds)", "Recover delay for automatic recover", Settings.RecoverDelay, 1f, 10f)); (ms_uiElements[(int)UiIndex.RecoverDelay] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.RecoverDelay, value); - ms_uiElements.Add(l_modRoot.AddSlider("Fall limit", "Height limit for fall damage", Settings.FallLimit, 0f, 100f)); + ms_uiElements.Add(l_modCategory.AddSlider("Fall limit", "Height limit for fall damage", Settings.FallLimit, 0f, 100f)); (ms_uiElements[(int)UiIndex.FallLimit] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.FallLimit, value); l_modCategory.AddButton("Reset settings", "", "Reset mod settings to default").OnPress += Reset; diff --git a/ml_prm/Properties/AssemblyInfo.cs b/ml_prm/Properties/AssemblyInfo.cs index f2a0605..3b540bd 100644 --- a/ml_prm/Properties/AssemblyInfo.cs +++ b/ml_prm/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.3-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPriority(2)] [assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")] diff --git a/ml_prm/RagdollController.cs b/ml_prm/RagdollController.cs index d476751..2ebce87 100644 --- a/ml_prm/RagdollController.cs +++ b/ml_prm/RagdollController.cs @@ -1,11 +1,10 @@ using ABI.CCK.Components; using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.Player; -using ABI_RC.Systems.Camera; using ABI_RC.Systems.IK; using ABI_RC.Systems.IK.SubSystems; using ABI_RC.Systems.InputManagement; -using ABI_RC.Systems.MovementSystem; +using ABI_RC.Systems.Movement; using RootMotion.Dynamics; using RootMotion.FinalIK; using System.Collections; @@ -21,6 +20,7 @@ namespace ml_prm public static RagdollController Instance { get; private set; } = null; + bool m_inVR = false; VRIK m_vrIK = null; bool m_applyHipsPosition = false; bool m_applyHipsRotation = false; @@ -36,6 +36,7 @@ namespace ml_prm readonly List> m_boneLinks = null; readonly List> m_jointAnchors = null; readonly List m_physicsInfluencers = null; + readonly List m_gravityInfluencers = null; bool m_avatarReady = false; Coroutine m_initCoroutine = null; @@ -62,6 +63,7 @@ namespace ml_prm m_boneLinks = new List>(); m_jointAnchors = new List>(); m_physicsInfluencers = new List(); + m_gravityInfluencers = new List(); } // Unity events @@ -82,7 +84,7 @@ namespace ml_prm m_puppetRoot.localPosition = Vector3.zero; m_puppetRoot.localRotation = Quaternion.identity; - m_ragdollTrigger = MovementSystem.Instance.proxyCollider.gameObject.AddComponent(); + m_ragdollTrigger = BetterBetterCharacterController.Instance.NonKinematicProxy.gameObject.AddComponent(); m_ragdollTrigger.enabled = false; Settings.MovementDragChange += this.OnMovementDragChange; @@ -92,6 +94,8 @@ namespace ml_prm Settings.BouncinessChange += this.OnPhysicsMaterialChange; Settings.BuoyancyChange += this.OnBuoyancyChange; Settings.FallDamageChange += this.OnFallDamageChange; + + BetterBetterCharacterController.OnTeleport.AddListener(this.OnPlayerTeleport); } void OnDestroy() @@ -129,14 +133,16 @@ namespace ml_prm Settings.BouncinessChange -= this.OnPhysicsMaterialChange; Settings.BuoyancyChange -= this.OnBuoyancyChange; Settings.FallDamageChange -= this.OnFallDamageChange; + + BetterBetterCharacterController.OnTeleport.RemoveListener(this.OnPlayerTeleport); } void Update() { - if(m_avatarReady && !m_enabled && Settings.FallDamage && !MovementSystem.Instance.flying) + if(m_avatarReady && !m_enabled && Settings.FallDamage && !BetterBetterCharacterController.Instance.IsFlying()) { - bool l_grounded = MovementSystem.Instance.IsGroundedRaw(); - bool l_inWater = MovementSystem.Instance.GetSubmerged(); + bool l_grounded = BetterBetterCharacterController.Instance.IsGrounded(); + bool l_inWater = BetterBetterCharacterController.Instance.IsInWater(); if(m_inAir && l_grounded && !l_inWater && (m_inAirDistance > Settings.FallLimit)) { m_inAirDistance = 0f; @@ -151,12 +157,6 @@ namespace ml_prm if(m_avatarReady && m_enabled) { m_inAirDistance = 0f; - - Vector3 l_dif = m_puppetReferences.hips.position - m_ragdollLastPos; - PlayerSetup.Instance.transform.position += l_dif; - m_puppetReferences.hips.position -= l_dif; - m_ragdollLastPos = m_puppetReferences.hips.position; - BodySystem.TrackingPositionWeight = 0f; } @@ -166,13 +166,13 @@ namespace ml_prm m_velocity = (m_velocity + (l_pos - m_lastPosition) / Time.deltaTime) * 0.5f; if(m_inAir) { - m_inAirDistance += (m_lastPosition - l_pos).y; + m_inAirDistance += (Quaternion.Inverse(PlayerSetup.Instance.transform.rotation) * (m_lastPosition - l_pos)).y; m_inAirDistance = Mathf.Clamp(m_inAirDistance, 0f, float.MaxValue); } m_lastPosition = l_pos; - if(!m_reachedGround && MovementSystem.Instance.IsGrounded()) + if(!m_reachedGround && BetterBetterCharacterController.Instance.IsOnGround()) { m_groundedTime += Time.deltaTime; if(m_groundedTime >= 0.25f) @@ -196,13 +196,24 @@ namespace ml_prm if((m_ragdollTrigger != null) && m_ragdollTrigger.GetStateWithReset() && m_avatarReady && !m_enabled && Settings.PointersReaction) SwitchRagdoll(); - if(Settings.Hotkey && Input.GetKeyDown(Settings.HotkeyKey) && !ViewManager.Instance.isGameMenuOpen()) + if(Settings.Hotkey && Input.GetKeyDown(Settings.HotkeyKey) && !ViewManager.Instance.IsAnyMenuOpen) SwitchRagdoll(); if(m_avatarReady && m_enabled && CVRInputManager.Instance.jump && Settings.JumpRecover) SwitchRagdoll(); } + void FixedUpdate() + { + if(m_avatarReady && m_enabled) + { + Vector3 l_dif = m_puppetReferences.hips.position - m_ragdollLastPos; + PlayerSetup.Instance.transform.position += l_dif; + m_puppetReferences.hips.position -= l_dif; + m_ragdollLastPos = m_puppetReferences.hips.position; + } + } + void LateUpdate() { if(m_avatarReady) @@ -223,6 +234,8 @@ namespace ml_prm // Game events internal void OnAvatarClear() { + m_inVR = Utils.IsInVR(); + if(m_initCoroutine != null) { StopCoroutine(m_initCoroutine); @@ -257,6 +270,7 @@ namespace ml_prm m_boneLinks.Clear(); m_jointAnchors.Clear(); m_physicsInfluencers.Clear(); + m_gravityInfluencers.Clear(); m_reachedGround = true; m_groundedTime = 0f; m_downTime = float.MinValue; @@ -267,6 +281,8 @@ namespace ml_prm internal void OnAvatarSetup() { + m_inVR = Utils.IsInVR(); + if(PlayerSetup.Instance._animator.isHuman) { BipedRagdollReferences l_avatarReferences = BipedRagdollReferences.FromAvatar(PlayerSetup.Instance._animator); @@ -322,9 +338,13 @@ namespace ml_prm l_body.isKinematic = true; l_body.angularDrag = Settings.AngularDrag; l_body.drag = (Utils.IsWorldSafe() ? Settings.MovementDrag : 1f); - l_body.useGravity = (!Utils.IsWorldSafe() || Settings.Gravity); + l_body.useGravity = false; l_body.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; l_body.gameObject.layer = LayerMask.NameToLayer("PlayerLocal"); + + GravityInfluencer l_gravInfluencer = l_body.gameObject.AddComponent(); + l_gravInfluencer.SetActiveGravity((!Utils.IsWorldSafe() || Settings.Gravity)); + m_gravityInfluencers.Add(l_gravInfluencer); } CharacterJoint l_joint = l_puppetTransforms[i].GetComponent(); @@ -338,9 +358,12 @@ namespace ml_prm Collider l_collider = l_puppetTransforms[i].GetComponent(); if(l_collider != null) { - Physics.IgnoreCollision(l_collider, MovementSystem.Instance.controller, true); - Physics.IgnoreCollision(l_collider, MovementSystem.Instance.proxyCollider, true); - Physics.IgnoreCollision(l_collider, MovementSystem.Instance.forceCollider, true); + Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.Collider, true); + Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.KinematicTriggerProxy.Collider, true); + Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.NonKinematicProxy.Collider, true); + Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.SphereProxy.Collider, true); + BetterBetterCharacterController.Instance.IgnoreCollision(l_collider, true); + l_collider.sharedMaterial = m_physicsMaterial; l_collider.material = m_physicsMaterial; m_colliders.Add(l_collider); @@ -460,7 +483,7 @@ namespace ml_prm internal void OnChangeFlight() { - if(m_avatarReady && m_enabled && MovementSystem.Instance.flying) + if(m_avatarReady && m_enabled && BetterBetterCharacterController.Instance.IsFlying()) { m_forcedSwitch = true; SwitchRagdoll(); @@ -470,18 +493,19 @@ namespace ml_prm } } - internal void OnPlayerTeleport() + void OnPlayerTeleport(BetterBetterCharacterController.PlayerMoveOffset p_offset) { - ResetStates(); + try + { + ResetStates(); - if(m_avatarReady && m_enabled) - m_ragdollLastPos = m_puppetReferences.hips.position; - } - - internal void OnDroneModeDisable() - { - if(m_avatarReady && m_enabled) - MovementSystem.Instance.canRot = false; + if(m_avatarReady && m_enabled) + m_ragdollLastPos = m_puppetReferences.hips.position; + } + catch(System.Exception e) + { + MelonLoader.MelonLogger.Error(e); + } } // IK updates @@ -529,10 +553,10 @@ namespace ml_prm if(m_avatarReady) { bool l_gravity = (!Utils.IsWorldSafe() || p_state); - foreach(Rigidbody l_body in m_rigidBodies) - l_body.useGravity = l_gravity; foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers) l_influencer.enabled = l_gravity; + foreach(GravityInfluencer l_influencer in m_gravityInfluencers) + l_influencer.SetActiveGravity(l_gravity); if(!l_gravity) { @@ -584,10 +608,10 @@ namespace ml_prm { if(CanRagdoll()) { - if(MovementSystem.Instance.flying) - MovementSystem.Instance.ChangeFlight(false); - MovementSystem.Instance.SetImmobilized(true); - MovementSystem.Instance.ClearFluidVolumes(); + if(BetterBetterCharacterController.Instance.IsFlying()) + BetterBetterCharacterController.Instance.ChangeFlight(false,true); + BetterBetterCharacterController.Instance.SetImmobilized(true); + BetterBetterCharacterController.Instance.ClearFluidVolumes(); BodySystem.TrackingPositionWeight = 0f; m_applyHipsPosition = IKSystem.Instance.applyOriginalHipPosition; IKSystem.Instance.applyOriginalHipPosition = true; @@ -631,13 +655,13 @@ namespace ml_prm { if(CanUnragdoll()) { - MovementSystem.Instance.TeleportTo(m_puppetReferences.hips.position, new Vector3(0f, PlayerSetup.Instance.GetActiveCamera().transform.rotation.eulerAngles.y, 0f)); + BetterBetterCharacterController.Instance.TeleportPlayerTo(m_puppetReferences.hips.position, PlayerSetup.Instance.transform.rotation.eulerAngles, false, false); TryRestoreMovement(); if(!Utils.IsWorldSafe()) { - Vector3 l_vec = MovementSystem.Instance.GetAppliedGravity(); + Vector3 l_vec = BetterBetterCharacterController.Instance.GetVelocity(); l_vec.y = Mathf.Clamp(l_vec.y, float.MinValue, 0f); - MovementSystem.Instance.SetAppliedGravity(l_vec); + BetterBetterCharacterController.Instance.SetVelocity(l_vec); } BodySystem.TrackingPositionWeight = 1f; IKSystem.Instance.applyOriginalHipPosition = m_applyHipsPosition; @@ -698,7 +722,7 @@ namespace ml_prm { bool l_result = m_reachedGround; l_result &= !BodySystem.isCalibrating; - l_result &= (MovementSystem.Instance.lastSeat == null); + l_result &= !BetterBetterCharacterController.Instance.IsSitting(); l_result &= ((CombatSystem.Instance == null) || !CombatSystem.Instance.isDown); return (l_result || m_forcedSwitch); } @@ -710,18 +734,19 @@ namespace ml_prm return (l_result || m_forcedSwitch); } + internal bool ShoudlDisableHeadOffset() + { + return (!m_inVR && m_enabled && (m_vrIK != null)); + } + static void TryRestoreMovement() { bool l_state = true; l_state &= ((CombatSystem.Instance == null) || !CombatSystem.Instance.isDown); - l_state &= (MovementSystem.Instance.lastSeat == null); + l_state &= !BetterBetterCharacterController.Instance.IsSitting(); if(l_state) - { - MovementSystem.Instance.SetImmobilized(false); - if(PortableCamera.Instance.CheckModActive(typeof(ABI_RC.Systems.Camera.VisualMods.DroneMode))) - MovementSystem.Instance.canRot = false; - } + BetterBetterCharacterController.Instance.SetImmobilized(false); } } } diff --git a/ml_prm/Utils.cs b/ml_prm/Utils.cs index 909f656..ff88aae 100644 --- a/ml_prm/Utils.cs +++ b/ml_prm/Utils.cs @@ -1,6 +1,6 @@ using ABI.CCK.Components; using ABI_RC.Core.Savior; -using ABI_RC.Systems.MovementSystem; +using ABI_RC.Systems.Movement; using System.Collections.Generic; using System.Reflection; using UnityEngine; @@ -9,9 +9,7 @@ namespace ml_prm { static class Utils { - static readonly FieldInfo ms_groundedRaw = typeof(MovementSystem).GetField("_isGroundedRaw", BindingFlags.NonPublic | BindingFlags.Instance); - static readonly FieldInfo ms_appliedGravity = typeof(MovementSystem).GetField("_appliedGravity", BindingFlags.NonPublic | BindingFlags.Instance); - static readonly FieldInfo ms_touchingVolumes = typeof(MovementSystem).GetField("_touchingVolumes", BindingFlags.NonPublic | BindingFlags.Instance); + static readonly FieldInfo ms_touchingVolumes = typeof(BetterBetterCharacterController).GetField("_currentlyTouchingFluidVolumes", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_referencePoints = typeof(PhysicsInfluencer).GetField("_referencePoints", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_influencerTouchingVolumes = typeof(PhysicsInfluencer).GetField("_touchingVolumes", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_influencerSubmergedColliders = typeof(PhysicsInfluencer).GetField("_submergedColliders", BindingFlags.NonPublic | BindingFlags.Instance); @@ -31,10 +29,7 @@ namespace ml_prm return l_result; } - public static bool IsGroundedRaw(this MovementSystem p_instance) => (bool)ms_groundedRaw.GetValue(p_instance); - public static Vector3 GetAppliedGravity(this MovementSystem p_instance) => (Vector3)ms_appliedGravity.GetValue(p_instance); - public static void SetAppliedGravity(this MovementSystem p_instance, Vector3 p_vec) => ms_appliedGravity.SetValue(p_instance, p_vec); - public static void ClearFluidVolumes(this MovementSystem p_instance) => (ms_touchingVolumes.GetValue(p_instance) as List)?.Clear(); + public static void ClearFluidVolumes(this BetterBetterCharacterController p_instance) => (ms_touchingVolumes.GetValue(p_instance) as List)?.Clear(); public static void CopyGlobal(this Transform p_source, Transform p_target) { diff --git a/ml_prm/ml_prm.csproj b/ml_prm/ml_prm.csproj index 6c579ab..877c39d 100644 --- a/ml_prm/ml_prm.csproj +++ b/ml_prm/ml_prm.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 PlayerRagdollMod - 1.1.2 + 1.1.3 SDraw None PlayerRagdollMod @@ -41,6 +41,16 @@ false false + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\EasyCharacterMovement.CharacterMovement.dll + false + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\EasyCharacterMovement.Characters.dll + false + false + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\MelonLoader.dll false diff --git a/ml_vei/Properties/AssemblyInfo.cs b/ml_vei/Properties/AssemblyInfo.cs index 73d71dd..1fb0b47 100644 --- a/ml_vei/Properties/AssemblyInfo.cs +++ b/ml_vei/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -[assembly: MelonLoader.MelonInfo(typeof(ml_vei.ViveExtendedInput), "ViveExtendedInput", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_vei.ViveExtendedInput), "ViveExtendedInput", "1.0.1-ex", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_vei/ml_vei.csproj b/ml_vei/ml_vei.csproj index d55a724..ffd4ad5 100644 --- a/ml_vei/ml_vei.csproj +++ b/ml_vei/ml_vei.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 ViveExtendedInput - 1.0.0 + 1.0.1 SDraw None ViveExtendedInput