Decompiled source of TerminalMouse v1.0.1

TerminalMouse.dll

Decompiled 4 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 BepInEx.Logging;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TerminalMouse")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("TerminalMouse mod")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("TerminalMouse")]
[assembly: AssemblyTitle("TerminalMouse")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 TerminalMouse
{
	[BepInPlugin("TerminalMouse", "TerminalMouse", "1.0.1")]
	public class TerminalMousePlugin : BaseUnityPlugin
	{
		public static ManualLogSource mls;

		private CursorLockMode locked;

		private bool wasVisible = false;

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			mls = ((BaseUnityPlugin)this).Logger;
			Terminal.BeginUsingTerminal += new hook_BeginUsingTerminal(Terminal_BeginUsingTerminal);
			Terminal.QuitTerminal += new hook_QuitTerminal(Terminal_QuitTerminal);
			PlayerControllerB.KillPlayer += new hook_KillPlayer(PlayerControllerB_KillPlayer);
			mls.LogInfo((object)"Plugin TerminalMouse is loaded!");
		}

		private void Terminal_BeginUsingTerminal(orig_BeginUsingTerminal orig, Terminal self)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			locked = Cursor.lockState;
			wasVisible = Cursor.visible;
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			if ((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null)
			{
				StartOfRound.Instance.localPlayerController.disableLookInput = true;
			}
		}

		private void Terminal_QuitTerminal(orig_QuitTerminal orig, Terminal self)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Cursor.lockState = locked;
			Cursor.visible = wasVisible;
			if ((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null)
			{
				StartOfRound.Instance.localPlayerController.disableLookInput = false;
			}
		}

		private void PlayerControllerB_KillPlayer(orig_KillPlayer orig, PlayerControllerB self, Vector3 bodyVelocity, bool spawnBody, CauseOfDeath causeOfDeath, int deathAnimation)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, bodyVelocity, spawnBody, causeOfDeath, deathAnimation);
			if (((NetworkBehaviour)self).IsLocalPlayer)
			{
				Cursor.lockState = locked;
				Cursor.visible = wasVisible;
				if ((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null)
				{
					StartOfRound.Instance.localPlayerController.disableLookInput = false;
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TerminalMouse";

		public const string PLUGIN_NAME = "TerminalMouse";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}