Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MaskedInvisFix v0.0.3
BepInEx/plugins/VirusTLNR-MaskedInvisFix/MaskedInvisFix.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("VirusTLNR")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.3.0")] [assembly: AssemblyInformationalVersion("0.0.3")] [assembly: AssemblyProduct("MaskedInvisFix")] [assembly: AssemblyTitle("MaskedInvisFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MaskedInvisFix { [BepInPlugin("VirusTLNR.MaskedInvisFix", "MaskedInvisFix", "0.0.3")] public class Plugin : BaseUnityPlugin { public static bool MaskedInvisibilityFix = true; public static Plugin Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; Patch(); Logger.LogInfo((object)"VirusTLNR.MaskedInvisFix v0.0.3 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("VirusTLNR.MaskedInvisFix"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } internal static class PluginInfo { public const string PLUGIN_GUID = "VirusTLNR.MaskedInvisFix"; public const string PLUGIN_NAME = "MaskedInvisFix"; public const string PLUGIN_VERSION = "0.0.3"; } } namespace MaskedInvisFix.Patches { [HarmonyPatch(typeof(MaskedPlayerEnemy))] public class MaskedPlayerEnemyPatch { private static GameObject tragedyRagdoll = StartOfRound.Instance.playerRagdolls[4]; private static GameObject comedyRagdoll = StartOfRound.Instance.playerRagdolls[5]; [HarmonyPatch("SetVisibilityOfMaskedEnemy")] [HarmonyPrefix] private static bool MaskedInvisibilityFixPrefix(MaskedPlayerEnemy __instance) { if (!Plugin.MaskedInvisibilityFix) { return true; } string[] obj = new string[12] { "allowNoPlayer ? = ", __instance.allowSpawningWithoutPlayer.ToString(), " | enemyIsEnabled? = ", __instance.enemyEnabled.ToString(), " | mimickedPlayer = ", (((Object)(object)__instance.mimickingPlayer == (Object)null) ? "null" : ((string)(object)__instance.mimickingPlayer))?.ToString(), " | mimickedPlayer.IsPlayerDead = ", (((Object)(object)__instance.mimickingPlayer == (Object)null) ? "null" : ((object)__instance.mimickingPlayer.isPlayerDead))?.ToString(), " | mimickedPlayer.deadBody= ", ((Object)(object)__instance.mimickingPlayer == (Object)null || (Object)(object)__instance.mimickingPlayer.deadBody == (Object)null) ? "null" : ((Object)__instance.mimickingPlayer.deadBody).name, " | mimickedPlayer.deadBody.deactivated= ", null }; object obj2; if (!((Object)(object)__instance.mimickingPlayer == (Object)null) && !((Object)(object)__instance.mimickingPlayer.deadBody == (Object)null)) { _ = __instance.mimickingPlayer.deadBody.deactivated; obj2 = __instance.mimickingPlayer.deadBody.deactivated; } else { obj2 = "null"; } obj[11] = obj2?.ToString(); string text = string.Concat(obj); if (__instance.allowSpawningWithoutPlayer) { if ((Object)(object)__instance.mimickingPlayer != (Object)null && (Object)(object)__instance.mimickingPlayer.deadBody != (Object)null && !__instance.mimickingPlayer.deadBody.deactivated) { if (__instance.enemyEnabled) { __instance.enemyEnabled = false; ((EnemyAI)__instance).EnableEnemyMesh(false, false, false); Plugin.Logger.LogDebug((object)text); Plugin.Logger.LogDebug((object)"NonMimickedMasked-MaskedMadeInvisible"); return false; } } else if (!__instance.enemyEnabled) { __instance.enemyEnabled = true; ((EnemyAI)__instance).EnableEnemyMesh(true, false, false); Plugin.Logger.LogDebug((object)text); Plugin.Logger.LogDebug((object)"NonMimickedMasked-MaskedMadeVisible"); } return false; } if ((Object)(object)__instance.mimickingPlayer == (Object)null || (((Object)(object)__instance.mimickingPlayer.deadBody == (Object)(object)tragedyRagdoll || (Object)(object)__instance.mimickingPlayer.deadBody == (Object)(object)comedyRagdoll) && !__instance.mimickingPlayer.deadBody.deactivated)) { if (__instance.enemyEnabled) { __instance.enemyEnabled = false; ((EnemyAI)__instance).EnableEnemyMesh(false, false, false); Plugin.Logger.LogDebug((object)text); Plugin.Logger.LogDebug((object)"MimickedMasked-MaskedMadeInvisible"); } return false; } if (!__instance.enemyEnabled) { __instance.enemyEnabled = true; ((EnemyAI)__instance).EnableEnemyMesh(true, false, false); Plugin.Logger.LogDebug((object)text); Plugin.Logger.LogDebug((object)"MimickedMasked-MaskedMadeVisible"); } return false; } } }