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
|
@ -1,9 +1,7 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using NAK.PickupPushPull.InputModules;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.PickupPushPull.HarmonyPatches;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ public class PickupPushPull_Module : CVRInputModule
|
|||
public Vector2 objectRotation = Vector2.zero;
|
||||
|
||||
//Global settings
|
||||
public float Setting_PushPullSpeed = 100f;
|
||||
public float Setting_RotationSpeed = 200f;
|
||||
public bool Setting_EnableRotation = false;
|
||||
public float EntryPushPullSpeed = 100f;
|
||||
public float EntryRotationSpeed = 200f;
|
||||
public bool EntryEnableRotation = false;
|
||||
|
||||
//Desktop settings
|
||||
public bool Desktop_UseZoomForRotate = true;
|
||||
|
@ -34,7 +34,6 @@ public class PickupPushPull_Module : CVRInputModule
|
|||
private SteamVR_Action_Boolean VR_RotateBind_Boolean;
|
||||
|
||||
//Local stuff
|
||||
private CVRInputManager _inputManager;
|
||||
private ControllerRay desktopControllerRay;
|
||||
private float deadzoneRightValue;
|
||||
private bool controlGamepadEnabled;
|
||||
|
@ -52,7 +51,7 @@ public class PickupPushPull_Module : CVRInputModule
|
|||
_inputManager = CVRInputManager.Instance;
|
||||
Instance = this;
|
||||
base.Start();
|
||||
|
||||
|
||||
//Get desktop controller ray
|
||||
desktopControllerRay = PlayerSetup.Instance.desktopCamera.GetComponent<ControllerRay>();
|
||||
|
||||
|
@ -140,10 +139,10 @@ public class PickupPushPull_Module : CVRInputModule
|
|||
if (!Desktop_UseZoomForRotate) return;
|
||||
|
||||
//mouse rotation when zoomed
|
||||
if (Setting_EnableRotation && _inputManager.zoom)
|
||||
if (EntryEnableRotation && _inputManager.zoom)
|
||||
{
|
||||
objectRotation.x += Setting_RotationSpeed * _inputManager.rawLookVector.x;
|
||||
objectRotation.y += Setting_RotationSpeed * _inputManager.rawLookVector.y * -1;
|
||||
objectRotation.x += EntryRotationSpeed * _inputManager.rawLookVector.x;
|
||||
objectRotation.y += EntryRotationSpeed * _inputManager.rawLookVector.y * -1;
|
||||
_inputManager.lookVector = Vector2.zero;
|
||||
_inputManager.zoom = false;
|
||||
return;
|
||||
|
@ -161,15 +160,15 @@ public class PickupPushPull_Module : CVRInputModule
|
|||
if (button1 || button2)
|
||||
{
|
||||
//Rotation
|
||||
if (Setting_EnableRotation && button2)
|
||||
if (EntryEnableRotation && button2)
|
||||
{
|
||||
objectRotation.x += Setting_RotationSpeed * _inputManager.rawLookVector.x;
|
||||
objectRotation.y += Setting_RotationSpeed * _inputManager.rawLookVector.y * -1;
|
||||
objectRotation.x += EntryRotationSpeed * _inputManager.rawLookVector.x;
|
||||
objectRotation.y += EntryRotationSpeed * _inputManager.rawLookVector.y * -1;
|
||||
_inputManager.lookVector = Vector2.zero;
|
||||
return;
|
||||
}
|
||||
|
||||
_inputManager.objectPushPull += _inputManager.rawLookVector.y * Setting_PushPullSpeed * Time.deltaTime;
|
||||
_inputManager.objectPushPull += _inputManager.rawLookVector.y * EntryPushPullSpeed * Time.deltaTime;
|
||||
_inputManager.lookVector = Vector2.zero;
|
||||
}
|
||||
}
|
||||
|
@ -183,19 +182,19 @@ public class PickupPushPull_Module : CVRInputModule
|
|||
bool canRotate = (leftObject != null && leftObject.gripType == CVRPickupObject.GripType.Free) ||
|
||||
(rightObject != null && rightObject.gripType == CVRPickupObject.GripType.Free);
|
||||
|
||||
if (Setting_EnableRotation && canRotate && VR_RotateBind_Boolean.GetState((SteamVR_Input_Sources)VR_RotateHand))
|
||||
if (EntryEnableRotation && canRotate && VR_RotateBind_Boolean.GetState((SteamVR_Input_Sources)VR_RotateHand))
|
||||
{
|
||||
Vector2 rawLookVector = new Vector2(CVRTools.AxisDeadZone(vrLookAction.GetAxis(SteamVR_Input_Sources.Any).x, deadzoneRightValue, true),
|
||||
CVRTools.AxisDeadZone(vrLookAction.GetAxis(SteamVR_Input_Sources.Any).y, deadzoneRightValue, true));
|
||||
|
||||
objectRotation.x += Setting_RotationSpeed * rawLookVector.x;
|
||||
objectRotation.y += Setting_RotationSpeed * rawLookVector.y * -1;
|
||||
objectRotation.x += EntryRotationSpeed * rawLookVector.x;
|
||||
objectRotation.y += EntryRotationSpeed * rawLookVector.y * -1;
|
||||
|
||||
_inputManager.lookVector = Vector2.zero;
|
||||
return;
|
||||
}
|
||||
|
||||
CVRInputManager.Instance.objectPushPull += CVRInputManager.Instance.floatDirection * Setting_PushPullSpeed * Time.deltaTime;
|
||||
CVRInputManager.Instance.objectPushPull += CVRInputManager.Instance.floatDirection * EntryPushPullSpeed * Time.deltaTime;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +1,44 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
using Valve.VR;
|
||||
using NAK.PickupPushPull.InputModules;
|
||||
|
||||
namespace NAK.PickupPushPull;
|
||||
|
||||
public class PickupPushPull : MelonMod
|
||||
{
|
||||
private static MelonPreferences_Category Category_PickupPushPull;
|
||||
private static MelonPreferences_Entry<float> Setting_PushPullSpeed, Setting_RotateSpeed;
|
||||
private static MelonPreferences_Entry<bool> Setting_EnableRotation, Setting_Desktop_UseZoomForRotate;
|
||||
private static MelonPreferences_Entry<BindingOptionsVR.BindHand> Setting_VR_RotateHand;
|
||||
private static MelonPreferences_Entry<BindingOptionsVR.BindingOptions> Setting_VR_RotateBind;
|
||||
public static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(nameof(PickupPushPull));
|
||||
|
||||
//Global settings
|
||||
public static readonly MelonPreferences_Entry<float> EntryPushPullSpeed =
|
||||
Category.CreateEntry<float>("Push Pull Speed", 2f, "Up/down on right joystick for VR. Left button + Up/down on right joystick for Gamepad.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<float> EntryRotateSpeed =
|
||||
Category.CreateEntry<float>("Rotate Speed", 6f);
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryEnableRotation =
|
||||
Category.CreateEntry<bool>("Enable Rotation", false, "Hold left trigger in VR or right button on Gamepad.");
|
||||
|
||||
//Desktop settings
|
||||
public static readonly MelonPreferences_Entry<bool> EntryDesktopUseZoomForRotate =
|
||||
Category.CreateEntry<bool>("Desktop Use Zoom For Rotate", true, "Use zoom bind for rotation while a prop is held.");
|
||||
|
||||
//VR settings
|
||||
public static readonly MelonPreferences_Entry<BindingOptionsVR.BindHand> EntryVRRotateHand =
|
||||
Category.CreateEntry<BindingOptionsVR.BindHand>("VR Hand", BindingOptionsVR.BindHand.LeftHand);
|
||||
|
||||
public static readonly MelonPreferences_Entry<BindingOptionsVR.BindingOptions> EntryVRRotateBind =
|
||||
Category.CreateEntry<BindingOptionsVR.BindingOptions>("VR Binding", BindingOptionsVR.BindingOptions.ButtonATouch);
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Category_PickupPushPull = MelonPreferences.CreateCategory(nameof(PickupPushPull));
|
||||
|
||||
//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<float>("Rotate Speed", 6f);
|
||||
Setting_EnableRotation = Category_PickupPushPull.CreateEntry<bool>("Enable Rotation", false, description: "Hold left trigger in VR or right buSettingr on Gamepad.");
|
||||
|
||||
//Desktop settings
|
||||
Setting_Desktop_UseZoomForRotate = Category_PickupPushPull.CreateEntry<bool>("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)
|
||||
foreach (var entry in Category.Entries)
|
||||
{
|
||||
setting.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
|
||||
entry.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
|
||||
}
|
||||
|
||||
//special setting
|
||||
Setting_VR_RotateBind = Category_PickupPushPull.CreateEntry("VR Binding", BindingOptionsVR.BindingOptions.ButtonATouch);
|
||||
Setting_VR_RotateBind.OnEntryValueChangedUntyped.Subscribe(OnUpdateVRBinding);
|
||||
EntryVRRotateBind.OnEntryValueChangedUntyped.Subscribe(OnUpdateVRBinding);
|
||||
|
||||
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
|
||||
}
|
||||
|
@ -69,19 +67,19 @@ public class PickupPushPull : MelonMod
|
|||
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;
|
||||
PickupPushPull_Module.Instance.EntryPushPullSpeed = EntryPushPullSpeed.Value * 50;
|
||||
PickupPushPull_Module.Instance.EntryRotationSpeed = EntryRotateSpeed.Value * 50;
|
||||
PickupPushPull_Module.Instance.EntryEnableRotation = EntryEnableRotation.Value;
|
||||
//Desktop settings
|
||||
PickupPushPull_Module.Instance.Desktop_UseZoomForRotate = Setting_Desktop_UseZoomForRotate.Value;
|
||||
PickupPushPull_Module.Instance.Desktop_UseZoomForRotate = EntryDesktopUseZoomForRotate.Value;
|
||||
//VR settings
|
||||
PickupPushPull_Module.Instance.VR_RotateHand = Setting_VR_RotateHand.Value;
|
||||
PickupPushPull_Module.Instance.VR_RotateHand = EntryVRRotateHand.Value;
|
||||
}
|
||||
|
||||
|
||||
private void UpdateVRBinding()
|
||||
{
|
||||
//VR special settings
|
||||
PickupPushPull_Module.Instance.VR_RotateBind = Setting_VR_RotateBind.Value;
|
||||
PickupPushPull_Module.Instance.VR_RotateBind = EntryVRRotateBind.Value;
|
||||
PickupPushPull_Module.Instance.UpdateVRBinding();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
using NAK.PickupPushPull.Properties;
|
||||
using MelonLoader;
|
||||
using MelonLoader;
|
||||
using NAK.PickupPushPull.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
|
@ -15,7 +14,7 @@ using System.Reflection;
|
|||
nameof(NAK.PickupPushPull),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidOnSteam/PickupPushPull"
|
||||
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/PickupPushPull"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/PickupPushPull/releases/download/v3.0.2/PickupPushPull.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/PickupPushPull/",
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/PickupPushPull.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/PickupPushPull/",
|
||||
"changelog": "- Fixed issue where ControlEnableGamepad setting was improperly checked on startup.",
|
||||
"embedcolor": "804221"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue