using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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("SpawnpointSetter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SpawnpointSetter")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7c6e09cf-7302-4548-8f22-18594e3370f5")]
[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 FreeplayRespawnMod;
[BepInPlugin("com.yourname.uch.freerespawn", "UCH Freeplay Spawn Setter", "1.1.0")]
public class FreeplayRespawnPlugin : BaseUnityPlugin
{
public static ConfigEntry<KeyCode> SetSpawnKey;
public static ConfigEntry<KeyCode> ResetSpawnKey;
private void Awake()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
SetSpawnKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "SetSpawnKey", (KeyCode)112, "Key to move spawn to your current position");
ResetSpawnKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ResetSpawnKey", (KeyCode)111, "Key to reset spawn to the map's default");
Harmony val = new Harmony("com.yourname.uch.freerespawn");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Freeplay Spawn Mod 1.1 Loaded!");
}
}
[HarmonyPatch(typeof(FreePlayControl), "SetupStart")]
public static class FreePlayControlPatch
{
public static void Postfix(MonoBehaviour __instance)
{
if ((Object)(object)((Component)__instance).gameObject.GetComponent<SpawnPointMover>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<SpawnPointMover>();
}
}
}
public class SpawnPointMover : MonoBehaviour
{
private Vector3 _originalSpawnPos;
private bool _hasSavedOriginal = false;
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(FreeplayRespawnPlugin.SetSpawnKey.Value))
{
SetNewSpawn();
}
if (Input.GetKeyDown(FreeplayRespawnPlugin.ResetSpawnKey.Value))
{
ResetToOriginal();
}
}
private void SetNewSpawn()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: 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)
Level val = (Level)Object.FindObjectOfType(typeof(Level));
Character val2 = (Character)Object.FindObjectOfType(typeof(Character));
if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)val.StartPoint != (Object)null)
{
if (!_hasSavedOriginal)
{
_originalSpawnPos = val.StartPoint.position;
_hasSavedOriginal = true;
}
Vector3 position = ((Component)val2).gameObject.transform.position;
Vector3 spawnFeetOffset = Level.GetSpawnFeetOffset();
val.StartPoint.position = position - spawnFeetOffset;
PlayEffect(position);
Debug.Log((object)$"[SpawnMod] Spawn moved to {position}");
}
}
private void ResetToOriginal()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
Level val = (Level)Object.FindObjectOfType(typeof(Level));
if ((Object)(object)val != (Object)null && (Object)(object)val.StartPoint != (Object)null && _hasSavedOriginal)
{
val.StartPoint.position = _originalSpawnPos;
PlayEffect(_originalSpawnPos);
Debug.Log((object)"[SpawnMod] Spawn reset to map default.");
}
}
private void PlayEffect(Vector3 pos)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)SmokePool.Instance != (Object)null)
{
SmokePool.Instance.SpawnSmoke((SmokeType)0, pos, 0.5f);
}
}
}