Decompiled source of StuckReset v1.0.0

Mods/StuckReset.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using RUMBLE.Environment;
using RUMBLE.Managers;
using RUMBLE.Players.Subsystems;
using StuckReset1;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(StuckReset), "StuckReset", "1.0.0", "BReadyMans", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("TestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2f619dcf-a1bd-4d93-b936-e3e1817a82f9")]
[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 StuckReset1;

public class StuckReset : MelonMod
{
	public ParkInstance testie;

	public float timer = 0.2f;

	public float spawnrate = 0.2f;

	public bool active = false;

	public DateTime currenttime;

	public string currentPark;

	private static InputActionMap map = new InputActionMap("Rest Xr Map");

	private static InputAction rightThumbstick = InputActionSetupExtensions.AddAction(map, "Right Joysitck Click", (InputActionType)1, "<XRController>{RightHand}/thumbstickClick", (string)null, (string)null, (string)null, (string)null);

	private static InputAction leftThumbstick = InputActionSetupExtensions.AddAction(map, "Left Joystick Click", (InputActionType)1, "<XRController>{LeftHand}/thumbstickClick", (string)null, (string)null, (string)null, (string)null);

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		currentPark = sceneName;
		map.Enable();
	}

	public override void OnFixedUpdate()
	{
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		if (!(currentPark == "Park") && !(currentPark == "Gym"))
		{
			return;
		}
		if (rightThumbstick.ReadValue<float>() == 1f && leftThumbstick.ReadValue<float>() == 1f)
		{
			if (!active)
			{
				currenttime = DateTime.Now.AddSeconds(3.0);
				active = true;
			}
			else if (currenttime <= DateTime.Now)
			{
				PlayerResetSystem component = ((Component)GameObject.Find("Game Instance/Initializable/PlayerManager").GetComponent<PlayerManager>().localPlayer.Controller).gameObject.GetComponent<PlayerResetSystem>();
				if (currentPark == "Gym")
				{
					component.RPC_RelocatePlayerController(Vector3.zero + new Vector3(0f, 2f, 0f), Quaternion.identity);
				}
				else
				{
					component.RPC_RelocatePlayerController(Vector3.zero, Quaternion.identity);
				}
				active = false;
			}
		}
		if (rightThumbstick.ReadValue<float>() == 0f && leftThumbstick.ReadValue<float>() == 0f)
		{
			currenttime = DateTime.Now;
			active = false;
		}
	}
}