Decompiled source of Unstuck v1.0.0

Unstuck.dll

Decompiled 7 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 HarmonyLib;
using LethalCompanyTemplate.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[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("Unstuck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Unstuck")]
[assembly: AssemblyTitle("Unstuck")]
[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 LethalCompanyTemplate
{
	[BepInPlugin("Konomira.Unstuck", "Unstuck Mod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Konomira.Unstuck";

		private const string modName = "Unstuck Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Konomira.Unstuck");

		private static Plugin instance;

		private ManualLogSource logger;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			logger = Logger.CreateLogSource("Unstuck Mod");
			logger.LogInfo((object)"Mod Started");
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}
	}
}
namespace LethalCompanyTemplate.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update()
		{
			Keyboard current = Keyboard.current;
			if (current != null && ((ButtonControl)current.pKey).wasPressedThisFrame)
			{
				Unstuck();
			}
		}

		public static void Unstuck()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			object[] parameters = new object[2]
			{
				(int)GameNetworkManager.Instance.localPlayerController.playerClientId,
				true
			};
			Vector3 val = (Vector3)(typeof(StartOfRound).GetMethod("GetPlayerSpawnPosition", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(StartOfRound.Instance, parameters));
			GameNetworkManager.Instance.localPlayerController.TeleportPlayer(val, false, 0f, false, true);
		}
	}
}