Pose detection and animator transitions for regular avatars

This commit is contained in:
SDraw 2022-09-15 00:14:12 +03:00
parent 0cab0fb7db
commit 6b67471217
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
7 changed files with 152 additions and 38 deletions

View file

@ -15,6 +15,8 @@ namespace ml_amt
Settings.Init();
Settings.IKOverrideChange += this.OnIKOverrideChange;
Settings.CrouchLimitChange += this.OnCrouchLimitChange;
Settings.DetectPoseChange += this.OnDetectPoseChange;
Settings.ProneLimitChange += this.OnProneLimitChange;
HarmonyInstance.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.ClearAvatar)),
@ -38,6 +40,8 @@ namespace ml_amt
m_localTweaker = PlayerSetup.Instance.gameObject.AddComponent<MotionTweaker>();
m_localTweaker.SetIKOverride(Settings.IKOverride);
m_localTweaker.SetCrouchLimit(Settings.CrouchLimit);
m_localTweaker.SetDetectPose(Settings.DetectPose);
m_localTweaker.SetProneLimit(Settings.ProneLimit);
}
@ -51,6 +55,16 @@ namespace ml_amt
if(m_localTweaker != null)
m_localTweaker.SetCrouchLimit(p_value);
}
void OnDetectPoseChange(bool p_state)
{
if(m_localTweaker != null)
m_localTweaker.SetDetectPose(p_state);
}
void OnProneLimitChange(float p_value)
{
if(m_localTweaker != null)
m_localTweaker.SetProneLimit(p_value);
}
static void OnAvatarClear_Postfix() => ms_instance?.OnAvatarClear();
void OnAvatarClear()