Decompiled source of LCTweaks v1.0.0

BepInEx/plugins/LCTweaks.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[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("LCTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Tweaks a number of Lethal Company features.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+14dd00b41bf13d3eb7a4e2f19bdd5251db9d9a16")]
[assembly: AssemblyProduct("LCTweaks")]
[assembly: AssemblyTitle("LCTweaks")]
[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 LCTweaks
{
	public class DotColorController : MonoBehaviour
	{
		public PlayerControllerB player;

		private Material dotMat;

		private Material viewMat;

		private static Color FULL_HEALTH = new Color(0f, 1f, 0f);

		private static Color LITTLE_HURT = new Color(1f, 0.75f, 0f);

		private static Color FAIRLY_HURT = new Color(1f, 0.65f, 0f);

		private static Color PRETTY_HURT = new Color(1f, 0.58f, 0f);

		private static Color VERY_HURT = new Color(1f, 0.48f, 0f);

		private static Color CRITICALLY_HURT = new Color(1f, 0.33f, 0f);

		private static Color DEAD = new Color(1f, 0f, 0f);

		private static Color col = FULL_HEALTH;

		private void Awake()
		{
			if ((Object)(object)((Component)this).GetComponent<Animator>() != (Object)null)
			{
				((Behaviour)((Component)this).GetComponent<Animator>()).enabled = false;
			}
		}

		private void Update()
		{
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null)
			{
				if (player.isPlayerDead)
				{
					col = DEAD;
				}
				else if (player.health >= 100)
				{
					col = FULL_HEALTH;
				}
				else if (player.health >= 80)
				{
					col = LITTLE_HURT;
				}
				else if (player.health >= 60)
				{
					col = FAIRLY_HURT;
				}
				else if (player.health >= 40)
				{
					col = PRETTY_HURT;
				}
				else if (player.health >= 20)
				{
					col = VERY_HURT;
				}
				else if (player.health >= 0)
				{
					col = CRITICALLY_HURT;
				}
				else
				{
					col = DEAD;
				}
			}
			else
			{
				col = DEAD;
			}
			if ((Object)(object)dotMat == (Object)null)
			{
				dotMat = ((Component)this).GetComponent<Renderer>().material;
				viewMat = ((Component)((Component)this).transform.Find("MapDirectionIndicator")).GetComponent<Renderer>().material;
				if ((Object)(object)player != (Object)null)
				{
					LCTweaks.DebugLog("Storing instanced material for player " + ((Object)player).name);
				}
				else
				{
					LCTweaks.DebugLog("Storing instanced material for nonplayer object");
				}
			}
			viewMat.color = col;
			viewMat.SetColor("_EmissiveColor", col);
			dotMat.color = col;
			dotMat.SetColor("_EmissiveColor", col);
		}
	}
	public class LCTConfig
	{
		public ConfigEntry<bool> ToggleSprint { get; private set; }

		public ConfigEntry<float> DropAllDelay { get; private set; }

		public ConfigEntry<int> MaxScannables { get; private set; }

		public ConfigEntry<bool> ScanInShip { get; private set; }

		public ConfigEntry<bool> TerminalBoom { get; private set; }

		public ConfigEntry<bool> MuteNearTerm { get; private set; }

		public ConfigEntry<bool> HealthOnTerm { get; private set; }

		public LCTConfig(ConfigFile cfg)
		{
			ToggleSprint = cfg.Bind<bool>("Input", "ToggleSprint", false, "If true, pressing the sprint key will keep the player sprinting until they stop moving.");
			DropAllDelay = cfg.Bind<float>("Input", "DropAllDelay", 1f, "How many seconds drop must be held to drop all items.\nMust be greater than or equal to the drop scrap delay");
			MaxScannables = cfg.Bind<int>("Scanner", "MaxScannableObjects", 13, "Sets how many items the scanner can pick up at once.\nMust be at least 13.");
			ScanInShip = cfg.Bind<bool>("Scanner", "ScanThroughWallsInShip", false, "If true, scrap in the ship can be scanned through walls.");
			TerminalBoom = cfg.Bind<bool>("Terminal", "TerminalMineExplosion", false, "If true, disabling mines from the terminal will trigger them to explode.");
			MuteNearTerm = cfg.Bind<bool>("Terminal", "MuteNearTerminal", false, "Makes it so that eyeless dogs cannot hear noises that come from within 5 meters of the terminal.");
			HealthOnTerm = cfg.Bind<bool>("Terminal", "ShowHealthOnRadar", false, "If true, player indicators on radar will change with health.");
			DropAllDelay.Value = Mathf.Max(DropAllDelay.Value, 0.1f);
			MaxScannables.Value = Math.Max(MaxScannables.Value, 13);
		}
	}
	public class LCTCustomInputs : LcInputActions
	{
		public static PlayerControllerB clientPlayer;

		public static LCTCustomInputs instance { get; private set; }

		[InputAction("<Keyboard>/c", Name = "Auto-Walk")]
		public InputAction AutoWalkButton { get; private set; }

		public LCTCustomInputs()
		{
			instance = this;
		}

		public static void ToggleAutoWalk(CallbackContext context)
		{
			if ((Object)(object)clientPlayer != (Object)null && clientPlayer.isPlayerControlled && !clientPlayer.isTypingChat && !clientPlayer.inTerminalMenu && !clientPlayer.quickMenuManager.isMenuOpen)
			{
				Patches.autoWalk = !Patches.autoWalk;
			}
		}

		public static void DiscardPerformed(CallbackContext context)
		{
			Patches.dropAllTime = Time.time + LCTweaks.config.DropAllDelay.Value;
		}

		public static void DiscardCanceled(CallbackContext context)
		{
			LCTweaks.DebugLog("Drop canceled");
			Patches.dropAllTime = -1f;
		}
	}
	[BepInPlugin("coderCleric.LCTweaks", "LCTweaks", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LCTweaks : BaseUnityPlugin
	{
		public const string MOD_GUID = "coderCleric.LCTweaks";

		public const string MOD_NAME = "LCTweaks";

		public const string MOD_VERSION = "1.0.0";

		public int c;

		private static LCTweaks instance;

		public static LCTConfig config;

		private void Awake()
		{
			instance = this;
			config = new LCTConfig(((BaseUnityPlugin)this).Config);
			new LCTCustomInputs();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin coderCleric.LCTweaks is loaded!");
		}

		public static void DebugLog(string msg)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)msg);
		}
	}
	[HarmonyPatch]
	public static class Patches
	{
		public static bool sHeld = false;

		public static bool sNew = false;

		public static bool autoWalk = false;

		public static float dropAllTime = -1f;

		private static Terminal term = null;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "MeetsScanNodeRequirements")]
		public static void ScanThroughWallsInShip(ScanNodeProperties node)
		{
			GrabbableObject component = (GrabbableObject)(object)((Component)((Component)node).transform.parent).gameObject.GetComponent<PhysicsProp>();
			if (LCTweaks.config.ScanInShip.Value && (Object)(object)component != (Object)null && component.isInShipRoom)
			{
				node.requiresLineOfSight = false;
			}
			else if (LCTweaks.config.ScanInShip.Value && (Object)(object)component != (Object)null)
			{
				node.requiresLineOfSight = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "Awake")]
		public static void OverridePingNumber(HUDManager __instance)
		{
			__instance.scanNodesHit = (RaycastHit[])(object)new RaycastHit[LCTweaks.config.MaxScannables.Value];
			if (LCTweaks.config.MaxScannables.Value - 13 > 0)
			{
				RectTransform[] array = (RectTransform[])(object)new RectTransform[LCTweaks.config.MaxScannables.Value];
				for (int i = 0; i < __instance.scanElements.Length; i++)
				{
					array[i] = __instance.scanElements[i];
				}
				Transform parent = ((Transform)array[0]).parent;
				for (int j = 13; j < LCTweaks.config.MaxScannables.Value; j++)
				{
					array[j] = Object.Instantiate<RectTransform>(array[0], parent);
				}
				__instance.scanElements = array;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TerminalAccessibleObject), "CallFunctionFromTerminal")]
		public static bool ExplodeFromTerminal(TerminalAccessibleObject __instance)
		{
			Landmine component = ((Component)__instance).gameObject.GetComponent<Landmine>();
			if ((Object)(object)component == (Object)null || !LCTweaks.config.TerminalBoom.Value)
			{
				return true;
			}
			typeof(Landmine).GetMethod("TriggerMineOnLocalClientByExiting", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(component, new object[0]);
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Landmine), "Detonate")]
		public static void ClearMineFromTerm(Landmine __instance)
		{
			Image mapRadarBox = ((Component)__instance).gameObject.GetComponent<TerminalAccessibleObject>().mapRadarBox;
			if ((Object)(object)mapRadarBox != (Object)null)
			{
				((Component)((Component)mapRadarBox).transform.parent).gameObject.SetActive(false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Terminal), "Awake")]
		public static void GrabTerminal(Terminal __instance)
		{
			term = __instance;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MouthDogAI), "DetectNoise")]
		public static bool MuteNearTerm(Vector3 noisePosition)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)term == (Object)null || !LCTweaks.config.MuteNearTerm.Value)
			{
				return true;
			}
			bool num = Vector3.Distance(noisePosition, ((Component)term).transform.position) > 5f;
			if (!num)
			{
				LCTweaks.DebugLog("Dog had a noise detection event cancelled!");
			}
			return num;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
		public static void CreateRecolorComp(PlayerControllerB __instance)
		{
			if (LCTweaks.config.HealthOnTerm.Value)
			{
				((Component)((Component)__instance).transform.Find("Misc/MapDot")).gameObject.AddComponent<DotColorController>().player = __instance;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(DeadBodyInfo), "Start")]
		public static void CreateRecolorCompDead(DeadBodyInfo __instance)
		{
			if (LCTweaks.config.HealthOnTerm.Value)
			{
				((Component)((Component)__instance).transform.Find("MapDot")).gameObject.AddComponent<DotColorController>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MaskedPlayerEnemy), "Awake")]
		public static void CreateRecolorCompMasked(DeadBodyInfo __instance)
		{
			if (LCTweaks.config.HealthOnTerm.Value)
			{
				((Component)((Component)__instance).transform.Find("Misc/MapDot")).gameObject.AddComponent<DotColorController>();
			}
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		public static IEnumerable<CodeInstruction> OverrideSprintInput(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Expected O, but got Unknown
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Expected O, but got Unknown
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Expected O, but got Unknown
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Expected O, but got Unknown
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Expected O, but got Unknown
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Expected O, but got Unknown
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Expected O, but got Unknown
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Expected O, but got Unknown
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Expected O, but got Unknown
			if (!LCTweaks.config.ToggleSprint.Value)
			{
				return instructions;
			}
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int num = -1;
			Label label = il.DefineLabel();
			object obj = null;
			for (int i = 0; i < list.Count - 1; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.3f)
				{
					LCTweaks.DebugLog("Found expected structure for toggle sprint transpiler");
					num = i;
					obj = list[i + 1].operand;
					list[i + 2].labels.Add(label);
					break;
				}
			}
			Label label2 = il.DefineLabel();
			Label label3 = il.DefineLabel();
			Label label4 = il.DefineLabel();
			Label label5 = il.DefineLabel();
			list[num + 1].opcode = OpCodes.Bge_Un_S;
			list[num + 1].operand = label2;
			List<CodeInstruction> list2 = new List<CodeInstruction>();
			list2.Add(new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Stsfld, (object)AccessTools.Field(typeof(Patches), "sHeld")));
			list2.Add(new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Stsfld, (object)AccessTools.Field(typeof(Patches), "sNew")));
			list2.Add(new CodeInstruction(OpCodes.Br_S, (object)label4));
			CodeInstruction val = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Patches), "sHeld"));
			val.labels.Add(label2);
			list2.Add(val);
			list2.Add(new CodeInstruction(OpCodes.Brfalse_S, (object)label3));
			list2.Add(new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Stsfld, (object)AccessTools.Field(typeof(Patches), "sNew")));
			list2.Add(new CodeInstruction(OpCodes.Br_S, (object)label4));
			val = new CodeInstruction(OpCodes.Ldc_I4_1, (object)null);
			val.labels.Add(label3);
			list2.Add(val);
			list2.Add(new CodeInstruction(OpCodes.Stsfld, (object)AccessTools.Field(typeof(Patches), "sHeld")));
			list2.Add(new CodeInstruction(OpCodes.Ldc_I4_1, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Stsfld, (object)AccessTools.Field(typeof(Patches), "sNew")));
			val = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
			val.labels.Add(label4);
			list2.Add(val);
			list2.Add(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlayerControllerB), "isSprinting")));
			list2.Add(new CodeInstruction(OpCodes.Brtrue_S, (object)label5));
			list2.Add(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Patches), "sNew")));
			list2.Add(new CodeInstruction(OpCodes.Brtrue_S, (object)label));
			list2.Add(new CodeInstruction(OpCodes.Br_S, obj));
			val = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Patches), "sNew"));
			val.labels.Add(label5);
			list2.Add(val);
			list2.Add(new CodeInstruction(OpCodes.Brtrue_S, obj));
			list2.Add(new CodeInstruction(OpCodes.Br_S, (object)label));
			if (num != -1)
			{
				list.InsertRange(num + 2, list2);
			}
			return list;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		public static IEnumerable<CodeInstruction> OverrideWalkInput(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int num = -1;
			Label label = il.DefineLabel();
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Stfld && (FieldInfo)list[i].operand == AccessTools.Field(typeof(PlayerControllerB), "moveInputVector"))
				{
					LCTweaks.DebugLog("Found expected structure for walk transpiler");
					num = i + 1;
					list[i + 1].labels.Add(label);
					break;
				}
			}
			List<CodeInstruction> list2 = new List<CodeInstruction>();
			list2.Add(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Patches), "autoWalk")));
			list2.Add(new CodeInstruction(OpCodes.Brfalse_S, (object)label));
			list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null));
			list2.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Vector2), "get_up", (Type[])null, (Type[])null)));
			list2.Add(new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(PlayerControllerB), "moveInputVector")));
			if (num != -1)
			{
				list.InsertRange(num, list2);
			}
			return list;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "OnEnable")]
		public static void BindInput(PlayerControllerB __instance)
		{
			InputActionAsset actions = IngamePlayerSettings.Instance.playerInput.actions;
			LCTweaks.DebugLog("Binding controls");
			LCTCustomInputs.instance.AutoWalkButton.performed += LCTCustomInputs.ToggleAutoWalk;
			actions.FindAction("Discard", false).performed += LCTCustomInputs.DiscardPerformed;
			actions.FindAction("Discard", false).canceled += LCTCustomInputs.DiscardCanceled;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "OnDisable")]
		public static void UnbindInput()
		{
			InputActionAsset actions = IngamePlayerSettings.Instance.playerInput.actions;
			LCTCustomInputs.instance.AutoWalkButton.performed -= LCTCustomInputs.ToggleAutoWalk;
			actions.FindAction("Discard", false).performed -= LCTCustomInputs.DiscardPerformed;
			actions.FindAction("Discard", false).canceled -= LCTCustomInputs.DiscardCanceled;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		public static void DetectClientPlayer(PlayerControllerB __instance)
		{
			LCTCustomInputs.clientPlayer = __instance;
			LCTweaks.DebugLog("Found the client player!");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		public static void DiscardAllItems(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)LCTCustomInputs.clientPlayer) && dropAllTime >= 0f && Time.time > dropAllTime)
			{
				((MonoBehaviour)__instance).StartCoroutine(DiscardAtEndOfFrame());
				dropAllTime = -1f;
			}
			IEnumerator DiscardAtEndOfFrame()
			{
				yield return (object)new WaitForEndOfFrame();
				__instance.DropAllHeldItemsAndSync();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
		public static bool CancelItemSwitch()
		{
			return dropAllTime < 0f;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LCTweaks";

		public const string PLUGIN_NAME = "LCTweaks";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}