Minor code changes and fixes

Sometimes I dream about cheese
This commit is contained in:
SDraw 2022-10-18 21:46:10 +03:00
parent 7fcfb04e0f
commit fd48185bdd
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
14 changed files with 183 additions and 177 deletions

View file

@ -15,14 +15,6 @@ namespace ml_amt
ms_instance = this;
Settings.Init();
Settings.IKOverrideCrouchChange += this.OnIKOverrideCrouchChange;
Settings.CrouchLimitChange += this.OnCrouchLimitChange;
Settings.IKOverrideProneChange += this.OnIKOverrideProneChange;
Settings.ProneLimitChange += this.OnProneLimitChange;
Settings.PoseTransitionsChange += this.OnPoseTransitonsChange;
Settings.AdjustedMovementChange += this.OnAdjustedMovementChange;
Settings.IKOverrideFlyChange += this.OnIKOverrideFlyChange;
Settings.DetectEmotesChange += this.OnDetectEmotesChange;
HarmonyInstance.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.ClearAvatar)),
@ -54,45 +46,12 @@ namespace ml_amt
m_localTweaker.SetDetectEmotes(Settings.DetectEmotes);
}
void OnIKOverrideCrouchChange(bool p_state)
public override void OnDeinitializeMelon()
{
if(m_localTweaker != null)
m_localTweaker.SetIKOverrideCrouch(p_state);
}
void OnCrouchLimitChange(float p_value)
{
if(m_localTweaker != null)
m_localTweaker.SetCrouchLimit(p_value);
}
void OnIKOverrideProneChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetIKOverrideProne(p_state);
}
void OnProneLimitChange(float p_value)
{
if(m_localTweaker != null)
m_localTweaker.SetProneLimit(p_value);
}
void OnPoseTransitonsChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetPoseTransitions(p_state);
}
void OnAdjustedMovementChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetAdjustedMovement(p_state);
}
void OnIKOverrideFlyChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetIKOverrideFly(p_state);
}
void OnDetectEmotesChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetDetectEmotes(p_state);
if(ms_instance == this)
ms_instance = null;
m_localTweaker = null;
}
static void OnAvatarClear_Postfix() => ms_instance?.OnAvatarClear();

View file

@ -78,6 +78,30 @@ namespace ml_amt
{
m_parameters = new List<AdditionalParameterInfo>();
}
void Start()
{
Settings.IKOverrideCrouchChange += this.SetIKOverrideCrouch;
Settings.CrouchLimitChange += this.SetCrouchLimit;
Settings.IKOverrideProneChange += this.SetIKOverrideProne;
Settings.ProneLimitChange += this.SetProneLimit;
Settings.PoseTransitionsChange += this.SetPoseTransitions;
Settings.AdjustedMovementChange += this.SetAdjustedMovement;
Settings.IKOverrideFlyChange += this.SetIKOverrideFly;
Settings.DetectEmotesChange += this.SetDetectEmotes;
}
void OnDestroy()
{
Settings.IKOverrideCrouchChange -= this.SetIKOverrideCrouch;
Settings.CrouchLimitChange -= this.SetCrouchLimit;
Settings.IKOverrideProneChange -= this.SetIKOverrideProne;
Settings.ProneLimitChange -= this.SetProneLimit;
Settings.PoseTransitionsChange -= this.SetPoseTransitions;
Settings.AdjustedMovementChange -= this.SetAdjustedMovement;
Settings.IKOverrideFlyChange -= this.SetIKOverrideFly;
Settings.DetectEmotesChange -= this.SetDetectEmotes;
}
void Update()
{
@ -123,13 +147,12 @@ namespace ml_amt
m_poseState = l_poseState;
m_emoteActive = false;
if(m_detectEmotes && (m_locomotionLayer >= 0))
{
AnimatorStateInfo l_animState = PlayerSetup.Instance._animator.GetCurrentAnimatorStateInfo(m_locomotionLayer);
m_emoteActive = (l_animState.tagHash == ms_emoteHash);
}
else
m_emoteActive = false;
if(m_parameters.Count > 0)
{

View file

@ -1,10 +1,10 @@
using System.Reflection;
[assembly: AssemblyTitle("AvatarMotionTweaker")]
[assembly: AssemblyVersion("1.1.3")]
[assembly: AssemblyFileVersion("1.1.3")]
[assembly: AssemblyVersion("1.1.4")]
[assembly: AssemblyFileVersion("1.1.4")]
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.1.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.1.4", "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)]