mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Scaled jump
Minor changes
This commit is contained in:
parent
08b1909d52
commit
e73dd54e7b
11 changed files with 435 additions and 216 deletions
|
@ -2,7 +2,7 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ml_amt
|
namespace ml_amt.Fixes
|
||||||
{
|
{
|
||||||
class AnimatorAnalyzer
|
class AnimatorAnalyzer
|
||||||
{
|
{
|
60
ml_amt/Fixes/AnimatorOverrideControllerFix.cs
Normal file
60
ml_amt/Fixes/AnimatorOverrideControllerFix.cs
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
using ABI_RC.Core;
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace ml_amt.Fixes
|
||||||
|
{
|
||||||
|
static class AnimatorOverrideControllerFix
|
||||||
|
{
|
||||||
|
internal static void Init(HarmonyLib.Harmony p_instance)
|
||||||
|
{
|
||||||
|
// AAS overriding fix
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.SetOverrideAnimation)),
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(AnimatorOverrideControllerFix).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(AnimatorOverrideControllerFix).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.RestoreOverrideAnimation)),
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(AnimatorOverrideControllerFix).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(AnimatorOverrideControllerFix).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnimatorOverrideController runtime animation replacement fix
|
||||||
|
static void OnOverride_Prefix(ref CVRAnimatorManager __instance, out AnimatorAnalyzer __state)
|
||||||
|
{
|
||||||
|
__state = new AnimatorAnalyzer();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(Settings.OverrideFix && (__instance.animator != null))
|
||||||
|
{
|
||||||
|
__state.AnalyzeFrom(__instance.animator);
|
||||||
|
if(__state.IsEnabled())
|
||||||
|
__instance.animator.enabled = false;
|
||||||
|
__instance.animator.WriteDefaultValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception l_exception)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void OnOverride_Postfix(ref CVRAnimatorManager __instance, AnimatorAnalyzer __state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(Settings.OverrideFix && (__instance.animator != null))
|
||||||
|
{
|
||||||
|
__state.ApplyTo(__instance.animator);
|
||||||
|
if(__state.IsEnabled())
|
||||||
|
__instance.animator.Update(0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception l_exception)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
ml_amt/Fixes/FBTDetectionFix.cs
Normal file
57
ml_amt/Fixes/FBTDetectionFix.cs
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
using ABI.CCK.Components;
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using ABI_RC.Systems.IK.SubSystems;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace ml_amt.Fixes
|
||||||
|
{
|
||||||
|
static class FBTDetectionFix
|
||||||
|
{
|
||||||
|
static readonly MethodInfo[] ms_fbtDetouredMethods =
|
||||||
|
{
|
||||||
|
typeof(PlayerSetup).GetMethod("Update", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
typeof(PlayerSetup).GetMethod("FixedUpdate", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
typeof(PlayerSetup).GetMethod("UpdatePlayerAvatarMovementData", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
typeof(CVRParameterStreamEntry).GetMethod(nameof(CVRParameterStreamEntry.CheckUpdate))
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool ms_fbtDetour = false;
|
||||||
|
|
||||||
|
internal static void Init(HarmonyLib.Harmony p_instance)
|
||||||
|
{
|
||||||
|
// FBT detour
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(BodySystem).GetMethod(nameof(BodySystem.FBTAvailable)),
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(FBTDetectionFix).GetMethod(nameof(OnFBTAvailable_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
foreach(MethodInfo l_detoured in ms_fbtDetouredMethods)
|
||||||
|
{
|
||||||
|
p_instance.Patch(
|
||||||
|
l_detoured,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(FBTDetectionFix).GetMethod(nameof(FBTDetour_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(FBTDetectionFix).GetMethod(nameof(FBTDetour_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FBT detection override
|
||||||
|
static void FBTDetour_Prefix()
|
||||||
|
{
|
||||||
|
ms_fbtDetour = true;
|
||||||
|
}
|
||||||
|
static void FBTDetour_Postfix()
|
||||||
|
{
|
||||||
|
ms_fbtDetour = false;
|
||||||
|
}
|
||||||
|
static bool OnFBTAvailable_Prefix(ref bool __result)
|
||||||
|
{
|
||||||
|
if(ms_fbtDetour && !BodySystem.isCalibratedAsFullBody)
|
||||||
|
{
|
||||||
|
__result = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
114
ml_amt/Fixes/MovementJumpFix.cs
Normal file
114
ml_amt/Fixes/MovementJumpFix.cs
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
using ABI.CCK.Components;
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using ABI_RC.Core.Savior;
|
||||||
|
using ABI_RC.Systems.MovementSystem;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ml_amt.Fixes
|
||||||
|
{
|
||||||
|
static class MovementJumpFix
|
||||||
|
{
|
||||||
|
static FieldInfo ms_avatarHeight = typeof(PlayerSetup).GetField("_avatarHeight", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
|
||||||
|
static float ms_playerHeight = 1f;
|
||||||
|
|
||||||
|
internal static void Init(HarmonyLib.Harmony p_instance)
|
||||||
|
{
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupAvatar)),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(MovementJumpFix).GetMethod(nameof(OnSetupAvatar_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(CVRWorld).GetMethod("SetupWorldRules", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(MovementJumpFix).GetMethod(nameof(OnWorldRulesSetup_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(PlayerSetup).GetMethod("SetupIKScaling", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(MovementJumpFix).GetMethod(nameof(OnSetupIKScaling_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
|
||||||
|
Settings.ScaledJumpChange += OnScaledJumpChange;
|
||||||
|
MelonLoader.MelonCoroutines.Start(WaitForGameSettings());
|
||||||
|
}
|
||||||
|
|
||||||
|
static IEnumerator WaitForGameSettings()
|
||||||
|
{
|
||||||
|
while(MetaPort.Instance == null)
|
||||||
|
yield return null;
|
||||||
|
while(MetaPort.Instance.settings == null)
|
||||||
|
yield return null;
|
||||||
|
|
||||||
|
ms_playerHeight = MetaPort.Instance.settings.GetSettingInt("GeneralPlayerHeight") * 0.01f;
|
||||||
|
MetaPort.Instance.settings.settingIntChanged.AddListener(OnGameSettingIntChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patches
|
||||||
|
static void OnSetupAvatar_Postfix()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetScaledJump(Settings.ScaledJump);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void OnWorldRulesSetup_Postfix()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetScaledJump(Settings.ScaledJump);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnSetupIKScaling_Postfix()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetScaledJump(Settings.ScaledJump);
|
||||||
|
}
|
||||||
|
catch(Exception l_exception)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mod settings
|
||||||
|
static void OnScaledJumpChange(bool p_state)
|
||||||
|
{
|
||||||
|
SetScaledJump(p_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Game settings
|
||||||
|
static void OnGameSettingIntChange(string p_name, int p_value)
|
||||||
|
{
|
||||||
|
if(p_name == "GeneralPlayerHeight")
|
||||||
|
{
|
||||||
|
ms_playerHeight = p_value * 0.01f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arbitrary
|
||||||
|
static void SetScaledJump(bool p_state)
|
||||||
|
{
|
||||||
|
if(Utils.IsWorldSafe())
|
||||||
|
{
|
||||||
|
if(p_state)
|
||||||
|
MovementSystem.Instance.jumpHeight = Mathf.Clamp(Utils.GetWorldJumpHeight() * ((float)ms_avatarHeight.GetValue(PlayerSetup.Instance) / ms_playerHeight), float.MinValue, Utils.GetWorldMovementLimit());
|
||||||
|
else
|
||||||
|
MovementSystem.Instance.jumpHeight = Utils.GetWorldJumpHeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
ml_amt/Fixes/PlayerColliderFix.cs
Normal file
123
ml_amt/Fixes/PlayerColliderFix.cs
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using ABI_RC.Systems.MovementSystem;
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ml_amt.Fixes
|
||||||
|
{
|
||||||
|
static class PlayerColliderFix
|
||||||
|
{
|
||||||
|
static FieldInfo ms_initialAvatarHeight = typeof(PlayerSetup).GetField("_initialAvatarHeight", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
static FieldInfo ms_avatarHeight = typeof(PlayerSetup).GetField("_avatarHeight", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
|
||||||
|
internal static void Init(HarmonyLib.Harmony p_instance)
|
||||||
|
{
|
||||||
|
// Alternative collider height and radius
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(MovementSystem).GetMethod("UpdateCollider", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(PlayerColliderFix).GetMethod(nameof(OnUpdateCollider_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
p_instance.Patch(
|
||||||
|
typeof(PlayerSetup).GetMethod("SetupIKScaling", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(PlayerColliderFix).GetMethod(nameof(OnSetupIKScaling_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
|
||||||
|
Settings.CollisionScaleChange += OnCollisionScaleChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alternative collider size
|
||||||
|
static bool OnUpdateCollider_Prefix(
|
||||||
|
ref MovementSystem __instance,
|
||||||
|
bool __0, // updateRadius
|
||||||
|
CharacterController ___controller,
|
||||||
|
float ____avatarHeight,
|
||||||
|
float ____avatarHeightFactor,
|
||||||
|
float ____minimumColliderRadius,
|
||||||
|
Vector3 ____colliderCenter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(!Settings.CollisionScale)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(___controller != null)
|
||||||
|
{
|
||||||
|
float l_scaledHeight = ____avatarHeight * ____avatarHeightFactor;
|
||||||
|
float l_newRadius = (__0 ? Mathf.Max(____minimumColliderRadius, l_scaledHeight / 6f) : ___controller.radius);
|
||||||
|
|
||||||
|
float l_newHeight = Mathf.Max(l_scaledHeight, l_newRadius * 2f);
|
||||||
|
float l_currentHeight = ___controller.height;
|
||||||
|
|
||||||
|
Vector3 l_newCenter = ____colliderCenter;
|
||||||
|
l_newCenter.y = (l_newHeight + 0.075f) * 0.5f; // Idk where 0.075f has come from
|
||||||
|
Vector3 l_currentCenter = ___controller.center;
|
||||||
|
|
||||||
|
if(__0 || (Mathf.Abs(l_currentHeight - l_newHeight) > (l_currentHeight * 0.05f)) || (Vector3.Distance(l_currentCenter, l_newCenter) > (l_currentHeight * 0.05f)))
|
||||||
|
{
|
||||||
|
if(__0)
|
||||||
|
___controller.radius = l_newRadius;
|
||||||
|
___controller.height = l_newHeight;
|
||||||
|
___controller.center = l_newCenter;
|
||||||
|
|
||||||
|
__instance.groundDistance = l_newRadius;
|
||||||
|
|
||||||
|
if(__instance.proxyCollider != null)
|
||||||
|
{
|
||||||
|
if(__0)
|
||||||
|
__instance.proxyCollider.radius = l_newRadius;
|
||||||
|
__instance.proxyCollider.height = l_newHeight;
|
||||||
|
__instance.proxyCollider.center = new Vector3(0f, l_newCenter.y, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(__instance.forceObject != null)
|
||||||
|
__instance.forceObject.transform.localScale = new Vector3(l_newRadius + 0.1f, l_newHeight, l_newRadius + 0.1f);
|
||||||
|
if(__instance.groundCheck != null)
|
||||||
|
__instance.groundCheck.localPosition = ____colliderCenter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception l_exception)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
static void OnSetupIKScaling_Postfix(
|
||||||
|
ref PlayerSetup __instance,
|
||||||
|
float ____avatarHeight
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(!Settings.CollisionScale)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
__instance._movementSystem.UpdateAvatarHeight(Mathf.Clamp(____avatarHeight, 0.05f, float.MaxValue), true);
|
||||||
|
}
|
||||||
|
catch(Exception l_exception)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnCollisionScaleChange(bool p_state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(p_state)
|
||||||
|
MovementSystem.Instance.UpdateAvatarHeight((float)ms_avatarHeight.GetValue(PlayerSetup.Instance), true);
|
||||||
|
else
|
||||||
|
MovementSystem.Instance.UpdateAvatarHeight((float)ms_initialAvatarHeight.GetValue(PlayerSetup.Instance), true);
|
||||||
|
}
|
||||||
|
catch(Exception l_exception)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
199
ml_amt/Main.cs
199
ml_amt/Main.cs
|
@ -1,30 +1,18 @@
|
||||||
using ABI.CCK.Components;
|
using ABI.CCK.Components;
|
||||||
using ABI_RC.Core;
|
|
||||||
using ABI_RC.Core.Player;
|
using ABI_RC.Core.Player;
|
||||||
using ABI_RC.Systems.IK.SubSystems;
|
using ABI_RC.Systems.IK.SubSystems;
|
||||||
using ABI_RC.Systems.MovementSystem;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace ml_amt
|
namespace ml_amt
|
||||||
{
|
{
|
||||||
public class AvatarMotionTweaker : MelonLoader.MelonMod
|
public class AvatarMotionTweaker : MelonLoader.MelonMod
|
||||||
{
|
{
|
||||||
static readonly MethodInfo[] ms_fbtDetouredMethods =
|
|
||||||
{
|
|
||||||
typeof(PlayerSetup).GetMethod("Update", BindingFlags.NonPublic | BindingFlags.Instance),
|
|
||||||
typeof(PlayerSetup).GetMethod("FixedUpdate", BindingFlags.NonPublic | BindingFlags.Instance),
|
|
||||||
typeof(PlayerSetup).GetMethod("UpdatePlayerAvatarMovementData", BindingFlags.NonPublic | BindingFlags.Instance),
|
|
||||||
typeof(CVRParameterStreamEntry).GetMethod(nameof(CVRParameterStreamEntry.CheckUpdate))
|
|
||||||
};
|
|
||||||
|
|
||||||
static AvatarMotionTweaker ms_instance = null;
|
static AvatarMotionTweaker ms_instance = null;
|
||||||
|
|
||||||
MotionTweaker m_localTweaker = null;
|
MotionTweaker m_localTweaker = null;
|
||||||
|
|
||||||
static bool ms_fbtDetour = false;
|
|
||||||
|
|
||||||
public override void OnInitializeMelon()
|
public override void OnInitializeMelon()
|
||||||
{
|
{
|
||||||
if(ms_instance == null)
|
if(ms_instance == null)
|
||||||
|
@ -52,45 +40,13 @@ namespace ml_amt
|
||||||
null,
|
null,
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// FBT detour
|
// Fixes
|
||||||
HarmonyInstance.Patch(
|
Fixes.AnimatorOverrideControllerFix.Init(HarmonyInstance);
|
||||||
typeof(BodySystem).GetMethod(nameof(BodySystem.FBTAvailable)),
|
Fixes.FBTDetectionFix.Init(HarmonyInstance);
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnFBTAvailable_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
Fixes.PlayerColliderFix.Init(HarmonyInstance);
|
||||||
null
|
Fixes.MovementJumpFix.Init(HarmonyInstance);
|
||||||
);
|
|
||||||
foreach(MethodInfo l_detoured in ms_fbtDetouredMethods)
|
|
||||||
{
|
|
||||||
HarmonyInstance.Patch(
|
|
||||||
l_detoured,
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(FBTDetour_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(FBTDetour_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alternative collider height and radius
|
|
||||||
HarmonyInstance.Patch(
|
|
||||||
typeof(MovementSystem).GetMethod("UpdateCollider", BindingFlags.NonPublic | BindingFlags.Instance),
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnUpdateCollider_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
HarmonyInstance.Patch(
|
|
||||||
typeof(PlayerSetup).GetMethod("SetupIKScaling", BindingFlags.NonPublic | BindingFlags.Instance),
|
|
||||||
null,
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnSetupIKScaling_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
|
||||||
);
|
|
||||||
|
|
||||||
// AAS overriding fix
|
|
||||||
HarmonyInstance.Patch(
|
|
||||||
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.SetOverrideAnimation)),
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
|
||||||
);
|
|
||||||
HarmonyInstance.Patch(
|
|
||||||
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.RestoreOverrideAnimation)),
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
|
||||||
);
|
|
||||||
|
|
||||||
ModSupporter.Init();
|
ModSupporter.Init();
|
||||||
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
|
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
|
||||||
|
@ -130,7 +86,7 @@ namespace ml_amt
|
||||||
if(m_localTweaker != null)
|
if(m_localTweaker != null)
|
||||||
m_localTweaker.OnAvatarClear();
|
m_localTweaker.OnAvatarClear();
|
||||||
}
|
}
|
||||||
catch(System.Exception l_exception)
|
catch(Exception l_exception)
|
||||||
{
|
{
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +100,7 @@ namespace ml_amt
|
||||||
if(m_localTweaker != null)
|
if(m_localTweaker != null)
|
||||||
m_localTweaker.OnSetupAvatar();
|
m_localTweaker.OnSetupAvatar();
|
||||||
}
|
}
|
||||||
catch(System.Exception l_exception)
|
catch(Exception l_exception)
|
||||||
{
|
{
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +114,7 @@ namespace ml_amt
|
||||||
if(m_localTweaker != null)
|
if(m_localTweaker != null)
|
||||||
m_localTweaker.OnCalibrate();
|
m_localTweaker.OnCalibrate();
|
||||||
}
|
}
|
||||||
catch(System.Exception l_exception)
|
catch(Exception l_exception)
|
||||||
{
|
{
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
}
|
}
|
||||||
|
@ -172,140 +128,7 @@ namespace ml_amt
|
||||||
if(m_localTweaker != null)
|
if(m_localTweaker != null)
|
||||||
m_localTweaker.OnPlayspaceScale();
|
m_localTweaker.OnPlayspaceScale();
|
||||||
}
|
}
|
||||||
catch(System.Exception l_exception)
|
catch(Exception l_exception)
|
||||||
{
|
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FBT detection override
|
|
||||||
static void FBTDetour_Prefix()
|
|
||||||
{
|
|
||||||
ms_fbtDetour = true;
|
|
||||||
}
|
|
||||||
static void FBTDetour_Postfix()
|
|
||||||
{
|
|
||||||
ms_fbtDetour = false;
|
|
||||||
}
|
|
||||||
static bool OnFBTAvailable_Prefix(ref bool __result)
|
|
||||||
{
|
|
||||||
if(ms_fbtDetour && !BodySystem.isCalibratedAsFullBody)
|
|
||||||
{
|
|
||||||
__result = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alternative collider size
|
|
||||||
static bool OnUpdateCollider_Prefix(
|
|
||||||
ref MovementSystem __instance,
|
|
||||||
bool __0, // updateRadius
|
|
||||||
CharacterController ___controller,
|
|
||||||
float ____avatarHeight,
|
|
||||||
float ____avatarHeightFactor,
|
|
||||||
float ____minimumColliderRadius,
|
|
||||||
Vector3 ____colliderCenter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if(!Settings.CollisionScale)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if(___controller != null)
|
|
||||||
{
|
|
||||||
float l_scaledHeight = ____avatarHeight * ____avatarHeightFactor;
|
|
||||||
float l_newRadius = (__0 ? Mathf.Max(____minimumColliderRadius, l_scaledHeight / 6f) : ___controller.radius);
|
|
||||||
|
|
||||||
float l_newHeight = Mathf.Max(l_scaledHeight, l_newRadius * 2f);
|
|
||||||
float l_currentHeight = ___controller.height;
|
|
||||||
|
|
||||||
Vector3 l_newCenter = ____colliderCenter;
|
|
||||||
l_newCenter.y = (l_newHeight + 0.075f) * 0.5f; // Idk where 0.075f has come from
|
|
||||||
Vector3 l_currentCenter = ___controller.center;
|
|
||||||
|
|
||||||
if(__0 || (Mathf.Abs(l_currentHeight - l_newHeight) > (l_currentHeight * 0.05f)) || (Vector3.Distance(l_currentCenter, l_newCenter) > (l_currentHeight * 0.05f)))
|
|
||||||
{
|
|
||||||
if(__0)
|
|
||||||
___controller.radius = l_newRadius;
|
|
||||||
___controller.height = l_newHeight;
|
|
||||||
___controller.center = l_newCenter;
|
|
||||||
|
|
||||||
__instance.groundDistance = l_newRadius;
|
|
||||||
|
|
||||||
if(__instance.proxyCollider != null)
|
|
||||||
{
|
|
||||||
if(__0)
|
|
||||||
__instance.proxyCollider.radius = l_newRadius;
|
|
||||||
__instance.proxyCollider.height = l_newHeight;
|
|
||||||
__instance.proxyCollider.center = new Vector3(0f, l_newCenter.y, 0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(__instance.forceObject != null)
|
|
||||||
__instance.forceObject.transform.localScale = new Vector3(l_newRadius + 0.1f, l_newHeight, l_newRadius + 0.1f);
|
|
||||||
if(__instance.groundCheck != null)
|
|
||||||
__instance.groundCheck.localPosition = ____colliderCenter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(System.Exception l_exception)
|
|
||||||
{
|
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
static void OnSetupIKScaling_Postfix(
|
|
||||||
ref PlayerSetup __instance,
|
|
||||||
float ____avatarHeight
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if(!Settings.CollisionScale)
|
|
||||||
return;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
__instance._movementSystem.UpdateAvatarHeight(Mathf.Clamp(____avatarHeight, 0.05f, float.MaxValue), true);
|
|
||||||
}
|
|
||||||
catch(System.Exception l_exception)
|
|
||||||
{
|
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// AnimatorOverrideController runtime animation replacement fix
|
|
||||||
static void OnOverride_Prefix(ref CVRAnimatorManager __instance, out AnimatorAnalyzer __state)
|
|
||||||
{
|
|
||||||
__state = new AnimatorAnalyzer();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if(Settings.OverrideFix && (__instance.animator != null))
|
|
||||||
{
|
|
||||||
__state.AnalyzeFrom(__instance.animator);
|
|
||||||
if(__state.IsEnabled())
|
|
||||||
__instance.animator.enabled = false;
|
|
||||||
__instance.animator.WriteDefaultValues();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(System.Exception l_exception)
|
|
||||||
{
|
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void OnOverride_Postfix(ref CVRAnimatorManager __instance, AnimatorAnalyzer __state)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if(Settings.OverrideFix && (__instance.animator != null))
|
|
||||||
{
|
|
||||||
__state.ApplyTo(__instance.animator);
|
|
||||||
if(__state.IsEnabled())
|
|
||||||
__instance.animator.Update(0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(System.Exception l_exception)
|
|
||||||
{
|
{
|
||||||
MelonLoader.MelonLogger.Error(l_exception);
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ml_amt
|
||||||
bool m_bendNormalLeft = false;
|
bool m_bendNormalLeft = false;
|
||||||
bool m_bendNormalRight = false;
|
bool m_bendNormalRight = false;
|
||||||
Transform m_avatarHips = null;
|
Transform m_avatarHips = null;
|
||||||
float m_viewPointHeight = 1f;
|
float m_avatarHeight = 1f; // Initial avatar view height
|
||||||
bool m_inVR = false;
|
bool m_inVR = false;
|
||||||
bool m_fbtAnimations = true;
|
bool m_fbtAnimations = true;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ namespace ml_amt
|
||||||
// Update upright
|
// Update upright
|
||||||
Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * PlayerSetup.Instance.GetActiveCamera().transform.GetMatrix();
|
Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * PlayerSetup.Instance.GetActiveCamera().transform.GetMatrix();
|
||||||
float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue);
|
float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue);
|
||||||
float l_avatarViewHeight = Mathf.Clamp(m_viewPointHeight * GetRelativeScale(), 0f, float.MaxValue);
|
float l_avatarViewHeight = Mathf.Clamp(m_avatarHeight * GetRelativeScale(), 0f, float.MaxValue);
|
||||||
m_upright = Mathf.Clamp01((l_avatarViewHeight > 0f) ? (l_currentHeight / l_avatarViewHeight) : 0f);
|
m_upright = Mathf.Clamp01((l_avatarViewHeight > 0f) ? (l_currentHeight / l_avatarViewHeight) : 0f);
|
||||||
m_poseState = (m_upright <= Mathf.Min(m_proneLimit, m_crouchLimit)) ? PoseState.Proning : ((m_upright <= Mathf.Max(m_proneLimit, m_crouchLimit)) ? PoseState.Crouching : PoseState.Standing);
|
m_poseState = (m_upright <= Mathf.Min(m_proneLimit, m_crouchLimit)) ? PoseState.Proning : ((m_upright <= Mathf.Max(m_proneLimit, m_crouchLimit)) ? PoseState.Crouching : PoseState.Standing);
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ namespace ml_amt
|
||||||
m_locomotionOverride = false;
|
m_locomotionOverride = false;
|
||||||
m_hipsToPlayer = Vector3.zero;
|
m_hipsToPlayer = Vector3.zero;
|
||||||
m_avatarHips = null;
|
m_avatarHips = null;
|
||||||
m_viewPointHeight = 1f;
|
m_avatarHeight = 1f;
|
||||||
m_massCenter = Vector3.zero;
|
m_massCenter = Vector3.zero;
|
||||||
m_stepDistance = Vector2.zero;
|
m_stepDistance = Vector2.zero;
|
||||||
m_parameters.Clear();
|
m_parameters.Clear();
|
||||||
|
@ -201,7 +201,7 @@ namespace ml_amt
|
||||||
m_vrIk = PlayerSetup.Instance._avatar.GetComponent<VRIK>();
|
m_vrIk = PlayerSetup.Instance._avatar.GetComponent<VRIK>();
|
||||||
m_locomotionLayer = PlayerSetup.Instance._animator.GetLayerIndex("Locomotion/Emotes");
|
m_locomotionLayer = PlayerSetup.Instance._animator.GetLayerIndex("Locomotion/Emotes");
|
||||||
m_avatarHips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
m_avatarHips = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.Hips);
|
||||||
m_viewPointHeight = PlayerSetup.Instance._avatar.GetComponent<ABI.CCK.Components.CVRAvatar>().viewPosition.y;
|
m_avatarHeight = PlayerSetup.Instance._avatar.GetComponent<ABI.CCK.Components.CVRAvatar>().viewPosition.y;
|
||||||
|
|
||||||
// Parse animator parameters
|
// Parse animator parameters
|
||||||
m_parameters.Add(new AvatarParameter(AvatarParameter.ParameterType.Upright, PlayerSetup.Instance.animatorManager));
|
m_parameters.Add(new AvatarParameter(AvatarParameter.ParameterType.Upright, PlayerSetup.Instance.animatorManager));
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace ml_amt
|
||||||
FollowHips,
|
FollowHips,
|
||||||
CollisionScale,
|
CollisionScale,
|
||||||
ScaledSteps,
|
ScaledSteps,
|
||||||
|
ScaledJump,
|
||||||
MassCenter,
|
MassCenter,
|
||||||
OverrideFix
|
OverrideFix
|
||||||
};
|
};
|
||||||
|
@ -37,6 +38,7 @@ namespace ml_amt
|
||||||
public static bool FollowHips { get; private set; } = true;
|
public static bool FollowHips { get; private set; } = true;
|
||||||
public static bool MassCenter { get; private set; } = true;
|
public static bool MassCenter { get; private set; } = true;
|
||||||
public static bool ScaledSteps { get; private set; } = true;
|
public static bool ScaledSteps { get; private set; } = true;
|
||||||
|
public static bool ScaledJump { get; private set; } = false;
|
||||||
public static bool CollisionScale { get; private set; } = true;
|
public static bool CollisionScale { get; private set; } = true;
|
||||||
public static bool OverrideFix { get; private set; } = true;
|
public static bool OverrideFix { get; private set; } = true;
|
||||||
|
|
||||||
|
@ -55,6 +57,7 @@ namespace ml_amt
|
||||||
static public event Action<bool> FollowHipsChange;
|
static public event Action<bool> FollowHipsChange;
|
||||||
static public event Action<bool> MassCenterChange;
|
static public event Action<bool> MassCenterChange;
|
||||||
static public event Action<bool> ScaledStepsChange;
|
static public event Action<bool> ScaledStepsChange;
|
||||||
|
static public event Action<bool> ScaledJumpChange;
|
||||||
static public event Action<bool> CollisionScaleChange;
|
static public event Action<bool> CollisionScaleChange;
|
||||||
static public event Action<bool> OverrideFixChange;
|
static public event Action<bool> OverrideFixChange;
|
||||||
|
|
||||||
|
@ -76,11 +79,26 @@ namespace ml_amt
|
||||||
ms_category.CreateEntry(ModSetting.FollowHips.ToString(), FollowHips),
|
ms_category.CreateEntry(ModSetting.FollowHips.ToString(), FollowHips),
|
||||||
ms_category.CreateEntry(ModSetting.MassCenter.ToString(), MassCenter),
|
ms_category.CreateEntry(ModSetting.MassCenter.ToString(), MassCenter),
|
||||||
ms_category.CreateEntry(ModSetting.ScaledSteps.ToString(), ScaledSteps),
|
ms_category.CreateEntry(ModSetting.ScaledSteps.ToString(), ScaledSteps),
|
||||||
|
ms_category.CreateEntry(ModSetting.ScaledJump.ToString(), ScaledJump),
|
||||||
ms_category.CreateEntry(ModSetting.CollisionScale.ToString(), CollisionScale),
|
ms_category.CreateEntry(ModSetting.CollisionScale.ToString(), CollisionScale),
|
||||||
ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), OverrideFix)
|
ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), OverrideFix)
|
||||||
};
|
};
|
||||||
|
|
||||||
Load();
|
IKOverrideCrouch = (bool)ms_entries[(int)ModSetting.IKOverrideCrouch].BoxedValue;
|
||||||
|
CrouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f;
|
||||||
|
IKOverrideProne = (bool)ms_entries[(int)ModSetting.IKOverrideProne].BoxedValue;
|
||||||
|
ProneLimit = ((int)ms_entries[(int)ModSetting.ProneLimit].BoxedValue) * 0.01f;
|
||||||
|
PoseTransitions = (bool)ms_entries[(int)ModSetting.PoseTransitions].BoxedValue;
|
||||||
|
AdjustedMovement = (bool)ms_entries[(int)ModSetting.AdjustedMovement].BoxedValue;
|
||||||
|
IKOverrideFly = (bool)ms_entries[(int)ModSetting.IKOverrideFly].BoxedValue;
|
||||||
|
IKOverrideJump = (bool)ms_entries[(int)ModSetting.IKOverrideJump].BoxedValue;
|
||||||
|
DetectEmotes = (bool)ms_entries[(int)ModSetting.DetectEmotes].BoxedValue;
|
||||||
|
FollowHips = (bool)ms_entries[(int)ModSetting.FollowHips].BoxedValue;
|
||||||
|
MassCenter = (bool)ms_entries[(int)ModSetting.MassCenter].BoxedValue;
|
||||||
|
ScaledSteps = (bool)ms_entries[(int)ModSetting.ScaledSteps].BoxedValue;
|
||||||
|
ScaledJump = (bool)ms_entries[(int)ModSetting.ScaledJump].BoxedValue;
|
||||||
|
CollisionScale = (bool)ms_entries[(int)ModSetting.CollisionScale].BoxedValue;
|
||||||
|
OverrideFix = (bool)ms_entries[(int)ModSetting.OverrideFix].BoxedValue;
|
||||||
|
|
||||||
MelonLoader.MelonCoroutines.Start(WaitMainMenuUi());
|
MelonLoader.MelonCoroutines.Start(WaitMainMenuUi());
|
||||||
}
|
}
|
||||||
|
@ -107,24 +125,6 @@ namespace ml_amt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Load()
|
|
||||||
{
|
|
||||||
IKOverrideCrouch = (bool)ms_entries[(int)ModSetting.IKOverrideCrouch].BoxedValue;
|
|
||||||
CrouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f;
|
|
||||||
IKOverrideProne = (bool)ms_entries[(int)ModSetting.IKOverrideProne].BoxedValue;
|
|
||||||
ProneLimit = ((int)ms_entries[(int)ModSetting.ProneLimit].BoxedValue) * 0.01f;
|
|
||||||
PoseTransitions = (bool)ms_entries[(int)ModSetting.PoseTransitions].BoxedValue;
|
|
||||||
AdjustedMovement = (bool)ms_entries[(int)ModSetting.AdjustedMovement].BoxedValue;
|
|
||||||
IKOverrideFly = (bool)ms_entries[(int)ModSetting.IKOverrideFly].BoxedValue;
|
|
||||||
IKOverrideJump = (bool)ms_entries[(int)ModSetting.IKOverrideJump].BoxedValue;
|
|
||||||
DetectEmotes = (bool)ms_entries[(int)ModSetting.DetectEmotes].BoxedValue;
|
|
||||||
FollowHips = (bool)ms_entries[(int)ModSetting.FollowHips].BoxedValue;
|
|
||||||
MassCenter = (bool)ms_entries[(int)ModSetting.MassCenter].BoxedValue;
|
|
||||||
ScaledSteps = (bool)ms_entries[(int)ModSetting.ScaledSteps].BoxedValue;
|
|
||||||
CollisionScale = (bool)ms_entries[(int)ModSetting.CollisionScale].BoxedValue;
|
|
||||||
OverrideFix = (bool)ms_entries[(int)ModSetting.OverrideFix].BoxedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void OnSliderUpdate(string p_name, string p_value)
|
static void OnSliderUpdate(string p_name, string p_value)
|
||||||
{
|
{
|
||||||
if(Enum.TryParse(p_name, out ModSetting l_setting))
|
if(Enum.TryParse(p_name, out ModSetting l_setting))
|
||||||
|
@ -226,6 +226,13 @@ namespace ml_amt
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ModSetting.ScaledJump:
|
||||||
|
{
|
||||||
|
ScaledJump = bool.Parse(p_value);
|
||||||
|
ScaledJumpChange?.Invoke(ScaledJump);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case ModSetting.CollisionScale:
|
case ModSetting.CollisionScale:
|
||||||
{
|
{
|
||||||
CollisionScale = bool.Parse(p_value);
|
CollisionScale = bool.Parse(p_value);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using ABI_RC.Systems.MovementSystem;
|
using ABI.CCK.Components;
|
||||||
|
using ABI_RC.Systems.MovementSystem;
|
||||||
using RootMotion.FinalIK;
|
using RootMotion.FinalIK;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -23,6 +24,27 @@ namespace ml_amt
|
||||||
return (Keyframe[])ms_getSineKeyframes.Invoke(null, new object[] { p_mag });
|
return (Keyframe[])ms_getSineKeyframes.Invoke(null, new object[] { p_mag });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
|
||||||
|
public static float GetWorldJumpHeight()
|
||||||
|
{
|
||||||
|
float l_result = 1f;
|
||||||
|
if(CVRWorld.Instance != null)
|
||||||
|
l_result = CVRWorld.Instance.jumpHeight;
|
||||||
|
return l_result;
|
||||||
|
}
|
||||||
|
public static float GetWorldMovementLimit()
|
||||||
|
{
|
||||||
|
float l_result = 1f;
|
||||||
|
if(CVRWorld.Instance != null)
|
||||||
|
{
|
||||||
|
l_result = CVRWorld.Instance.baseMovementSpeed;
|
||||||
|
l_result *= CVRWorld.Instance.sprintMultiplier;
|
||||||
|
l_result *= CVRWorld.Instance.inAirMovementMultiplier;
|
||||||
|
l_result *= CVRWorld.Instance.flyMultiplier;
|
||||||
|
}
|
||||||
|
return l_result;
|
||||||
|
}
|
||||||
|
|
||||||
// Engine extensions
|
// Engine extensions
|
||||||
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
|
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,8 +83,12 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AnimatorAnalyzer.cs" />
|
<Compile Include="Fixes\AnimatorAnalyzer.cs" />
|
||||||
<Compile Include="AvatarParameter.cs" />
|
<Compile Include="AvatarParameter.cs" />
|
||||||
|
<Compile Include="Fixes\AnimatorOverrideControllerFix.cs" />
|
||||||
|
<Compile Include="Fixes\FBTDetectionFix.cs" />
|
||||||
|
<Compile Include="Fixes\MovementJumpFix.cs" />
|
||||||
|
<Compile Include="Fixes\PlayerColliderFix.cs" />
|
||||||
<Compile Include="ModSupporter.cs" />
|
<Compile Include="ModSupporter.cs" />
|
||||||
<Compile Include="MotionTweaker.cs" />
|
<Compile Include="MotionTweaker.cs" />
|
||||||
<Compile Include="Main.cs" />
|
<Compile Include="Main.cs" />
|
||||||
|
|
|
@ -263,16 +263,25 @@ function inp_toggle_mod_amt(_obj, _callbackName) {
|
||||||
<div id="ScaledSteps" class ="inp_toggle no-scroll" data-current="true"></div>
|
<div id="ScaledSteps" class ="inp_toggle no-scroll" data-current="true"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h4><p style="color: #7F7F7F">Avatar independent game fixes/overhauls</p></h4><br>
|
||||||
|
|
||||||
|
<div class ="row-wrapper">
|
||||||
|
<div class ="option-caption">Scaled locomotion jump: </div>
|
||||||
|
<div class ="option-input">
|
||||||
|
<div id="ScaledJump" class ="inp_toggle no-scroll" data-current="false"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class ="row-wrapper">
|
<div class ="row-wrapper">
|
||||||
<div class ="option-caption">Alternative avatar collider scale: </div>
|
<div class ="option-caption">Alternative avatar collider: </div>
|
||||||
<div class ="option-input">
|
<div class ="option-input">
|
||||||
<div id="CollisionScale" class ="inp_toggle no-scroll" data-current="true"></div>
|
<div id="CollisionScale" class ="inp_toggle no-scroll" data-current="true"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class ="row-wrapper">
|
<div class ="row-wrapper">
|
||||||
<div class ="option-caption">Fix animation overrides (chairs, etc.): </div>
|
<div class ="option-caption">Fix animator overrides (chairs, etc.): </div>
|
||||||
<div class ="option-input">
|
<div class ="option-input">
|
||||||
<div id="OverrideFix" class ="inp_toggle no-scroll" data-current="true"></div>
|
<div id="OverrideFix" class ="inp_toggle no-scroll" data-current="true"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue