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 NoOrganicLife v1.0.1
NoOrganicLife.dll
Decompiled 2 years agousing 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.Configuration; using BepInEx.Logging; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("NoOrganicLife")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoOrganicLife")] [assembly: AssemblyTitle("NoOrganicLife")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace NoOrganicLife; public class NOLConfig { public static ConfigEntry<bool> allowBlobs; public static ConfigEntry<bool> allowLiving; } [BepInPlugin("Traveller.NoOrganicLife", "NoOrganicLife", "1.0.0")] public class NoOrganicLife : BaseUnityPlugin { public static bool loaded; private const string modID = "Traveller.NoOrganicLife"; private const string modName = "NoOrganicLife"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Traveller.NoOrganicLife"); private static NoOrganicLife Instance; public static ManualLogSource mls; private void Awake() { NOLConfig.allowBlobs = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra Allowed Enemies", "Allow Blobs?", true, "Whether or not the game should prevent Hygroderes from spawning inside."); NOLConfig.allowLiving = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra Allowed Enemies", "Allow Gray-Area Enemies?", false, "Whether or not the game should prevent Coil Heads, Nutcrackers, and Jesters from spawning inside."); mls = Logger.CreateLogSource("NoOrganicLife"); mls.LogInfo((object)"Loaded NoOrganicLife."); harmony.PatchAll(typeof(NoOrganicLife)); } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPrefix] private static bool NoMonstersSpawn(ref SelectableLevel newLevel) { if (StartOfRound.Instance.currentLevel.PlanetName != "5 Embrion") { return true; } mls.LogInfo((object)"Landed on Embrion."); List<string> source = new List<string> { "Spring", "Nutcracker", "Jester" }; foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies) { string LoopEnemy = enemy.enemyType.enemyName; if ((!LoopEnemy.Contains("Blob") || !NOLConfig.allowBlobs.Value) && (!source.Any((string variation) => LoopEnemy.Contains(variation)) || !NOLConfig.allowLiving.Value)) { enemy.rarity = 0; } } foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies) { if (!outsideEnemy.enemyType.enemyName.Contains("RadMech")) { outsideEnemy.rarity = 0; } } mls.LogDebug((object)"NoOrganicLife: Removed All Configured Organic Entities."); return true; } }