This commit is contained in:
NotAKidoS 2024-01-03 01:50:40 -06:00
parent 21f8893095
commit a92e478eb9
22 changed files with 2 additions and 80 deletions

View file

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

View file

@ -0,0 +1,58 @@
using MelonLoader;
using System.Reflection;
using ABI_RC.Systems.InputManagement.InputModules;
using ABI_RC.Systems.InputManagement.XR;
namespace NAK.EzGrab;
public class EzGrab : MelonMod
{
private const string SettingsCategory = nameof(EzGrab);
private static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(SettingsCategory);
private static readonly MelonPreferences_Entry<bool> EntryEnabled =
Category.CreateEntry("Enabled", true,
description: "Should EzGrab be enabled?");
private static readonly MelonPreferences_Entry<float> EntryReleaseWeight =
Category.CreateEntry("Release Weight", 0.1f,
description: "The release weight for grip up to fire.");
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(
typeof(CVRInputModule_XR).GetMethod(nameof(CVRInputModule_XR.Update_Grip)),
prefix: new HarmonyLib.HarmonyMethod(typeof(EzGrab).GetMethod(nameof(OnCVRInputModule_XR_Prefix), BindingFlags.NonPublic))
);
}
private static void OnCVRInputModule_XR_Prefix(CVRXRModule module, ref CVRInputModule_XR __instance)
{
if (module.Type != EXRControllerType.Index || !EntryEnabled.Value) return;
float gripValue = module.Grip;
float gripThreshold = __instance._indexGripThreshold;
float releaseThreshold = EntryReleaseWeight.Value;
if (module.IsLeftHand)
{
float lastGripLeft = __instance._lastGripLeft;
if ((gripValue < gripThreshold && lastGripLeft >= gripThreshold) &&
!(gripValue < releaseThreshold && lastGripLeft >= releaseThreshold))
{
__instance._lastGripLeft = 0f;
}
}
else
{
float lastGripRight = __instance._lastGripRight;
if ((gripValue < gripThreshold && lastGripRight >= gripThreshold) &&
!(gripValue < releaseThreshold && lastGripRight >= releaseThreshold))
{
__instance._lastGripRight = 0f;
}
}
}
}

View file

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

View file

@ -0,0 +1,23 @@
{
"_id": -1,
"name": "EzCurls",
"modversion": "1.0.0",
"gameversion": "2022r170p1",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "A mod that should hopefully make finger curls more predictable.",
"searchtags": [
"aas",
"sync",
"naked",
"buffer"
],
"requirements": [
"UIExpansionKit"
],
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r13/EzCurls.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/EzCurls/",
"changelog": "- Initial CVRMG release",
"embedcolor": "7d7d7d"
}