Decompiled source of BolderPracticeMod v0.0.2

RumbleFirst.dll

Decompiled 10 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppSystem;
using MelonLoader;
using Photon.Pun;
using RumbleFirst;
using UnhollowerBaseLib;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Main), "BolderPracticeMod", "0.0.1", "EchoPrograms", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("BolderPracticeMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("BolderPracticeMod")]
[assembly: AssemblyCopyright("Copyright © EchoPrograms 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0b1c849b-0eb0-43d1-a429-ecdec2e7babb")]
[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 RumbleFirst;

public class Main : MelonMod
{
	public static Main _instance;

	private static InputActionMap actionMap = new InputActionMap("actionmap");

	private static InputAction rightTrigger = InputActionSetupExtensions.AddAction(actionMap, "Right Grip", (InputActionType)1, "<XRController>{RightHand}/trigger", (string)null, (string)null, (string)null, (string)null);

	private float rightTriggerValue;

	private static InputAction leftTrigger = InputActionSetupExtensions.AddAction(actionMap, "Left Grip", (InputActionType)1, "<XRController>{LeftHand}/trigger", (string)null, (string)null, (string)null, (string)null);

	private float leftTriggerValue;

	private static InputAction aButton = InputActionSetupExtensions.AddAction(actionMap, "A Button", (InputActionType)1, "<XRController>{RightHand}/primaryButton", (string)null, (string)null, (string)null, (string)null);

	private bool aButtonValue;

	private static InputAction bButton = InputActionSetupExtensions.AddAction(actionMap, "B Button", (InputActionType)1, "<XRController>{RightHand}/secondaryButton", (string)null, (string)null, (string)null, (string)null);

	private bool bButtonValue;

	private string currentSceneName;

	private bool firstBootFlag = true;

	private Transform hand;

	private Material red;

	private bool leftFlag;

	private bool waitingOnCooldown;

	private bool rightFlag;

	private GameObject spawnhint;

	private float distance = 2f;

	public override void OnEarlyInitializeMelon()
	{
		_instance = this;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentSceneName = sceneName;
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		if (firstBootFlag)
		{
			actionMap.Enable();
			((MelonBase)this).LoggerInstance.Msg("Input Initiated");
			firstBootFlag = false;
		}
	}

	public override void OnFixedUpdate()
	{
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		if (currentSceneName != "Park")
		{
			return;
		}
		if ((Object)(object)hand == (Object)null)
		{
			try
			{
				hand = ((Component)Camera.main).gameObject.transform.parent.parent.GetChild(2).GetChild(0);
				red = ((Renderer)GameObject.Find("________________SCENE_________________/Park/Main static group/Root/Root_base_mesh_005__2_").GetComponent<MeshRenderer>()).material;
			}
			catch
			{
			}
		}
		else if (bButtonValue)
		{
			if (!rightFlag)
			{
				if (currentSceneName == "Park" && PhotonNetwork.IsMasterClient)
				{
					spawnhint = GameObject.CreatePrimitive((PrimitiveType)0);
					((Renderer)spawnhint.GetComponent<MeshRenderer>()).material = red;
					spawnhint.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
				}
				rightFlag = true;
			}
			if ((Object)(object)spawnhint != (Object)null)
			{
				spawnhint.transform.position = hand.TransformPoint(hand.localPosition + new Vector3(0f, distance, 0f));
			}
		}
		else if (rightFlag && !waitingOnCooldown)
		{
			if (currentSceneName == "Park" && PhotonNetwork.IsMasterClient)
			{
				Object.Destroy((Object)(object)spawnhint);
				PhotonNetwork.Instantiate("LargeRock", hand.TransformPoint(hand.localPosition + new Vector3(0f, distance, 0f)), Quaternion.identity, (byte)0, (Il2CppReferenceArray<Object>)null);
			}
			MelonCoroutines.Start(resetSpawn());
		}
		((MelonBase)this).OnUpdate();
		if (!firstBootFlag)
		{
			rightTriggerValue = rightTrigger.ReadValue<float>();
			leftTriggerValue = leftTrigger.ReadValue<float>();
			aButtonValue = aButton.ReadValue<float>() == 1f;
			bButtonValue = bButton.ReadValue<float>() == 1f;
		}
	}

	private IEnumerator resetSpawn()
	{
		waitingOnCooldown = true;
		((MelonBase)this).LoggerInstance.Msg("Cooldown started");
		yield return (object)new WaitForSeconds(5f);
		((MelonBase)this).LoggerInstance.Msg("Cooldown Ended");
		rightFlag = false;
		waitingOnCooldown = false;
	}
}