Decompiled source of SetRespawnPoint v1.0.2

Mods/ResetRespawnPoint.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppSLZ.Marrow;
using MelonLoader;
using Microsoft.CodeAnalysis;
using ResetRespawnPoint;
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(Core), "ResetRespawnPoint", "1.0.0", "CAitStudio", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ResetRespawnPoint")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ResetRespawnPoint")]
[assembly: AssemblyTitle("ResetRespawnPoint")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 ResetRespawnPoint
{
	public class Core : MelonMod
	{
		[HarmonyPatch(typeof(Player_Health), "Death")]
		private static class DeathPatch
		{
			[HarmonyPostfix]
			private static void Postfix(Player_Health __instance)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				if (Instance.HaveRespawnOverride)
				{
					Player.RigManager.Teleport(Instance.RespawnPoint_p, true);
				}
				((Component)Player.RigManager).transform.rotation = Instance.RespawnPoint_r;
				((MelonBase)Instance).LoggerInstance.Msg("TP");
			}
		}

		public const string ModVersion = "1.0.0";

		private Page _mainPage;

		public bool HaveRespawnOverride = false;

		public Vector3 RespawnPoint_p = new Vector3(0f, 0f, 0f);

		public Quaternion RespawnPoint_r = Quaternion.Euler(0f, 0f, 0f);

		public static Core Instance;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("Reset Respawn Point Mod Initialized.");
			HaveRespawnOverride = false;
			Hooking.OnLevelLoading += delegate
			{
				OnLevelLoading();
			};
			SetupBoneMenu();
			Instance = this;
		}

		public void OnLevelLoading()
		{
			HaveRespawnOverride = false;
			((MelonBase)this).LoggerInstance.Msg("SetRespawnOverrideFalse");
		}

		public void SetupBoneMenu()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			_mainPage = Page.Root.CreatePage("Reset Respawn Point", Color.red, 0, true);
			_mainPage.CreateFunction("Reset Respawn Point Here", Color.green, (Action)delegate
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Expected O, but got Unknown
				RespawnPoint_p = ((Component)Player.RigManager.remapHeptaRig).transform.position;
				RespawnPoint_r = ((Component)Player.RigManager.remapHeptaRig).transform.rotation;
				HaveRespawnOverride = true;
				Instance loggerInstance = ((MelonBase)this).LoggerInstance;
				Vector3 respawnPoint_p = RespawnPoint_p;
				string? text = ((object)(Vector3)(ref respawnPoint_p)).ToString();
				Quaternion respawnPoint_r = RespawnPoint_r;
				loggerInstance.Msg("SetRespawnOverrideTrue" + text + ((object)(Quaternion)(ref respawnPoint_r)).ToString());
				Notification val = new Notification
				{
					Title = NotificationText.op_Implicit("Set Respawn Point Override Success!")
				};
				respawnPoint_p = RespawnPoint_p;
				string? text2 = ((object)(Vector3)(ref respawnPoint_p)).ToString();
				respawnPoint_r = RespawnPoint_r;
				val.Message = NotificationText.op_Implicit("New Respawn Pont at: Position:" + text2 + " Rotate:" + ((object)(Quaternion)(ref respawnPoint_r)).ToString());
				val.PopupLength = 5f;
				val.ShowTitleOnPopup = true;
				Notifier.Send(val);
			});
			_mainPage.CreateFunction("Delete Respawn Point", Color.green, (Action)delegate
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				RespawnPoint_p = new Vector3(0f, 0f, 0f);
				RespawnPoint_r = Quaternion.Euler(0f, 0f, 0f);
				HaveRespawnOverride = false;
				((MelonBase)this).LoggerInstance.Msg("SetRespawnOverrideFalse");
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("Delete Respawn Point Override Success!"),
					Message = NotificationText.op_Implicit("Delete Respawn Point Override Success!"),
					PopupLength = 5f,
					ShowTitleOnPopup = true
				});
			});
		}
	}
}