FuckToes: fixes for r176

This commit is contained in:
NotAKidoS 2024-09-06 01:08:37 -05:00
parent 16a1a35a91
commit 51f29106c3
3 changed files with 38 additions and 24 deletions

View file

@ -6,46 +6,58 @@ using System.Reflection;
namespace NAK.FuckToes; 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 = #region Melon Preferences
MelonPreferences.CreateCategory(nameof(FuckToes));
public static readonly MelonPreferences_Entry<bool> EntryEnabledVR = private static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(nameof(FuckToesMod));
private static readonly MelonPreferences_Entry<bool> EntryEnabledVR =
Category.CreateEntry("Enabled in HalfBody", true, description: "Nuke VRIK toes when in Halfbody."); Category.CreateEntry("Enabled in HalfBody", true, description: "Nuke VRIK toes when in Halfbody.");
public static readonly MelonPreferences_Entry<bool> EntryEnabledFBT = private static readonly MelonPreferences_Entry<bool> EntryEnabledFBT =
Category.CreateEntry("Enabled in FBT", true, description: "Nuke VRIK toes when in FBT."); Category.CreateEntry("Enabled in FBT", true, description: "Nuke VRIK toes when in FBT.");
#endregion Melon Preferences
#region Melon Events
public override void OnInitializeMelon() public override void OnInitializeMelon()
{ {
Logger = LoggerInstance; Logger = LoggerInstance;
HarmonyInstance.Patch( HarmonyInstance.Patch(
typeof(VRIK).GetMethod(nameof(VRIK.AutoDetectReferences)), 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) private static void OnVRIKAutoDetectReferences_Prefix(ref VRIK __instance)
{ {
try try
{ {
// Must be PlayerLocal layer and in VR // Must be PlayerLocal layer and in VR
if (__instance.gameObject.layer != 8 || !MetaPort.Instance.isUsingVr) if (__instance.gameObject.layer != 8
|| !MetaPort.Instance.isUsingVr)
return; return;
// Not in FBT, and not enabled, perish switch (IKSystem.Instance.BodySystem.FullBodyActive)
if (!IKSystem.Instance.BodySystem.FBTActive() && !EntryEnabledVR.Value) {
return;
case false when !EntryEnabledVR.Value: // Not in FBT, and not enabled, perish
// In FBT, and not enabled in fbt, perish case true when !EntryEnabledFBT.Value: // In FBT, and not enabled in fbt, perish
if (IKSystem.Instance.BodySystem.FBTActive() && !EntryEnabledFBT.Value) return;
return; default:
__instance.references.leftToes = null;
__instance.references.leftToes = null; __instance.references.rightToes = null;
__instance.references.rightToes = null; break;
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -53,4 +65,6 @@ public class FuckToes : MelonMod
Logger.Error(e); Logger.Error(e);
} }
} }
#endregion Harmony Patches
} }

View file

@ -10,7 +10,7 @@ using System.Reflection;
[assembly: AssemblyProduct(nameof(NAK.FuckToes))] [assembly: AssemblyProduct(nameof(NAK.FuckToes))]
[assembly: MelonInfo( [assembly: MelonInfo(
typeof(NAK.FuckToes.FuckToes), typeof(NAK.FuckToes.FuckToesMod),
nameof(NAK.FuckToes), nameof(NAK.FuckToes),
AssemblyInfoParams.Version, AssemblyInfoParams.Version,
AssemblyInfoParams.Author, AssemblyInfoParams.Author,
@ -20,13 +20,13 @@ using System.Reflection;
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] [assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(255, 255, 200, 0)] [assembly: MelonColor(255, 246, 25, 99)] // red-pink
[assembly: MelonAuthorColor(255, 158, 21, 32)] [assembly: MelonAuthorColor(255, 158, 21, 32)] // red
[assembly: HarmonyDontPatchAll] [assembly: HarmonyDontPatchAll]
namespace NAK.FuckToes.Properties; namespace NAK.FuckToes.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "1.0.2"; public const string Version = "1.0.3";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }

View file

@ -1,7 +1,7 @@
{ {
"_id": 129, "_id": 129,
"name": "FuckToes", "name": "FuckToes",
"modversion": "1.0.2", "modversion": "1.0.3",
"gameversion": "2023r171", "gameversion": "2023r171",
"loaderversion": "0.6.1", "loaderversion": "0.6.1",
"modtype": "Mod", "modtype": "Mod",
@ -19,5 +19,5 @@
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r14/FuckToes.dll", "downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r14/FuckToes.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/FuckToes/", "sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/FuckToes/",
"changelog": "- Fixes for 2023r171.", "changelog": "- Fixes for 2023r171.",
"embedcolor": "#ffc800" "embedcolor": "#f61963"
} }