Decompiled source of StuckResetRemake v1.0.1

Mods/StuckResetRemake.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players.Subsystems;
using MelonLoader;
using Microsoft.CodeAnalysis;
using StuckResetRemake;
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(global::StuckResetRemake.StuckResetRemake), "StuckResetRemake", "1.0.0", "Lemonface85", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 132, 66, 255)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("StuckResetRemake")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StuckResetRemake")]
[assembly: AssemblyTitle("StuckResetRemake")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace StuckResetRemake
{
	public class StuckResetRemake : MelonMod
	{
		private readonly float timer = 2f;

		private float currentTime;

		private readonly InputAction leftInput = new InputAction((string)null, (InputActionType)0, "<XRController>{LeftHand}/joystickClicked", (string)null, (string)null, (string)null);

		private readonly InputAction rightInput = new InputAction((string)null, (InputActionType)0, "<XRController>{RightHand}/joystickClicked", (string)null, (string)null, (string)null);

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (sceneName != "Park" && sceneName != "Gym")
			{
				leftInput.Disable();
				rightInput.Disable();
				MelonLogger.Msg("Inputs Disabled. Scene:  " + sceneName);
			}
			else
			{
				leftInput.Enable();
				rightInput.Enable();
				MelonLogger.Msg("Inputs Enabled. Scene: " + sceneName);
			}
		}

		public override void OnFixedUpdate()
		{
			if (!(rightInput.ReadValue<float>() >= 0.999f) || !(leftInput.ReadValue<float>() >= 0.999f) || !leftInput.enabled)
			{
				currentTime = 0f;
				return;
			}
			currentTime += Time.fixedDeltaTime;
			if (currentTime > timer)
			{
				currentTime = 0f;
				PlayerResetSystem component = ((Component)GameObject.Find("Game Instance/Initializable/PlayerManager").GetComponent<PlayerManager>().localPlayer.Controller).gameObject.GetComponent<PlayerResetSystem>();
				component.ResetPlayerController();
				MelonLogger.Msg("Reset Player.");
			}
		}
	}
}