i hate all

holy shit this fucking bug took me two hours to fix
why was the solution so simple... fuck
This commit is contained in:
NotAKidoS 2023-01-03 21:11:16 -06:00
parent 845baee849
commit 4a5527d7de
4 changed files with 38 additions and 126 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -32,11 +33,29 @@ public class MSP_MenuInfo
public static void ToggleDesktopInputMethod(bool flag)
{
if (MetaPort.Instance.isUsingVr) return;
MelonLoader.MelonLogger.Msg("Toggled Desktop Input");
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
CVRInputManager.Instance.inputEnabled = !flag;
RootLogic.Instance.ToggleMouse(flag);
CVR_MenuManager.Instance.desktopControllerRay.enabled = !flag;
Traverse.Create(CVR_MenuManager.Instance).Field("_desktopMouseMode").SetValue(flag);
}
static readonly FieldInfo ms_followAngleY = typeof(MovementSystem).GetField("_followAngleY", BindingFlags.NonPublic | BindingFlags.Instance);
public static bool independentHeadTurn = false;
public static void HandleIndependentLookInput()
{
//angle of independent look axis
float angle = (float)ms_followAngleY.GetValue(MovementSystem.Instance);
bool isPressed = CVRInputManager.Instance.independentHeadTurn;
if (isPressed && !independentHeadTurn)
{
independentHeadTurn = true;
MSP_MenuInfo.ToggleDesktopInputMethod(false);
}else if (!isPressed && independentHeadTurn && angle == 0f)
{
independentHeadTurn = false;
MSP_MenuInfo.ToggleDesktopInputMethod(true);
}
}
}