From 51f29106c39fe37a176e766648d870aad5afa08c Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidoS@users.noreply.github.com> Date: Fri, 6 Sep 2024 01:08:37 -0500 Subject: [PATCH] FuckToes: fixes for r176 --- FuckToes/Main.cs | 50 ++++++++++++++++++----------- FuckToes/Properties/AssemblyInfo.cs | 8 ++--- FuckToes/format.json | 4 +-- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/FuckToes/Main.cs b/FuckToes/Main.cs index c98b8e0..7e6a936 100644 --- a/FuckToes/Main.cs +++ b/FuckToes/Main.cs @@ -6,46 +6,58 @@ using System.Reflection; namespace NAK.FuckToes; -public class FuckToes : MelonMod +public class FuckToesMod : MelonMod { - internal static MelonLogger.Instance Logger; + private static MelonLogger.Instance Logger; - public static readonly MelonPreferences_Category Category = - MelonPreferences.CreateCategory(nameof(FuckToes)); + #region Melon Preferences - public static readonly MelonPreferences_Entry EntryEnabledVR = + private static readonly MelonPreferences_Category Category = + MelonPreferences.CreateCategory(nameof(FuckToesMod)); + + private static readonly MelonPreferences_Entry EntryEnabledVR = Category.CreateEntry("Enabled in HalfBody", true, description: "Nuke VRIK toes when in Halfbody."); - public static readonly MelonPreferences_Entry EntryEnabledFBT = + private static readonly MelonPreferences_Entry EntryEnabledFBT = Category.CreateEntry("Enabled in FBT", true, description: "Nuke VRIK toes when in FBT."); + #endregion Melon Preferences + + #region Melon Events + public override void OnInitializeMelon() { Logger = LoggerInstance; HarmonyInstance.Patch( typeof(VRIK).GetMethod(nameof(VRIK.AutoDetectReferences)), - prefix: new HarmonyLib.HarmonyMethod(typeof(FuckToes).GetMethod(nameof(OnVRIKAutoDetectReferences_Prefix), BindingFlags.NonPublic | BindingFlags.Static)) + prefix: new HarmonyLib.HarmonyMethod(typeof(FuckToesMod).GetMethod(nameof(OnVRIKAutoDetectReferences_Prefix), BindingFlags.NonPublic | BindingFlags.Static)) ); } + + #endregion Melon Events + #region Harmony Patches + private static void OnVRIKAutoDetectReferences_Prefix(ref VRIK __instance) { try { // Must be PlayerLocal layer and in VR - if (__instance.gameObject.layer != 8 || !MetaPort.Instance.isUsingVr) + 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; + switch (IKSystem.Instance.BodySystem.FullBodyActive) + { + + case false when !EntryEnabledVR.Value: // Not in FBT, and not enabled, perish + case true when !EntryEnabledFBT.Value: // In FBT, and not enabled in fbt, perish + return; + default: + __instance.references.leftToes = null; + __instance.references.rightToes = null; + break; + } } catch (Exception e) { @@ -53,4 +65,6 @@ public class FuckToes : MelonMod Logger.Error(e); } } + + #endregion Harmony Patches } \ No newline at end of file diff --git a/FuckToes/Properties/AssemblyInfo.cs b/FuckToes/Properties/AssemblyInfo.cs index 68c3504..c26d688 100644 --- a/FuckToes/Properties/AssemblyInfo.cs +++ b/FuckToes/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Reflection; [assembly: AssemblyProduct(nameof(NAK.FuckToes))] [assembly: MelonInfo( - typeof(NAK.FuckToes.FuckToes), + typeof(NAK.FuckToes.FuckToesMod), nameof(NAK.FuckToes), AssemblyInfoParams.Version, AssemblyInfoParams.Author, @@ -20,13 +20,13 @@ using System.Reflection; [assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] [assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] -[assembly: MelonColor(255, 255, 200, 0)] -[assembly: MelonAuthorColor(255, 158, 21, 32)] +[assembly: MelonColor(255, 246, 25, 99)] // red-pink +[assembly: MelonAuthorColor(255, 158, 21, 32)] // red [assembly: HarmonyDontPatchAll] namespace NAK.FuckToes.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.2"; + public const string Version = "1.0.3"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/FuckToes/format.json b/FuckToes/format.json index de762bf..c02103b 100644 --- a/FuckToes/format.json +++ b/FuckToes/format.json @@ -1,7 +1,7 @@ { "_id": 129, "name": "FuckToes", - "modversion": "1.0.2", + "modversion": "1.0.3", "gameversion": "2023r171", "loaderversion": "0.6.1", "modtype": "Mod", @@ -19,5 +19,5 @@ "downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r14/FuckToes.dll", "sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/FuckToes/", "changelog": "- Fixes for 2023r171.", - "embedcolor": "#ffc800" + "embedcolor": "#f61963" } \ No newline at end of file