using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using MelonLoader;
using PanicButtonMod;
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(PanicButton), "Panic Button", "1.2.1", "bob", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("Panic Button")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Panic Button")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("db538e49-eb7c-43d9-8c89-57e07161badc")]
[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 PanicButtonMod;
public class PanicButton : MelonMod
{
private bool isPanicButtonEnabled = true;
private Vector3 spawnPosition = Vector3.zero;
private bool hasSavedSpawn = false;
private float lastPressTime = 0f;
private const float doubleClickDelay = 0.4f;
public override void OnInitializeMelon()
{
SetupBoneMenu();
}
public override void OnUpdate()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player.RigManager != (Object)null)
{
if (!hasSavedSpawn)
{
spawnPosition = ((Component)Player.RigManager).transform.position;
hasSavedSpawn = true;
((MelonBase)this).LoggerInstance.Msg($"[Panic Button] Saved map spawn location: {spawnPosition}");
}
}
else
{
hasSavedSpawn = false;
}
if (isPanicButtonEnabled && (Input.GetKeyDown((KeyCode)331) || Input.GetKeyDown((KeyCode)112)))
{
float num = Time.time - lastPressTime;
if (num <= 0.4f)
{
ExecutePanicTeleport();
}
lastPressTime = Time.time;
}
}
private void ExecutePanicTeleport()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player.RigManager != (Object)null && hasSavedSpawn)
{
Player.RigManager.Teleport(spawnPosition, true);
((MelonBase)this).LoggerInstance.Msg("[Panic Button] Double-clicked! Teleported safely back to spawn.");
}
}
private void SetupBoneMenu()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
Page val = Page.Root.CreatePage("Panic Button", Color.cyan, 0, true);
val.CreateBool("Panic Button Status", Color.white, isPanicButtonEnabled, (Action<bool>)delegate(bool value)
{
isPanicButtonEnabled = value;
});
val.CreatePage("Made by Bob", Color.cyan, 0, true);
}
}