mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
major cleanup
This commit is contained in:
parent
b33e15377f
commit
e5242f76c7
85 changed files with 584 additions and 571 deletions
58
GestureLock/HarmonyPatches.cs
Normal file
58
GestureLock/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Core.UI;
|
||||
using HarmonyLib;
|
||||
using Valve.VR;
|
||||
|
||||
namespace NAK.GestureLock.HarmonyPatches;
|
||||
|
||||
class Patches
|
||||
{
|
||||
private static bool isLocked;
|
||||
private static float oldGestureLeft;
|
||||
private static float oldGestureRight;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(InputModuleSteamVR), nameof(InputModuleSteamVR.UpdateInput))]
|
||||
private static void Postfix_InputModuleSteamVR_UpdateInput
|
||||
(
|
||||
ref CVRInputManager ____inputManager,
|
||||
ref VRTrackerManager ____trackerManager,
|
||||
ref SteamVR_Action_Boolean ___steamVrIndexGestureToggle
|
||||
)
|
||||
{
|
||||
if (!MetaPort.Instance.isUsingVr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (___steamVrIndexGestureToggle.stateDown && !____trackerManager.trackerNames.Contains("knuckles"))
|
||||
{
|
||||
isLocked = !isLocked;
|
||||
oldGestureLeft = ____inputManager.gestureLeft;
|
||||
oldGestureRight = ____inputManager.gestureRight;
|
||||
CohtmlHud.Instance.ViewDropTextImmediate("", "Gesture Lock", "Gestures " + (isLocked ? "Locked" : "Unlocked"));
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVRInputManager), nameof(CVRInputManager.Update))]
|
||||
private static void Postfix_CVRInputManager_Update
|
||||
(
|
||||
ref float ___gestureLeft,
|
||||
ref float ___gestureRight
|
||||
)
|
||||
{
|
||||
if (!MetaPort.Instance.isUsingVr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLocked)
|
||||
{
|
||||
// Dont override raw, other systems like the camera gesture recognizer need it.
|
||||
___gestureLeft = oldGestureLeft;
|
||||
___gestureRight = oldGestureRight;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue