From 0f5781aec13cb7bd6baf846389dcfd9bced8b29e Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 2 Nov 2022 00:14:39 -0500 Subject: [PATCH] inputmodule update Switched to input module setup. Desktop will rotate held pickups when zoom bind is pressed. Rotation bind no longer prevents rotation when pickup is not being held. --- PickupPushPull/HarmonyPatches.cs | 31 +++ .../InputModules/Info/EI_SteamVR_Info.cs | 32 +++ .../InputModules/PickupPushPull_Module.cs | 186 +++++++++++++ PickupPushPull/Main.cs | 255 ++++++------------ PickupPushPull/PickupPushPull.sln | 12 +- PickupPushPull/format.json | 12 +- 6 files changed, 347 insertions(+), 181 deletions(-) create mode 100644 PickupPushPull/HarmonyPatches.cs create mode 100644 PickupPushPull/InputModules/Info/EI_SteamVR_Info.cs create mode 100644 PickupPushPull/InputModules/PickupPushPull_Module.cs diff --git a/PickupPushPull/HarmonyPatches.cs b/PickupPushPull/HarmonyPatches.cs new file mode 100644 index 0000000..b89ab59 --- /dev/null +++ b/PickupPushPull/HarmonyPatches.cs @@ -0,0 +1,31 @@ +using ABI.CCK.Components; +using ABI_RC.Core.Player; +using ABI_RC.Core.Savior; +using HarmonyLib; +using UnityEngine; +using PickupPushPull.InputModules; + +namespace PickupPushPull.HarmonyPatches; + +[HarmonyPatch] +internal class HarmonyPatches +{ + //uses code from https://github.com/ljoonal/CVR-Plugins/tree/main/RotateIt + //GPL-3.0 license - Thank you ljoonal for being smart brain :plead: + [HarmonyPostfix] + [HarmonyPatch(typeof(CVRPickupObject), "Update")] + public static void GrabbedObjectPatch(ref CVRPickupObject __instance) + { + // Need to only run when the object is grabbed by the local player + if (!__instance.IsGrabbedByMe()) return; + + Quaternion originalRotation = __instance.transform.rotation; + Transform referenceTransform = __instance._controllerRay.transform; + + __instance.transform.RotateAround(__instance.transform.position, referenceTransform.right, PickupPushPull_Module.Instance.objectRotation.y * Time.deltaTime); + __instance.transform.RotateAround(__instance.transform.position, referenceTransform.up, PickupPushPull_Module.Instance.objectRotation.x * Time.deltaTime); + + // Add the new difference between the og rotation and our newly added rotation the the stored offset. + __instance.initialRotationalOffset *= Quaternion.Inverse(__instance.transform.rotation) * originalRotation; + } +} \ No newline at end of file diff --git a/PickupPushPull/InputModules/Info/EI_SteamVR_Info.cs b/PickupPushPull/InputModules/Info/EI_SteamVR_Info.cs new file mode 100644 index 0000000..0d4d6a1 --- /dev/null +++ b/PickupPushPull/InputModules/Info/EI_SteamVR_Info.cs @@ -0,0 +1,32 @@ +using ABI_RC.Core.Savior; +using System.Reflection; + +namespace PickupPushPull.InputModules.Info; + +internal class EI_SteamVR_Info +{ + //General Inputs + internal static readonly FieldInfo im_vrMovementAction = typeof(InputModuleSteamVR).GetField("vrMovementAction", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrJumpAction = typeof(InputModuleSteamVR).GetField("vrJumpAction", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrLookAction = typeof(InputModuleSteamVR).GetField("vrLookAction", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrMuteAction = typeof(InputModuleSteamVR).GetField("vrMuteAction", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrMenuButton = typeof(InputModuleSteamVR).GetField("vrMenuButton", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrTriggerValue = typeof(InputModuleSteamVR).GetField("vrTriggerValue", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrGripValue = typeof(InputModuleSteamVR).GetField("vrGripValue", BindingFlags.NonPublic | BindingFlags.Instance); + //Vive Controllers + internal static readonly FieldInfo im_vrTouchPadValue = typeof(InputModuleSteamVR).GetField("vrTouchPadValue", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrTouchPadClick = typeof(InputModuleSteamVR).GetField("vrTouchPadClick", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_vrTouchPadTouch = typeof(InputModuleSteamVR).GetField("vrTouchPadTouch", BindingFlags.NonPublic | BindingFlags.Instance); + //Knuckles Controllers + internal static readonly FieldInfo im_steamVrIndexSkeletonLeft = typeof(InputModuleSteamVR).GetField("steamVrIndexSkeletonLeft", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_steamVrIndexSkeletonRight = typeof(InputModuleSteamVR).GetField("steamVrIndexSkeletonRight", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo im_steamVrIndexGestureToggle = typeof(InputModuleSteamVR).GetField("steamVrIndexGestureToggle", BindingFlags.NonPublic | BindingFlags.Instance); + //Touch Controllers + internal static readonly FieldInfo im_steamVrTriggerTouch = typeof(InputModuleSteamVR).GetField("steamVrTriggerTouch", BindingFlags.Public | BindingFlags.Instance); + internal static readonly FieldInfo im_steamVrGripTouch = typeof(InputModuleSteamVR).GetField("steamVrGripTouch", BindingFlags.Public | BindingFlags.Instance); + internal static readonly FieldInfo im_steamVrStickTouch = typeof(InputModuleSteamVR).GetField("steamVrStickTouch", BindingFlags.Public | BindingFlags.Instance); + internal static readonly FieldInfo im_steamVrButtonATouch = typeof(InputModuleSteamVR).GetField("steamVrButtonATouch", BindingFlags.Public | BindingFlags.Instance); + internal static readonly FieldInfo im_steamVrButtonBTouch = typeof(InputModuleSteamVR).GetField("steamVrButtonBTouch", BindingFlags.Public | BindingFlags.Instance); + //SteamVR Specific + //internal static readonly FieldInfo im_steamVrVibration = typeof(InputModuleSteamVR).GetField("steamVrVibration", BindingFlags.NonPublic | BindingFlags.Instance); +} diff --git a/PickupPushPull/InputModules/PickupPushPull_Module.cs b/PickupPushPull/InputModules/PickupPushPull_Module.cs new file mode 100644 index 0000000..daccc2e --- /dev/null +++ b/PickupPushPull/InputModules/PickupPushPull_Module.cs @@ -0,0 +1,186 @@ +using ABI.CCK.Components; +using ABI_RC.Core; +using ABI_RC.Core.InteractionSystem; +using ABI_RC.Core.Player; +using ABI_RC.Core.Savior; +using PickupPushPull.InputModules.Info; +using System.Reflection; +using UnityEngine; +using UnityEngine.Events; +using Valve.VR; + +namespace PickupPushPull.InputModules; + +public class PickupPushPull_Module : CVRInputModule +{ + //Reflection shit + private static readonly FieldInfo _grabbedObject = typeof(ControllerRay).GetField("grabbedObject", BindingFlags.NonPublic | BindingFlags.Instance); + + //Global stuff + public static PickupPushPull_Module Instance; + public Vector2 objectRotation = Vector2.zero; + + //Global settings + public float Setting_PushPullSpeed = 100f; + public float Setting_RotationSpeed = 200f; + public bool Setting_EnableRotation = false; + + //Desktop settings + public bool Desktop_UseZoomForRotate = true; + + //VR settings + public BindingOptionsVR.BindHand VR_RotateHand; + public BindingOptionsVR.BindingOptions VR_RotateBind; + private SteamVR_Action_Boolean VR_RotateBind_Boolean; + + //Local stuff + private CVRInputManager _inputManager; + private ControllerRay desktopControllerRay; + private float deadzoneRightValue; + + //SteamVR Input + private SteamVR_Action_Vector2 vrLookAction; + private SteamVR_Action_Boolean steamVrTriggerTouch; + private SteamVR_Action_Boolean steamVrGripTouch; + private SteamVR_Action_Boolean steamVrStickTouch; + private SteamVR_Action_Boolean steamVrButtonATouch; + private SteamVR_Action_Boolean steamVrButtonBTouch; + + public new void Start() + { + base.Start(); + _inputManager = CVRInputManager.Instance; + Instance = this; + + //Get desktop controller ray + desktopControllerRay = PlayerSetup.Instance.desktopCamera.GetComponent(); + + //Touch Controllers + InputModuleSteamVR inputModuleSteamVR = GetComponent(); + vrLookAction = (SteamVR_Action_Vector2)EI_SteamVR_Info.im_vrLookAction.GetValue(inputModuleSteamVR); + steamVrTriggerTouch = (SteamVR_Action_Boolean)EI_SteamVR_Info.im_steamVrTriggerTouch.GetValue(inputModuleSteamVR); + steamVrGripTouch = (SteamVR_Action_Boolean)EI_SteamVR_Info.im_steamVrGripTouch.GetValue(inputModuleSteamVR); + steamVrStickTouch = (SteamVR_Action_Boolean)EI_SteamVR_Info.im_steamVrStickTouch.GetValue(inputModuleSteamVR); + steamVrButtonATouch = (SteamVR_Action_Boolean)EI_SteamVR_Info.im_steamVrButtonATouch.GetValue(inputModuleSteamVR); + steamVrButtonBTouch = (SteamVR_Action_Boolean)EI_SteamVR_Info.im_steamVrButtonBTouch.GetValue(inputModuleSteamVR); + + UpdateVRBinding(); + + deadzoneRightValue = (float)MetaPort.Instance.settings.GetSettingInt("ControlDeadZoneRight", 0) / 100f; + MetaPort.Instance.settings.settingIntChanged.AddListener(new UnityAction(SettingsIntChanged)); + } + + private void SettingsIntChanged(string name, int value) + { + if (name == "ControlDeadZoneRight") + deadzoneRightValue = (float)value / 100f; + } + + public void UpdateVRBinding() + { + switch (VR_RotateBind) + { + case BindingOptionsVR.BindingOptions.ButtonATouch: + VR_RotateBind_Boolean = steamVrButtonATouch; + break; + case BindingOptionsVR.BindingOptions.ButtonBTouch: + VR_RotateBind_Boolean = steamVrButtonBTouch; + break; + case BindingOptionsVR.BindingOptions.StickTouch: + VR_RotateBind_Boolean = steamVrStickTouch; + break; + case BindingOptionsVR.BindingOptions.TriggerTouch: + VR_RotateBind_Boolean = steamVrTriggerTouch; + break; + case BindingOptionsVR.BindingOptions.GripTouch: + VR_RotateBind_Boolean = steamVrGripTouch; + break; + default: + break; + } + } + + //this will run while menu is being hovered + public override void UpdateImportantInput() + { + objectRotation = Vector2.zero; + } + + //this will only run outside of menus + public override void UpdateInput() + { + objectRotation = Vector2.zero; + + CVRPickupObject desktopObject = (CVRPickupObject)_grabbedObject.GetValue(desktopControllerRay); + if (desktopObject != null) + { + //Desktop Input + DoDesktopInput(); + //Gamepad Input + DoGamepadInput(); + } + + //VR Input + if (!MetaPort.Instance.isUsingVr) return; + + CVRPickupObject vrObject = (CVRPickupObject)_grabbedObject.GetValue(PlayerSetup.Instance.leftRay); + CVRPickupObject vrObject2 = (CVRPickupObject)_grabbedObject.GetValue(PlayerSetup.Instance.rightRay); + if (vrObject != null || vrObject2 != null) + DoSteamVRInput(); + } + + private void DoDesktopInput() + { + if (!Desktop_UseZoomForRotate) return; + + //mouse rotation when zoomed + if (Setting_EnableRotation && _inputManager.zoom) + { + objectRotation.x += Setting_RotationSpeed * _inputManager.rawLookVector.x; + objectRotation.y += Setting_RotationSpeed * _inputManager.rawLookVector.y * -1; + _inputManager.lookVector = Vector2.zero; + _inputManager.zoom = false; + return; + } + } + + private void DoGamepadInput() + { + //not sure how to make settings for this + bool button1 = Input.GetButton("Controller Left Button"); + bool button2 = Input.GetButton("Controller Right Button"); + + if (button1 || button2) + { + //Rotation + if (Setting_EnableRotation && button2) + { + objectRotation.x += Setting_RotationSpeed * _inputManager.rawLookVector.x; + objectRotation.y += Setting_RotationSpeed * _inputManager.rawLookVector.y * -1; + _inputManager.lookVector = Vector2.zero; + return; + } + + _inputManager.objectPushPull += _inputManager.rawLookVector.y * Setting_PushPullSpeed * Time.deltaTime; + _inputManager.lookVector = Vector2.zero; + } + } + + private void DoSteamVRInput() + { + bool button = VR_RotateBind_Boolean.GetState((SteamVR_Input_Sources)VR_RotateHand); + + //I get my own lookVector cause fucking CVR alters **rawLookVector** with digital deadzones >:((( + Vector2 rawLookVector = new(CVRTools.AxisDeadZone(vrLookAction.GetAxis(SteamVR_Input_Sources.Any).x, deadzoneRightValue, true), CVRTools.AxisDeadZone(vrLookAction.GetAxis(SteamVR_Input_Sources.Any).y, deadzoneRightValue, true)); + + if (Setting_EnableRotation && button) + { + objectRotation.x += Setting_RotationSpeed * rawLookVector.x; + objectRotation.y += Setting_RotationSpeed * rawLookVector.y * -1; + _inputManager.lookVector = Vector2.zero; + return; + } + + CVRInputManager.Instance.objectPushPull += CVRInputManager.Instance.floatDirection * Setting_PushPullSpeed * Time.deltaTime; + } +} \ No newline at end of file diff --git a/PickupPushPull/Main.cs b/PickupPushPull/Main.cs index 976b16a..a0e0e0d 100644 --- a/PickupPushPull/Main.cs +++ b/PickupPushPull/Main.cs @@ -5,187 +5,104 @@ using HarmonyLib; using MelonLoader; using UnityEngine; using Valve.VR; +using PickupPushPull.InputModules; namespace PickupPushPull; public class PickupPushPull : MelonMod { - private static MelonPreferences_Category m_categoryPickupPushPull; - private static MelonPreferences_Entry m_entryPushPullSpeed; - private static MelonPreferences_Entry m_entryRotateSpeed; - private static MelonPreferences_Entry m_entryEnableRotation; + private static MelonPreferences_Category Category_PickupPushPull; + private static MelonPreferences_Entry Setting_PushPullSpeed, Setting_RotateSpeed; + private static MelonPreferences_Entry Setting_EnableRotation, Setting_Desktop_UseZoomForRotate; + private static MelonPreferences_Entry Setting_VR_RotateHand; + private static MelonPreferences_Entry Setting_VR_RotateBind; - //not sure if im gonna implement that switch hell for gamepad or mouse yet... - private static MelonPreferences_Entry m_entryRotateBindsVR; - private static MelonPreferences_Entry m_entryRotateBindHandVR; - - private enum BindHandVR + public override void OnInitializeMelon() { + Category_PickupPushPull = MelonPreferences.CreateCategory(nameof(PickupPushPull)); + Category_PickupPushPull.SaveToFile(false); + + //Global settings + Setting_PushPullSpeed = Category_PickupPushPull.CreateEntry("Push Pull Speed", 2f, description: "Up/down on right joystick for VR. Left buSettingr + Up/down on right joystick for Gamepad."); + Setting_RotateSpeed = Category_PickupPushPull.CreateEntry("Rotate Speed", 6f); + Setting_EnableRotation = Category_PickupPushPull.CreateEntry("Enable Rotation", false, description: "Hold left trigger in VR or right buSettingr on Gamepad."); + + //Desktop settings + Setting_Desktop_UseZoomForRotate = Category_PickupPushPull.CreateEntry("Desktop Use Zoom For Rotate", true, description: "Use zoom bind for rotation while a prop is held."); + + //VR settings + Setting_VR_RotateHand = Category_PickupPushPull.CreateEntry("VR Hand", BindingOptionsVR.BindHand.LeftHand); + + //bruh + foreach (var setting in Category_PickupPushPull.Entries) + { + setting.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); + } + + //special setting + Setting_VR_RotateBind = Category_PickupPushPull.CreateEntry("VR Binding", BindingOptionsVR.BindingOptions.ButtonATouch); + Setting_VR_RotateBind.OnEntryValueChangedUntyped.Subscribe(OnUpdateVRBinding); + + MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer()); + } + + + System.Collections.IEnumerator WaitForLocalPlayer() + { + while (PlayerSetup.Instance == null) + yield return null; + + CVRInputManager.Instance.gameObject.AddComponent(); + + //update BlackoutController settings after it initializes + while (PickupPushPull_Module.Instance == null) + yield return null; + + UpdateAllSettings(); + } + + private void OnUpdateSettings(object arg1, object arg2) => UpdateAllSettings(); + private void OnUpdateVRBinding(object arg1, object arg2) => UpdateVRBinding(); + + private void UpdateAllSettings() + { + if (!PickupPushPull_Module.Instance) return; + + //Global settings + PickupPushPull_Module.Instance.Setting_PushPullSpeed = Setting_PushPullSpeed.Value * 50; + PickupPushPull_Module.Instance.Setting_RotationSpeed = Setting_RotateSpeed.Value * 50; + PickupPushPull_Module.Instance.Setting_EnableRotation = Setting_EnableRotation.Value; + //Desktop settings + PickupPushPull_Module.Instance.Desktop_UseZoomForRotate = Setting_Desktop_UseZoomForRotate.Value; + //VR settings + PickupPushPull_Module.Instance.VR_RotateHand = Setting_VR_RotateHand.Value; + } + + private void UpdateVRBinding() + { + //VR special settings + PickupPushPull_Module.Instance.VR_RotateBind = Setting_VR_RotateBind.Value; + PickupPushPull_Module.Instance.UpdateVRBinding(); + } +} + +public class BindingOptionsVR +{ + public enum BindHand + { + Any, LeftHand, RightHand } - private enum BindingOptionsVR + public enum BindingOptions { + //Only oculus bindings have by default ButtonATouch, ButtonBTouch, + TriggerTouch, + //doesnt work? StickTouch, - TriggerTouch + //Index only + GripTouch } - - public override void OnApplicationStart() - { - m_categoryPickupPushPull = MelonPreferences.CreateCategory(nameof(PickupPushPull)); - m_entryPushPullSpeed = m_categoryPickupPushPull.CreateEntry("PushPullSpeed", 1f, description: "Up/down on right joystick for VR. Left bumper + Up/down on right joystick for Gamepad."); - m_entryRotateSpeed = m_categoryPickupPushPull.CreateEntry("RotateSpeed", 1f); - m_entryEnableRotation = m_categoryPickupPushPull.CreateEntry("EnableRotation", false, description: "Hold left trigger in VR or right bumper on Gamepad."); - m_entryRotateBindHandVR = m_categoryPickupPushPull.CreateEntry("VR Hand", BindHandVR.LeftHand); - m_entryRotateBindsVR = m_categoryPickupPushPull.CreateEntry("VR Binding", BindingOptionsVR.ButtonATouch); - - m_categoryPickupPushPull.SaveToFile(false); - m_entryPushPullSpeed.OnValueChangedUntyped += UpdateSettings; - m_entryRotateSpeed.OnValueChangedUntyped += UpdateSettings; - m_entryEnableRotation.OnValueChangedUntyped += UpdateSettings; - - UpdateSettings(); - } - private static void UpdateSettings() - { - HarmonyPatches.ppSpeed = m_entryPushPullSpeed.Value; - HarmonyPatches.rotSpeed = m_entryRotateSpeed.Value; - HarmonyPatches.enableRot = m_entryEnableRotation.Value; - HarmonyPatches.rotBindVR = m_entryRotateBindsVR.Value; - HarmonyPatches.rotHandVR = (SteamVR_Input_Sources)m_entryRotateBindHandVR.Value + 1; - } - - [HarmonyPatch] - private class HarmonyPatches - { - //UpdateSettings() on app start immediatly overrides these :shrug: - public static float ppSpeed = m_entryPushPullSpeed.Value; - public static float rotSpeed = m_entryRotateSpeed.Value; - public static bool enableRot = m_entryEnableRotation.Value; - public static BindingOptionsVR rotBindVR = m_entryRotateBindsVR.Value; - public static SteamVR_Input_Sources rotHandVR = (SteamVR_Input_Sources)m_entryRotateBindHandVR.Value + 1; - - private static float objectPitch = 0f; - private static float objectYaw = 0f; - - private static bool lockedVRInput = false; - private static bool lockedFSInput = false; - private static CursorLockMode savedCursorLockState; - - //uses code from https://github.com/ljoonal/CVR-Plugins/tree/main/RotateIt - //GPL-3.0 license - Thank you ljoonal for being smart brain :plead: - - [HarmonyPostfix] - [HarmonyPatch(typeof(CVRPickupObject), "Update")] - public static void GrabbedObjectPatch(ref CVRPickupObject __instance) - { - // Need to only run when the object is grabbed by the local player - if (!__instance.IsGrabbedByMe()) return; - - Quaternion originalRotation = __instance.transform.rotation; - Transform referenceTransform = __instance._controllerRay.transform; - - __instance.transform.RotateAround(__instance.transform.position, referenceTransform.right, objectPitch * Time.deltaTime); - __instance.transform.RotateAround(__instance.transform.position, referenceTransform.up, objectYaw * Time.deltaTime); - - // Add the new difference between the og rotation and our newly added rotation the the stored offset. - __instance.initialRotationalOffset *= Quaternion.Inverse(__instance.transform.rotation) * originalRotation; - } - - //Reset object rotation input each frame - [HarmonyPrefix] - [HarmonyPatch(typeof(CVRInputManager), "Update")] - private static void BeforeUpdate() - { - objectPitch = 0f; - objectYaw = 0f; - } - - //Gamepad & Desktop Input Patch - [HarmonyPostfix] - [HarmonyPatch(typeof(InputModuleGamepad), "UpdateInput")] - private static void AfterUpdateInput(ref bool ___enableGamepadInput) - { - - bool button1 = Input.GetButton("Controller Left Button") || Input.GetKey(KeyCode.Mouse4) || Input.GetKey(KeyCode.Mouse3); - bool button2 = Input.GetButton("Controller Right Button") || Input.GetKey(KeyCode.Mouse3); - - if (button1) - { - if (!lockedFSInput) - { - lockedFSInput = true; - savedCursorLockState = Cursor.lockState; - Cursor.lockState = CursorLockMode.None; - PlayerSetup.Instance._movementSystem.disableCameraControl = true; - } - if (button2 && enableRot) - { - objectPitch += rotSpeed * CVRInputManager.Instance.rawLookVector.y * -1; - objectYaw += rotSpeed * CVRInputManager.Instance.rawLookVector.x; - } - else - { - CVRInputManager.Instance.objectPushPull += CVRInputManager.Instance.rawLookVector.y * ppSpeed * Time.deltaTime; - } - } - else if (lockedFSInput) - { - lockedFSInput = false; - Cursor.lockState = savedCursorLockState; - PlayerSetup.Instance._movementSystem.disableCameraControl = false; - } - } - - //VR Input Patch - [HarmonyPostfix] - [HarmonyPatch(typeof(InputModuleSteamVR), "UpdateInput")] - private static void AfterUpdateInputprivate(ref SteamVR_Action_Boolean ___steamVrButtonATouch, ref SteamVR_Action_Boolean ___steamVrButtonBTouch, ref SteamVR_Action_Boolean ___steamVrStickTouch, ref SteamVR_Action_Boolean ___steamVrTriggerTouch) - { - if (!MetaPort.Instance.isUsingVr) return; - - bool button = false; - - //not really sure this is optimal, i dont know all the cool c# tricks yet - switch (rotBindVR) - { - case BindingOptionsVR.ButtonATouch: - button = ___steamVrButtonATouch.GetState(rotHandVR); - return; - case BindingOptionsVR.ButtonBTouch: - button = ___steamVrButtonBTouch.GetState(rotHandVR); - return; - case BindingOptionsVR.StickTouch: - button = ___steamVrStickTouch.GetState(rotHandVR); - return; - case BindingOptionsVR.TriggerTouch: - button = ___steamVrTriggerTouch.GetState(rotHandVR); - return; - default: break; - } - - if (button && enableRot) - { - if (!lockedVRInput) - { - lockedVRInput = true; - PlayerSetup.Instance._movementSystem.canRot = false; - PlayerSetup.Instance._movementSystem.disableCameraControl = true; - } - objectPitch += rotSpeed * (CVRInputManager.Instance.floatDirection / 2f * -1); - objectYaw += rotSpeed * CVRInputManager.Instance.rawLookVector.x; - return; - } - else if (lockedVRInput) - { - lockedVRInput = false; - PlayerSetup.Instance._movementSystem.canRot = true; - PlayerSetup.Instance._movementSystem.disableCameraControl = false; - } - - CVRInputManager.Instance.objectPushPull += CVRInputManager.Instance.floatDirection * ppSpeed * Time.deltaTime; - } - } -} +} \ No newline at end of file diff --git a/PickupPushPull/PickupPushPull.sln b/PickupPushPull/PickupPushPull.sln index 65fa197..670bd55 100644 --- a/PickupPushPull/PickupPushPull.sln +++ b/PickupPushPull/PickupPushPull.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.2.32630.192 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GestureLock", "GestureLock.csproj", "{B318B038-DA12-4960-A35E-613BE26B7965}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PickupPushPull", "PickupPushPull.csproj", "{817132E7-2DE5-412F-A34C-A325C368F42B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,15 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B318B038-DA12-4960-A35E-613BE26B7965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B318B038-DA12-4960-A35E-613BE26B7965}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B318B038-DA12-4960-A35E-613BE26B7965}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B318B038-DA12-4960-A35E-613BE26B7965}.Release|Any CPU.Build.0 = Release|Any CPU + {817132E7-2DE5-412F-A34C-A325C368F42B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {817132E7-2DE5-412F-A34C-A325C368F42B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {817132E7-2DE5-412F-A34C-A325C368F42B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {817132E7-2DE5-412F-A34C-A325C368F42B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {0ABE9CFE-D4F5-4B5B-9D1A-5D0B1DA7E2CD} + SolutionGuid = {D636F9FB-C0CF-40CE-8105-E5238CDE0902} EndGlobalSection EndGlobal diff --git a/PickupPushPull/format.json b/PickupPushPull/format.json index 2d2a0c9..1e75e34 100644 --- a/PickupPushPull/format.json +++ b/PickupPushPull/format.json @@ -1,12 +1,12 @@ { "_id": 91, "name": "PickupPushPull", - "modversion": "1.1.0", + "modversion": "3.0.0", "gameversion": "2022r168", - "loaderversion": "0.5.4", + "loaderversion": "0.5.7", "modtype": "Mod", "author": "NotAKidoS", - "description": "Allows you to push & pull pickups with Gamepad or VR using the right joystick.", + "description": "Allows you to push & pull pickups with Mouse, Gamepad, & VR.\nCan also optionally rotate props via keybind.", "searchtags": [ "pull", "push", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/PickupPP/releases/download/r3/PickupPushPull.dll", - "sourcelink": "https://github.com/NotAKidOnSteam/PickupPP/", - "changelog": "Switched to using Harmony Patches.", + "downloadlink": "https://github.com/NotAKidOnSteam/PickupPushPull/releases/download/r2/PickupPushPull.dll", + "sourcelink": "https://github.com/NotAKidOnSteam/PickupPushPull/", + "changelog": "Switched to input module setup. Desktop will rotate held pickups when zoom bind is pressed. Rotation bind no longer prevents rotation when pickup is not being held.", "embedcolor": "804221" } \ No newline at end of file