Decompiled source of TerminalTP v0.0.3

TerminalTP.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TerminalTP")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Allows use of teleporter from terminal.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4f5862f82aa63f8ead624c832e83f42584aa20a8")]
[assembly: AssemblyProduct("TerminalTP")]
[assembly: AssemblyTitle("TerminalTP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TerminalTP
{
	[BepInPlugin("me.kirbyquerby.lethalcompany.terminaltp", "Terminal TP", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "me.kirbyquerby.lethalcompany.terminaltp";

		private const string NAME = "Terminal TP";

		private const string VERSION = "0.0.1";

		private readonly Harmony harmony = new Harmony("me.kirbyquerby.lethalcompany.terminaltp");

		private void Awake()
		{
			harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TerminalTP";

		public const string PLUGIN_NAME = "TerminalTP";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TerminalTP.Patches
{
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ParsePlayerSentence")]
		private static void HandleTP(ref Terminal __instance, ref TerminalNode __result)
		{
			if (!(__instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded).ToLower() == "tp"))
			{
				return;
			}
			ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
			ShipTeleporter val = null;
			ShipTeleporter[] array2 = array;
			foreach (ShipTeleporter val2 in array2)
			{
				if (!val2.isInverseTeleporter)
				{
					val = val2;
					break;
				}
			}
			__result = ScriptableObject.CreateInstance<TerminalNode>();
			if ((Object)(object)val == (Object)null)
			{
				__result.displayText = "No teleporter found.";
			}
			else if (val.buttonTrigger.interactable)
			{
				__result.displayText = "Teleporting...";
				val.PressTeleportButtonOnLocalClient();
			}
			else
			{
				__result.displayText = val.buttonTrigger.disabledHoverTip;
			}
		}
	}
}