Decompiled source of NameAlwaysOn v1.0.1

LethalCompanyNameAlwaysOn.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LethalCompanyNameAlwaysOn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalCompanyNameAlwaysOn")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("23a98cc5-8f77-473c-904b-4f6263bdb9f4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalCompany;

[BepInPlugin("PDK.LethalCompany.NameAlwaysOn", "NameAlwaysOn", "1.0.1")]
public class MainAlwaysOn : BaseUnityPlugin
{
	public const string pluginGuid = "PDK.LethalCompany.NameAlwaysOn";

	public const string pluginName = "NameAlwaysOn";

	public const string pluginVersion = "1.0.1";

	private StartOfRound StartOfRoundInstance;

	private PlayerControllerB[] RealPlayerScripts;

	public static PlayerControllerB[] GetRealPlayerScripts(StartOfRound startOfRound)
	{
		if ((Object)(object)startOfRound == (Object)null || startOfRound.allPlayerScripts == null)
		{
			return (PlayerControllerB[])(object)new PlayerControllerB[0];
		}
		return startOfRound.allPlayerScripts.Where((PlayerControllerB x) => x.isPlayerDead || x.isPlayerControlled).ToArray();
	}

	private void Awake()
	{
	}

	private void Update()
	{
		StartOfRoundInstance = Object.FindObjectOfType<StartOfRound>();
		if ((Object)(object)StartOfRoundInstance != (Object)null)
		{
			RealPlayerScripts = GetRealPlayerScripts(StartOfRoundInstance);
			PlayerControllerB[] realPlayerScripts = RealPlayerScripts;
			for (int i = 0; i < realPlayerScripts.Length; i++)
			{
				realPlayerScripts[i].ShowNameBillboard();
			}
		}
	}
}