Decompiled source of NoCrablets v1.0.1

NoCrablets.dll

Decompiled 15 hours ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using MelonLoader;
using NoCrablets;
using PuppetMasta;
using UnhollowerBaseLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(NoCrabletsMod), "NoCrablets", "1.0.1", "brissanna", null)]
[assembly: MelonGame("Stress Level Zero", "BONEWORKS")]
[assembly: AssemblyTitle("NoCrablets")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoCrablets")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("04fb5951-115a-4619-97ef-118c4441a267")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoCrablets;

public class NoCrabletsMod : MelonMod
{
	public override void OnApplicationStart()
	{
		((MelonBase)this).LoggerInstance.Msg("NoCrablets loaded. Crablets will be deleted on sight.");
		((MelonBase)this).HarmonyInstance.PatchAll();
	}

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		if (sceneName == "menu" || sceneName == "intro" || buildIndex == 0)
		{
			((MelonBase)this).LoggerInstance.Msg("Skipping scan for menu/intro scene: " + sceneName);
		}
		else
		{
			MelonCoroutines.Start(DelayedScan(sceneName));
		}
	}

	private IEnumerator DelayedScan(string sceneName)
	{
		yield return (object)new WaitForSeconds(2f);
		((MelonBase)this).LoggerInstance.Msg("Scanning scene: " + sceneName);
		GameObject[] allObjects = Il2CppArrayBase<GameObject>.op_Implicit(Object.FindObjectsOfType<GameObject>());
		GameObject[] array = allObjects;
		foreach (GameObject obj in array)
		{
			if (!((Object)(object)obj == (Object)null))
			{
				string name = ((Object)obj).name.ToLower();
				if (name.Contains("crablet"))
				{
					((MelonBase)this).LoggerInstance.Msg("Deleting on load: " + ((Object)obj).name);
					Object.Destroy((Object)(object)obj);
				}
			}
		}
	}
}
[HarmonyPatch(typeof(BehaviourCrablet), "OnInitiate")]
public class CrabletSpawnPatch
{
	private static void Postfix(BehaviourCrablet __instance)
	{
		MelonLogger.Msg("Crablet tried to spawn, deleting.");
		Object.Destroy((Object)(object)((Component)__instance).gameObject);
	}
}