mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
FuckToes: fixes for r176
This commit is contained in:
parent
16a1a35a91
commit
51f29106c3
3 changed files with 38 additions and 24 deletions
|
@ -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<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.");
|
||||
|
||||
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.");
|
||||
|
||||
#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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue