Minor code changes

This commit is contained in:
SDraw 2024-03-29 15:19:00 +03:00
parent 19606527fc
commit 11287e7dc5
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
36 changed files with 329 additions and 273 deletions

View file

@ -1,6 +1,5 @@
using ABI_RC.Core.Player;
using ABI_RC.Systems.IK;
using ABI_RC.Systems.IK.SubSystems;
using System;
using System.Collections;
using System.Reflection;
@ -98,7 +97,7 @@ namespace ml_amt
if(m_localTweaker != null)
m_localTweaker.OnAvatarReinitialize();
}
catch(System.Exception e)
catch(Exception e)
{
MelonLoader.MelonLogger.Error(e);
}

View file

@ -1,5 +1,4 @@
using ABI_RC.Core.Player;
using ABI_RC.Systems.IK;
using ABI_RC.Systems.IK.SubSystems;
using ABI_RC.Systems.Movement;
using RootMotion.FinalIK;
@ -125,6 +124,8 @@ namespace ml_amt
internal void OnSetupAvatar()
{
Utils.SetAvatarTPose();
m_vrIk = PlayerSetup.Instance._avatar.GetComponent<VRIK>();
m_locomotionLayer = PlayerSetup.Instance._animator.GetLayerIndex("Locomotion/Emotes");
m_avatarScale = Mathf.Abs(PlayerSetup.Instance._avatar.transform.localScale.y);
@ -179,6 +180,8 @@ namespace ml_amt
internal void OnAvatarReinitialize()
{
// Old VRIK is destroyed by game
Utils.SetAvatarTPose();
m_vrIk = PlayerSetup.Instance._animator.GetComponent<VRIK>();
if(m_vrIk != null)
{
@ -242,25 +245,25 @@ namespace ml_amt
}
// Settings
internal void SetCrouchLimit(float p_value)
void SetCrouchLimit(float p_value)
{
if(m_ikLimits == null)
BetterBetterCharacterController.Instance.avatarCrouchLimit = Mathf.Clamp01(p_value);
}
internal void SetProneLimit(float p_value)
void SetProneLimit(float p_value)
{
if(m_ikLimits == null)
BetterBetterCharacterController.Instance.avatarProneLimit = Mathf.Clamp01(p_value);
}
internal void SetIKOverrideFly(bool p_state)
void SetIKOverrideFly(bool p_state)
{
m_ikOverrideFly = p_state;
}
internal void SetIKOverrideJump(bool p_state)
void SetIKOverrideJump(bool p_state)
{
m_ikOverrideJump = p_state;
}
internal void SetDetectEmotes(bool p_state)
void SetDetectEmotes(bool p_state)
{
m_detectEmotes = p_state;
}

View file

@ -26,12 +26,12 @@ namespace ml_amt
static MelonLoader.MelonPreferences_Category ms_category = null;
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
static public event Action<float> CrouchLimitChange;
static public event Action<float> ProneLimitChange;
static public event Action<bool> IKOverrideFlyChange;
static public event Action<bool> IKOverrideJumpChange;
static public event Action<bool> DetectEmotesChange;
static public event Action<bool> MassCenterChange;
public static event Action<float> CrouchLimitChange;
public static event Action<float> ProneLimitChange;
public static event Action<bool> IKOverrideFlyChange;
public static event Action<bool> IKOverrideJumpChange;
public static event Action<bool> DetectEmotesChange;
public static event Action<bool> MassCenterChange;
internal static void Init()
{

View file

@ -1,6 +1,8 @@
using ABI.CCK.Components;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Core.UI;
using ABI_RC.Systems.IK;
using RootMotion.FinalIK;
using System.Reflection;
using UnityEngine;
@ -30,7 +32,14 @@ namespace ml_amt
return l_result;
}
static public void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
public static void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
public static void SetAvatarTPose()
{
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
}
// Engine extensions
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)