Move many mods to Deprecated folder, fix spelling

This commit is contained in:
NotAKidoS 2025-04-03 02:57:35 -05:00
parent 5e822cec8d
commit 0042590aa6
539 changed files with 7475 additions and 3120 deletions

View file

@ -0,0 +1,32 @@
using ABI.CCK.Components;
using HarmonyLib;
using NAK.PickupPushPull.InputModules;
using UnityEngine;
namespace NAK.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), nameof(CVRPickupObject.Update))]
public static void GrabbedObjectPatch(ref CVRPickupObject __instance)
{
if (__instance._controllerRay == null)
return;
if (__instance.gripType == CVRPickupObject.GripType.Origin)
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);
__instance.initialRotationalOffset *= Quaternion.Inverse(__instance.transform.rotation) * originalRotation;
}
}

View file

@ -0,0 +1,193 @@
using ABI.CCK.Components;
using ABI_RC.Core;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using NAK.PickupPushPull.InputModules.Info;
using System.Reflection;
using ABI_RC.Systems.InputManagement;
using UnityEngine;
using UnityEngine.Events;
using Valve.VR;
namespace NAK.PickupPushPull.InputModules;
public class PickupPushPull_Module : CVRInputModule
{
public Vector2 objectRotation = Vector2.zero;
//Global settings
public float EntryPushPullSpeed = 100f;
public float EntryRotationSpeed = 200f;
public bool EntryEnableRotation = false;
//Desktop settings
public bool Desktop_UseZoomForRotate = true;
//VR settings
public BindingOptionsVR.BindHand VR_RotateHand = BindingOptionsVR.BindHand.LeftHand;
public BindingOptionsVR.BindingOptions VR_RotateBind = BindingOptionsVR.BindingOptions.ButtonATouch;
public SteamVR_Action_Boolean VR_RotateBind_Boolean;
//Local stuff
private ControllerRay desktopControllerRay;
private float deadzoneRightValue;
private bool controlGamepadEnabled;
//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()
{
_inputManager = CVRInputManager.Instance;
base.Start();
//Get desktop controller ray
desktopControllerRay = PlayerSetup.Instance.desktopCamera.GetComponent<ControllerRay>();
//Touch Controllers
InputModuleSteamVR inputModuleSteamVR = GetComponent<InputModuleSteamVR>();
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);
controlGamepadEnabled = (bool)MetaPort.Instance.settings.GetSettingsBool("ControlEnableGamepad", false);
MetaPort.Instance.settings.settingBoolChanged.AddListener(new UnityAction<string, bool>(SettingsBoolChanged));
deadzoneRightValue = (float)MetaPort.Instance.settings.GetSettingInt("ControlDeadZoneRight", 0) / 100f;
MetaPort.Instance.settings.settingIntChanged.AddListener(new UnityAction<string, int>(SettingsIntChanged));
UpdateVRBinding();
}
private void SettingsBoolChanged(string name, bool value)
{
if (name == "ControlEnableGamepad")
controlGamepadEnabled = value;
}
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 && desktopObject.gripType == CVRPickupObject.GripType.Free)
{
//Desktop Input
DoDesktopInput();
//Gamepad Input
DoGamepadInput();
}
//VR Input
if (!MetaPort.Instance.isUsingVr) return;
DoSteamVRInput();
}
private void DoDesktopInput()
{
if (!Desktop_UseZoomForRotate) return;
//mouse rotation when zoomed
if (EntryEnableRotation && _inputManager.zoom)
{
objectRotation.x += EntryRotationSpeed * _inputManager.rawLookVector.x;
objectRotation.y += EntryRotationSpeed * _inputManager.rawLookVector.y * -1;
_inputManager.lookVector = Vector2.zero;
_inputManager.zoom = false;
return;
}
}
private void DoGamepadInput()
{
if (!controlGamepadEnabled) return;
//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 (EntryEnableRotation && button2)
{
objectRotation.x += EntryRotationSpeed * _inputManager.rawLookVector.x;
objectRotation.y += EntryRotationSpeed * _inputManager.rawLookVector.y * -1;
_inputManager.lookVector = Vector2.zero;
return;
}
_inputManager.objectPushPull += _inputManager.rawLookVector.y * EntryPushPullSpeed * Time.deltaTime;
_inputManager.lookVector = Vector2.zero;
}
}
private void DoSteamVRInput()
{
CVRPickupObject leftObject = PlayerSetup.Instance.leftRay.grabbedObject;
CVRPickupObject rightObject = PlayerSetup.Instance.rightRay.grabbedObject;
if (leftObject == null && rightObject == null)
return;
bool canRotate = (leftObject != null && leftObject.gripType == CVRPickupObject.GripType.Free) ||
(rightObject != null && rightObject.gripType == CVRPickupObject.GripType.Free);
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 += EntryRotationSpeed * rawLookVector.x;
objectRotation.y += EntryRotationSpeed * rawLookVector.y * -1;
_inputManager.lookVector = Vector2.zero;
}
}
}

View file

@ -0,0 +1,110 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.InputManagement;
using MelonLoader;
using NAK.PickupPushPull.InputModules;
namespace NAK.PickupPushPull;
public class PickupPushPull : MelonMod
{
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, description: "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, description: "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, description: "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 static PickupPushPull_Module _pushPullModule;
public override void OnInitializeMelon()
{
foreach (var entry in Category.Entries)
{
entry.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
}
EntryVRRotateBind.OnEntryValueChangedUntyped.Subscribe(OnUpdateVRBinding);
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
}
private System.Collections.IEnumerator WaitForLocalPlayer()
{
while (PlayerSetup.Instance == null)
yield return null;
_pushPullModule = new PickupPushPull_Module();
CVRInputManager.Instance.AddInputModule(_pushPullModule);
//update BlackoutController settings after it initializes
while (_pushPullModule == null)
yield return null;
UpdateVRBinding();
UpdateAllSettings();
}
private void OnUpdateSettings(object arg1, object arg2) => UpdateAllSettings();
private void OnUpdateVRBinding(object arg1, object arg2) => UpdateVRBinding();
private void UpdateAllSettings()
{
if (PickupPushPull_Module.Instance == null)
return;
//Global settings
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 = EntryDesktopUseZoomForRotate.Value;
//VR settings
PickupPushPull_Module.Instance.VR_RotateHand = EntryVRRotateHand.Value;
}
private void UpdateVRBinding()
{
//VR special settings
PickupPushPull_Module.Instance.VR_RotateBind = EntryVRRotateBind.Value;
PickupPushPull_Module.Instance.UpdateVRBinding();
}
}
public class BindingOptionsVR
{
public enum BindHand
{
Any,
LeftHand,
RightHand
}
public enum BindingOptions
{
//Only oculus bindings have by default
ButtonATouch,
ButtonBTouch,
TriggerTouch,
//doesnt work?
StickTouch,
//Index only
GripTouch
}
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"/>

View file

@ -0,0 +1,29 @@
using MelonLoader;
using NAK.PickupPushPull.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.PickupPushPull))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.PickupPushPull))]
[assembly: MelonInfo(
typeof(NAK.PickupPushPull.PickupPushPull),
nameof(NAK.PickupPushPull),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/PickupPushPull"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
namespace NAK.PickupPushPull.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "3.0.2";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,23 @@
{
"_id": 91,
"name": "PickupPushPull",
"modversion": "3.0.2",
"gameversion": "2022r170p1",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Allows you to push & pull pickups with Mouse, Gamepad, & VR.\nCan also optionally rotate props via keybind.\n\nIndex users will need to manually bind the missing SteamVR binds.",
"searchtags": [
"pull",
"push",
"pickup",
"prop"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r3/PickupPushPull.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/PickupPushPull/",
"changelog": "- Fixed issue where ControlEnableGamepad setting was improperly checked on startup.",
"embedcolor": "804221"
}