[FuckToes] Update for 2023r171

Fixed a few setting issues too.
This commit is contained in:
NotAKidoS 2023-07-26 10:38:14 -05:00
parent ba4bb02a6d
commit e61f119f32
4 changed files with 45 additions and 47 deletions

View file

@ -1,25 +0,0 @@
using ABI_RC.Core.Savior;
using HarmonyLib;
using RootMotion.FinalIK;
namespace NAK.FuckToes.HarmonyPatches;
//yes im patching VRIK directly, cvr does not force calibration or mess with references, and leaves it to vrik to handle
class VRIKPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(VRIK), "AutoDetectReferences")]
private static void Postfix_VRIK_AutoDetectReferences(ref VRIK __instance)
{
//only run for PlayerLocal VRIK
if (__instance.gameObject.layer != 8) return;
if (FuckToes.EntryEnabledVR.Value && MetaPort.Instance.isUsingVr)
{
if (!FuckToes.EntryEnabledFBT.Value && MetaPort.Instance.isUsingFullbody) return;
__instance.references.leftToes = null;
__instance.references.rightToes = null;
}
}
}

View file

@ -1,34 +1,56 @@
using MelonLoader;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.IK;
using MelonLoader;
using RootMotion.FinalIK;
using System.Reflection;
namespace NAK.FuckToes;
public class FuckToes : MelonMod
{
public static readonly MelonPreferences_Category Category =
internal static MelonLogger.Instance Logger;
public static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(nameof(FuckToes));
public static readonly MelonPreferences_Entry<bool> EntryEnabledVR =
Category.CreateEntry("Enabled", true, description: "Nuke VRIK toes when in Halfbody.");
public static readonly MelonPreferences_Entry<bool> EntryEnabledVR =
Category.CreateEntry("Enabled in HalfBody", true, description: "Nuke VRIK toes when in Halfbody.");
public static readonly MelonPreferences_Entry<bool> EntryEnabledFBT =
Category.CreateEntry("Enabled in FBT", false, description: "Nuke VRIK toes when in FBT.");
public static readonly MelonPreferences_Entry<bool> EntryEnabledFBT =
Category.CreateEntry("Enabled in FBT", true, description: "Nuke VRIK toes when in FBT.");
public override void OnInitializeMelon()
{
//Apply patches (i stole)
ApplyPatches(typeof(HarmonyPatches.VRIKPatches));
Logger = LoggerInstance;
HarmonyInstance.Patch(
typeof(VRIK).GetMethod(nameof(VRIK.AutoDetectReferences)),
prefix: new HarmonyLib.HarmonyMethod(typeof(FuckToes).GetMethod(nameof(OnVRIKAutoDetectReferences_Prefix), BindingFlags.NonPublic | BindingFlags.Static))
);
}
private void ApplyPatches(Type type)
private static void OnVRIKAutoDetectReferences_Prefix(ref VRIK __instance)
{
try
{
HarmonyInstance.PatchAll(type);
// Must be PlayerLocal layer and in VR
if (__instance.gameObject.layer != 8 || !MetaPort.Instance.isUsingVr)
return;
// Not in FBT, and not enabled, perish
if (!IKSystem.Instance.BodySystem.FBTActive() && !EntryEnabledVR.Value)
return;
// In FBT, and not enabled in fbt, perish
if (IKSystem.Instance.BodySystem.FBTActive() && !EntryEnabledFBT.Value)
return;
__instance.references.leftToes = null;
__instance.references.rightToes = null;
}
catch (Exception e)
{
LoggerInstance.Msg($"Failed while patching {type.Name}!");
LoggerInstance.Error(e);
Logger.Error($"Error during the patched method {nameof(OnVRIKAutoDetectReferences_Prefix)}");
Logger.Error(e);
}
}
}

View file

@ -1,4 +1,4 @@
using FuckToes.Properties;
using NAK.FuckToes.Properties;
using MelonLoader;
using System.Reflection;
@ -20,12 +20,13 @@ using System.Reflection;
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonOptionalDependencies("BTKUILib")]
[assembly: MelonColor(255, 255, 200, 0)]
[assembly: MelonAuthorColor(255, 158, 21, 32)]
[assembly: HarmonyDontPatchAll]
namespace FuckToes.Properties;
namespace NAK.FuckToes.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.1";
public const string Version = "1.0.2";
public const string Author = "NotAKidoS";
}

View file

@ -1,12 +1,12 @@
{
"_id": 129,
"name": "FuckToes",
"modversion": "1.0.1",
"gameversion": "2022r170p1",
"modversion": "1.0.2",
"gameversion": "2023r171",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Prevents VRIK from using toe bones in VR & optionaly FBT.\n\nVRIK calculates weird center of mass when toes are mapped, so it is sometimes desired to unmap toes to prevent an avatars feet from resting far back.\n\nPlease see the README for relevant imagery detailing the problem.",
"description": "Prevents VRIK from using toe bones in HalfBody or FBT.\n\nVRIK calculates weird center of mass when toes are mapped, so it is sometimes desired to unmap toes to prevent an avatars feet from resting far back.\n\nPlease see the README for relevant imagery detailing the problem.",
"searchtags": [
"toes",
"vrik",
@ -16,8 +16,8 @@
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/FuckToes.dll",
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r14/FuckToes.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/FuckToes/",
"changelog": "- Initial Release\n- No double patching. Bad. Stinky. Dont do it.",
"embedcolor": "#ffc700"
"changelog": "- Fixes for 2023r171.",
"embedcolor": "#ffc800"
}