Decompiled source of NameplateHider v2.0.1

Mods/NameplateHider.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Utilities;
using MelonLoader;
using NameplateHider;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(main), "NameplateHider", "2.0.1", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTitle("NameplateHider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NameplateHider")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bc3481eb-b553-4982-979c-d5e847dbb861")]
[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 NameplateHider;

public class main : MelonMod
{
	private string currentScene = "Loader";

	private bool sceneChanged = false;

	private PlayerManager playerManager;

	private bool KeyReleased = true;

	private bool KeyPressed;

	private bool isActive;

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		sceneChanged = true;
	}

	public override void OnUpdate()
	{
		if (!(currentScene != "Park"))
		{
			if (Input.GetKeyDown((KeyCode)104) && KeyReleased)
			{
				KeyPressed = true;
				KeyReleased = false;
			}
			if (Input.GetKeyUp((KeyCode)104) && !KeyReleased)
			{
				KeyReleased = true;
			}
		}
	}

	public override void OnFixedUpdate()
	{
		if (sceneChanged)
		{
			if (currentScene == "Park")
			{
				try
				{
					playerManager = Singleton<PlayerManager>.instance;
					isActive = true;
				}
				catch
				{
					return;
				}
			}
			sceneChanged = false;
		}
		else if (KeyPressed)
		{
			isActive = !isActive;
			for (int i = 1; i < playerManager.AllPlayers.Count; i++)
			{
				MelonLogger.Msg((object)i);
				((Component)((Component)playerManager.AllPlayers[i].Controller).gameObject.transform.GetChild(8).GetChild(0)).gameObject.SetActive(isActive);
				((Component)((Component)playerManager.AllPlayers[i].Controller).gameObject.transform.GetChild(2).GetChild(0)).gameObject.SetActive(isActive);
			}
			KeyPressed = false;
		}
	}
}