Decompiled source of NoToiletpaper v1.0.0

NoToiletpaper.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using NoToiletpaper.patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NoToiletpaper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoToiletpaper")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("997cfd19-2f78-40cc-a16d-28945037bb7f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoToiletpaper
{
	[BepInPlugin("Zesa.NoToiletpaper", "NoToiletpaper", "1.0.0.0")]
	public class NoToiletpaperBase : BaseUnityPlugin
	{
		private const string modGUID = "Zesa.NoToiletpaper";

		private const string modName = "NoToiletpaper";

		private const string modVersion = "1.0.0.0";

		private static NoToiletpaperBase Instance;

		private readonly Harmony harmony = new Harmony("Zesa.NoToiletpaper");

		public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll(typeof(RoundManagerPatch));
			Log.LogInfo((object)"Patched toiletpaper spawning..");
		}
	}
}
namespace NoToiletpaper.patches
{
	[HarmonyPatch(typeof(RoundManager))]
	public class RoundManagerPatch
	{
		[HarmonyPatch("SpawnScrapInLevel")]
		[HarmonyPrefix]
		public static void preSpawnScrapInLevel(RoundManager __instance)
		{
			for (int i = 0; i < __instance.currentLevel.spawnableScrap.Count; i++)
			{
				if (__instance.currentLevel.spawnableScrap[i].spawnableItem.itemName.StartsWith("Toilet"))
				{
					__instance.currentLevel.spawnableScrap.Remove(__instance.currentLevel.spawnableScrap[i]);
				}
			}
		}
	}
}