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 VentSpawnFix v1.2.3
VentSpawnFix.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; 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("VentSpawnFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Allows indoor enemies to spawn in groups larger than 1, like outdoor and daytime enemies.")] [assembly: AssemblyFileVersion("1.2.3.0")] [assembly: AssemblyInformationalVersion("1.2.3+b2c3fea8b43ee64d6502f65d654be2af370e1c41")] [assembly: AssemblyProduct("VentSpawnFix")] [assembly: AssemblyTitle("VentSpawnFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VentSpawnFix { internal static class LobbyCompatibility { internal static void Init() { PluginHelper.RegisterPlugin("butterystancakes.lethalcompany.ventspawnfix", Version.Parse("1.2.3"), (CompatibilityLevel)1, (VersionStrictness)0); } } [BepInPlugin("butterystancakes.lethalcompany.ventspawnfix", "Vent Spawn Fix", "1.2.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string PLUGIN_GUID = "butterystancakes.lethalcompany.ventspawnfix"; internal const string PLUGIN_NAME = "Vent Spawn Fix"; internal const string PLUGIN_VERSION = "1.2.3"; internal static ManualLogSource Logger; private const string GUID_LOBBY_COMPATIBILITY = "BMX.LobbyCompatibility"; private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Lobby Compatibility detected"); LobbyCompatibility.Init(); } new Harmony("butterystancakes.lethalcompany.ventspawnfix").PatchAll(); Logger.LogInfo((object)"Vent Spawn Fix v1.2.3 loaded"); } } [HarmonyPatch] internal class VentSpawnFixPatches { [HarmonyPatch(typeof(RoundManager), "AssignRandomEnemyToVent")] [HarmonyPrefix] private static bool RoundManagerPreAssignRandomEnemyToVent(RoundManager __instance, ref EnemyVent vent, ref bool __result) { if (vent.occupied) { Plugin.Logger.LogDebug((object)("A new enemy tried to occupy vent with \"" + vent.enemyType.enemyName + "\" already inside")); List<EnemyVent> list = __instance.allEnemyVents.Where((EnemyVent enemyVent) => !enemyVent.occupied).ToList(); if (list.Count < 1) { Plugin.Logger.LogDebug((object)"Enemy spawn cancelled because all vents on the map are occupied"); __result = false; return false; } vent = list[__instance.AnomalyRandom.Next(0, list.Count)]; Plugin.Logger.LogDebug((object)"Enemy successfully reassigned to another empty vent"); } return true; } [HarmonyPatch(typeof(RoundManager), "AssignRandomEnemyToVent")] [HarmonyPostfix] private static void RoundManagerPostAssignRandomEnemyToVent(RoundManager __instance, EnemyVent vent, bool __result, int ___currentHour) { if (!__result) { return; } EnemyType enemy = vent?.enemyType; if ((Object)(object)enemy == (Object)null) { Plugin.Logger.LogWarning((object)"AssignRandomEnemyToVent completed without assigning an enemy to the vent. This shouldn't happen"); } else if (vent.enemyTypeIndex < 0 || vent.enemyTypeIndex > __instance.currentLevel.Enemies.Count || !__instance.currentLevel.Enemies.Any((SpawnableEnemyWithRarity spawnableEnemyWithRarity) => (Object)(object)spawnableEnemyWithRarity.enemyType == (Object)(object)enemy)) { Plugin.Logger.LogWarning((object)"AssignRandomEnemyToVent assigned an enemy with an invalid index. This shouldn't happen"); } else { if (enemy.spawnInGroupsOf <= 1) { return; } Plugin.Logger.LogDebug((object)$"Enemy \"{enemy.enemyName}\" spawned in vent, requesting group of {enemy.spawnInGroupsOf}"); int num = enemy.spawnInGroupsOf - 1; List<EnemyVent> list = __instance.allEnemyVents.Where((EnemyVent enemyVent) => !enemyVent.occupied).ToList(); while (num > 0) { if (list.Count <= 0) { Plugin.Logger.LogDebug((object)("Can't spawn additional \"" + enemy.enemyName + "\" (all vents are occupied)")); break; } if (enemy.numberSpawned >= enemy.MaxCount) { Plugin.Logger.LogDebug((object)$"Can't spawn additional \"{enemy.enemyName}\" ({enemy.MaxCount} have already spawned)"); break; } if (enemy.PowerLevel > __instance.currentMaxInsidePower - __instance.currentEnemyPower) { Plugin.Logger.LogDebug((object)$"Can't spawn additional \"{enemy.enemyName}\" ({__instance.currentEnemyPower} + {enemy.PowerLevel} would exceed max power level of {__instance.currentMaxInsidePower})"); break; } int num2 = (int)vent.spawnTime; EnemyVent val = list[__instance.AnomalyRandom.Next(0, list.Count)]; __instance.currentEnemyPower += enemy.PowerLevel; val.enemyType = enemy; val.enemyTypeIndex = vent.enemyTypeIndex; val.occupied = true; val.spawnTime = num2; if (__instance.timeScript.hour - ___currentHour <= 0) { val.SyncVentSpawnTimeClientRpc(num2, vent.enemyTypeIndex); } EnemyType obj = enemy; obj.numberSpawned++; __instance.enemySpawnTimes.Add(num2); list.Remove(val); Plugin.Logger.LogDebug((object)("Spawning additional \"" + enemy.enemyName + "\" in vent")); num--; } if (num < enemy.spawnInGroupsOf - 1) { __instance.enemySpawnTimes.Sort(); } } } } public static class PluginInfo { public const string PLUGIN_GUID = "VentSpawnFix"; public const string PLUGIN_NAME = "VentSpawnFix"; public const string PLUGIN_VERSION = "1.2.3"; } }