mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-04 02:49:23 +00:00
Better avatar setup detection
This commit is contained in:
parent
2f9a46e471
commit
0794564563
5 changed files with 38 additions and 50 deletions
|
@ -50,11 +50,6 @@ namespace ml_lme
|
|||
m_leapHands = new GameObject[GestureMatcher.GesturesData.ms_handsCount];
|
||||
|
||||
// Patches
|
||||
HarmonyInstance.Patch(
|
||||
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupAvatar)),
|
||||
null,
|
||||
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnAvatarSetup_Postfix), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic))
|
||||
);
|
||||
HarmonyInstance.Patch(
|
||||
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.ClearAvatar)),
|
||||
null,
|
||||
|
@ -66,6 +61,7 @@ namespace ml_lme
|
|||
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnSetupAvatarGeneral_Postfix), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic))
|
||||
);
|
||||
|
||||
|
||||
MelonLoader.MelonCoroutines.Start(CreateTrackingObjects());
|
||||
}
|
||||
|
||||
|
@ -334,15 +330,6 @@ namespace ml_lme
|
|||
m_leapTracked.OnAvatarClear();
|
||||
}
|
||||
|
||||
static void OnAvatarSetup_Postfix() => ms_instance?.OnAvatarSetup();
|
||||
void OnAvatarSetup()
|
||||
{
|
||||
if(!PlayerSetup.Instance._inVr && (m_leapTracked != null))
|
||||
m_leapTracked.OnAvatarSetup();
|
||||
|
||||
OnSettingsHeadAttachChange(Settings.HeadAttach);
|
||||
}
|
||||
|
||||
// Sneaky forced IndexIK calibration
|
||||
static void OnSetupAvatarGeneral_Prefix(ref PlayerSetup __instance)
|
||||
{
|
||||
|
@ -353,6 +340,15 @@ namespace ml_lme
|
|||
{
|
||||
if(__instance != null)
|
||||
__instance._inVr = ms_vrState;
|
||||
|
||||
ms_instance?.OnSetupAvatarGeneral();
|
||||
}
|
||||
void OnSetupAvatarGeneral()
|
||||
{
|
||||
if(m_leapTracked != null)
|
||||
m_leapTracked.OnSetupAvatarGeneral();
|
||||
|
||||
OnSettingsHeadAttachChange(Settings.HeadAttach);
|
||||
}
|
||||
|
||||
// Utilities
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue