diff --git a/VisualCloneFix/Patches.cs b/VisualCloneFix/Patches.cs index 286b268..50356c8 100644 --- a/VisualCloneFix/Patches.cs +++ b/VisualCloneFix/Patches.cs @@ -26,9 +26,14 @@ public static class Patches ref Dictionary __result) { // add an fpr exclusion to the head bone - FPRExclusion headExclusion = headBone.gameObject.AddComponent(); + if (!headBone.TryGetComponent(out FPRExclusion headExclusion)) + { + headExclusion = headBone.gameObject.AddComponent(); + headExclusion.isShown = false; // default to hidden + headExclusion.target = headBone; + } + MeshHiderExclusion headExclusionBehaviour = new(); - headExclusion.target = headBone; headExclusion.behaviour = headExclusionBehaviour; headExclusionBehaviour.id = 1; // head bone is always 1 @@ -128,4 +133,13 @@ public static class Patches __result = vertexIndices; return false; } + + [HarmonyPrefix] + [HarmonyPatch(typeof(MeshHiderExclusion), nameof(MeshHiderExclusion.UpdateExclusions))] + private static bool OnUpdateExclusions(bool isShown, bool shrinkToZero, ref int ___id) + { + if (isShown) LocalCloneManager.cullingMask &= ~(1 << ___id); + else LocalCloneManager.cullingMask |= 1 << ___id; + return false; + } } \ No newline at end of file diff --git a/VisualCloneFix/Properties/AssemblyInfo.cs b/VisualCloneFix/Properties/AssemblyInfo.cs index 110b075..10b75bb 100644 --- a/VisualCloneFix/Properties/AssemblyInfo.cs +++ b/VisualCloneFix/Properties/AssemblyInfo.cs @@ -27,6 +27,6 @@ using System.Reflection; namespace NAK.VisualCloneFix.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.0"; + public const string Version = "1.0.1"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/VisualCloneFix/format.json b/VisualCloneFix/format.json index f17c2a0..ed16de1 100644 --- a/VisualCloneFix/format.json +++ b/VisualCloneFix/format.json @@ -1,7 +1,7 @@ { "_id": 221, "name": "VisualCloneFix", - "modversion": "1.0.0", + "modversion": "1.0.1", "gameversion": "2024r175", "loaderversion": "0.6.1", "modtype": "Mod", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r34/VisualCloneFix.dll", + "downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r36/VisualCloneFix.dll", "sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/VisualCloneFix/", - "changelog": "- Initial release", + "changelog": "- Fixed FPRExclusions IsShown state being inverted when toggled.\n- Fixed head FPRExclusion generation not checking for existing exclusion.", "embedcolor": "#f61963" } \ No newline at end of file