Decompiled source of StuckReset v1.3.0

Mods/StuckReset.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Environment;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players.Subsystems;
using MelonLoader;
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.3.0", "BREAD", 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 leftJoystickClick = InputActionSetupExtensions.AddAction(map, "Left Joystick Click", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);

	private static InputAction rightJoystickClick = InputActionSetupExtensions.AddAction(map, "Right Joystick Click", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		currentPark = sceneName;
		InputActionSetupExtensions.AddBinding(leftJoystickClick, "<XRController>{LeftHand}/joystickClicked", (string)null, (string)null, (string)null);
		InputActionSetupExtensions.AddBinding(rightJoystickClick, "<XRController>{RightHand}/joystickClicked", (string)null, (string)null, (string)null);
		map.Enable();
	}

	public override void OnFixedUpdate()
	{
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		if (!(currentPark == "Park") && !(currentPark == "Gym"))
		{
			return;
		}
		if ((rightJoystickClick.ReadValue<float>() == 1f && leftJoystickClick.ReadValue<float>() == 1f) || (rightJoystickClick.ReadValue<float>() == 1f && leftJoystickClick.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 (rightJoystickClick.ReadValue<float>() == 0f && leftJoystickClick.ReadValue<float>() == 0f)
		{
			currenttime = DateTime.Now;
			active = false;
		}
	}
}