Please disclose if any significant portion of your mod was created 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 SoloSnareFree v1.0.0
BepInEx/plugins/JLeonL-SoloSnareFree/SoloSnareFree.dll
Decompiled 13 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SoloSnareFree")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SoloSnareFree")] [assembly: AssemblyTitle("SoloSnareFree")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 SoloSnareFree { [BepInPlugin("JLeonL.SoloSnareFree", "Solo Snare Free", "1.0.0")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "JLeonL.SoloSnareFree"; public const string PluginName = "Solo Snare Free"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource? Log; private Harmony? harmony; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; harmony = new Harmony("JLeonL.SoloSnareFree"); harmony.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Solo Snare Free 1.0.0 loaded. Snare fleas are removed on spawn when the host is playing alone."); } private void OnDestroy() { Harmony? obj = harmony; if (obj != null) { obj.UnpatchSelf(); } Log = null; } } [HarmonyPatch(typeof(CentipedeAI), "Start")] internal static class SnareFleaSpawnPatch { [HarmonyPostfix] internal static void Postfix(CentipedeAI __instance) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || !((NetworkBehaviour)instance).IsServer || instance.connectedPlayersAmount != 0) { return; } NetworkObject networkObject = ((NetworkBehaviour)__instance).NetworkObject; if (!((NetworkBehaviour)__instance).IsServer || (Object)(object)networkObject == (Object)null || !networkObject.IsSpawned) { return; } try { networkObject.Despawn(true); ManualLogSource? log = Plugin.Log; if (log != null) { log.LogInfo((object)"Removed a snare flea: one connected player (solo)."); } } catch (Exception arg) { ManualLogSource? log2 = Plugin.Log; if (log2 != null) { log2.LogError((object)$"Could not remove a solo snare flea: {arg}"); } } } } }