Decompiled source of Forsakenrooms v1.0.0

forsakenrooms.dll

Decompiled 12 hours ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoonBiomes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoonBiomes")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dff7ca5d-3545-47bb-af97-b1c75826b8a8")]
[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")]
[BepInPlugin("com.mrkixcat.stingerforsakenrooms", "stingerforsakenrooms", "1.0.0")]
public class MyModBase : BaseUnityPlugin
{
	public static AssetBundle PipeRoomsBundle;

	public static AudioClip StingerAudio;

	public static bool GlobalHasPlayedStinger;

	private readonly Harmony harmony = new Harmony("com.mrkixcat.stingerforsakenrooms");

	private void Awake()
	{
		string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "stingerforsakenrooms");
		PipeRoomsBundle = AssetBundle.LoadFromFile(text);
		if ((Object)(object)PipeRoomsBundle != (Object)null)
		{
			StingerAudio = PipeRoomsBundle.LoadAsset<AudioClip>("StingerForsakenRooms");
		}
		harmony.PatchAll();
	}
}
[HarmonyPatch(typeof(MenuManager))]
internal class MenuPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void ResetStingerOnMenu()
	{
		MyModBase.GlobalHasPlayedStinger = false;
	}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerPatch
{
	[HarmonyPatch("Update")]
	[HarmonyPostfix]
	private static void CheckInteriorTransition(PlayerControllerB __instance)
	{
		if (__instance.isPlayerControlled && __instance.isInsideFactory && !MyModBase.GlobalHasPlayedStinger && ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name.ToLower().Contains("forsakenrooms"))
		{
			PlayStinger();
			MyModBase.GlobalHasPlayedStinger = true;
		}
	}

	private static void PlayStinger()
	{
		if ((Object)(object)MyModBase.StingerAudio != (Object)null)
		{
			HUDManager.Instance.UIAudio.PlayOneShot(MyModBase.StingerAudio);
		}
	}
}