Decompiled source of Minimap v1.0.0

LethalMinimap.dll

Decompiled 26 minutes ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
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: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 LethalMinimap
{
	public class Minimap : MonoBehaviour
	{
		private Camera _source;

		private Camera _cam;

		private RenderTexture _rt;

		private Canvas _canvas;

		private RectTransform _frame;

		private RawImage _image;

		private float _baseOrthoSize = 19.7f;

		private float _baseFov = 60f;

		private int _mapOnlyLayers;

		private float _refreshTimer;

		private readonly List<Renderer> _teammates = new List<Renderer>();

		private readonly List<Renderer> _scrap = new List<Renderer>();

		private readonly List<Renderer> _enemies = new List<Renderer>();

		private readonly List<Renderer> _hazards = new List<Renderer>();

		private readonly List<Renderer> _hiddenThisFrame = new List<Renderer>();

		private GameObject _contourMap;

		private bool _contourWasActive;

		private Vector3 _contourOldPos;

		private bool _contourChanged;

		private PlayerControllerB _target;

		private static readonly float[] SizeFractions = new float[3] { 0.17f, 0.25f, 0.35f };

		private void OnEnable()
		{
			RenderPipelineManager.beginCameraRendering += OnBeginCamera;
			RenderPipelineManager.endCameraRendering += OnEndCamera;
		}

		private void OnDisable()
		{
			RenderPipelineManager.beginCameraRendering -= OnBeginCamera;
			RenderPipelineManager.endCameraRendering -= OnEndCamera;
		}

		private void HandleKeys()
		{
			if (Plugin.Pressed(Plugin.ToggleKey, (Key)27, (Key)0))
			{
				Plugin.Visible.Value = !Plugin.Visible.Value;
			}
			if (Plugin.Visible.Value)
			{
				if (Plugin.Pressed(Plugin.ZoomInKey, (Key)14, (Key)80))
				{
					Plugin.Zoom.Value = Mathf.Clamp(Mathf.Round(Plugin.Zoom.Value * 1.25f * 100f) / 100f, 0.4f, 3f);
				}
				if (Plugin.Pressed(Plugin.ZoomOutKey, (Key)13, (Key)81))
				{
					Plugin.Zoom.Value = Mathf.Clamp(Mathf.Round(Plugin.Zoom.Value / 1.25f * 100f) / 100f, 0.4f, 3f);
				}
				if (Plugin.Pressed(Plugin.CornerKey, (Key)28, (Key)0))
				{
					Plugin.Position.Value = (Corner)((int)(Plugin.Position.Value + 1) % 4);
				}
				if (Plugin.Pressed(Plugin.SizeKey, (Key)16, (Key)0))
				{
					Plugin.Size.Value = (MapSize)((int)(Plugin.Size.Value + 1) % 3);
				}
			}
		}

		private void LateUpdate()
		{
			PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null);
			StartOfRound instance = StartOfRound.Instance;
			if (!((Object)(object)val != (Object)null) || (!val.isTypingChat && !val.inTerminalMenu))
			{
				HandleKeys();
			}
			_target = null;
			if ((Object)(object)val != (Object)null)
			{
				_target = ((val.isPlayerDead && (Object)(object)val.spectatedPlayerScript != (Object)null) ? val.spectatedPlayerScript : val);
			}
			bool flag = (Object)(object)val != (Object)null && (Object)(object)val.quickMenuManager != (Object)null && val.quickMenuManager.isMenuOpen;
			if (!Plugin.Visible.Value || !((Object)(object)instance != (Object)null) || !((Object)(object)_target != (Object)null) || instance.inShipPhase || flag || ((Object)(object)val != (Object)null && val.inTerminalMenu))
			{
				SetShown(on: false);
				return;
			}
			if (!EnsureCreated(instance))
			{
				SetShown(on: false);
				return;
			}
			SetShown(on: true);
			Layout();
			FollowTarget(instance);
			_refreshTimer -= Time.unscaledDeltaTime;
			if (_refreshTimer <= 0f)
			{
				_refreshTimer = 1f;
				RefreshIconLists(instance);
			}
		}

		private void SetShown(bool on)
		{
			if ((Object)(object)_canvas != (Object)null && ((Behaviour)_canvas).enabled != on)
			{
				((Behaviour)_canvas).enabled = on;
			}
			if ((Object)(object)_cam != (Object)null && ((Behaviour)_cam).enabled != on)
			{
				((Behaviour)_cam).enabled = on;
			}
		}

		private bool EnsureCreated(StartOfRound round)
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			if ((Object)(object)_cam != (Object)null && (Object)(object)_source != (Object)null)
			{
				return true;
			}
			if ((Object)(object)round.mapScreen == (Object)null || (Object)(object)round.mapScreen.mapCamera == (Object)null)
			{
				return false;
			}
			Cleanup();
			_source = round.mapScreen.mapCamera;
			GameObject val = Object.Instantiate<GameObject>(((Component)_source).gameObject);
			((Object)val).name = "LethalMinimapCamera";
			Object.DontDestroyOnLoad((Object)(object)val);
			MonoBehaviour[] componentsInChildren = val.GetComponentsInChildren<MonoBehaviour>(true);
			foreach (MonoBehaviour val2 in componentsInChildren)
			{
				if (!(((object)val2).GetType().Namespace ?? "").StartsWith("UnityEngine"))
				{
					Object.Destroy((Object)(object)val2);
				}
			}
			AudioListener[] componentsInChildren2 = val.GetComponentsInChildren<AudioListener>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				Object.Destroy((Object)(object)componentsInChildren2[i]);
			}
			Camera[] componentsInChildren3 = val.GetComponentsInChildren<Camera>(true);
			foreach (Camera val3 in componentsInChildren3)
			{
				if ((Object)(object)((Component)val3).gameObject != (Object)(object)val)
				{
					Object.Destroy((Object)(object)((Component)val3).gameObject);
				}
			}
			_cam = val.GetComponent<Camera>();
			_rt = new RenderTexture(512, 512, 24)
			{
				name = "LethalMinimapRT"
			};
			_rt.Create();
			_cam.targetTexture = _rt;
			((Behaviour)_cam).enabled = true;
			_baseOrthoSize = (_source.orthographic ? _source.orthographicSize : 19.7f);
			_baseFov = _source.fieldOfView;
			int num = (((Object)(object)local()?.gameplayCamera != (Object)null) ? local().gameplayCamera.cullingMask : 0);
			_mapOnlyLayers = _source.cullingMask & ~num;
			BuildUI();
			Plugin.Log.LogInfo((object)$"Minimap camera created (ortho {_source.orthographic}, size {_baseOrthoSize}, map-only layers {_mapOnlyLayers:X})");
			return true;
			static PlayerControllerB local()
			{
				if (!((Object)(object)GameNetworkManager.Instance != (Object)null))
				{
					return null;
				}
				return GameNetworkManager.Instance.localPlayerController;
			}
		}

		private void BuildUI()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("LethalMinimapCanvas");
			Object.DontDestroyOnLoad((Object)(object)val);
			_canvas = val.AddComponent<Canvas>();
			_canvas.renderMode = (RenderMode)0;
			_canvas.sortingOrder = 5;
			CanvasScaler obj = val.AddComponent<CanvasScaler>();
			obj.uiScaleMode = (ScaleMode)1;
			obj.referenceResolution = new Vector2(1920f, 1080f);
			obj.matchWidthOrHeight = 1f;
			GameObject val2 = new GameObject("Frame", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val2.transform.SetParent(val.transform, false);
			_frame = val2.GetComponent<RectTransform>();
			((Graphic)val2.GetComponent<Image>()).color = new Color(0.05f, 0.22f, 0.09f, 0.9f);
			GameObject val3 = new GameObject("Map", new Type[2]
			{
				typeof(RectTransform),
				typeof(RawImage)
			});
			val3.transform.SetParent(val2.transform, false);
			RectTransform component = val3.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = new Vector2(4f, 4f);
			component.offsetMax = new Vector2(-4f, -4f);
			_image = val3.GetComponent<RawImage>();
			_image.texture = (Texture)(object)_rt;
		}

		private void Layout()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			float num = 1080f * SizeFractions[(int)Plugin.Size.Value];
			float value = Plugin.Margin.Value;
			_frame.sizeDelta = new Vector2(num, num);
			Vector2 val = default(Vector2);
			Vector2 anchoredPosition = default(Vector2);
			switch (Plugin.Position.Value)
			{
			case Corner.TopLeft:
				((Vector2)(ref val))..ctor(0f, 1f);
				((Vector2)(ref anchoredPosition))..ctor(value, 0f - value);
				break;
			case Corner.BottomLeft:
				((Vector2)(ref val))..ctor(0f, 0f);
				((Vector2)(ref anchoredPosition))..ctor(value, value);
				break;
			case Corner.BottomRight:
				((Vector2)(ref val))..ctor(1f, 0f);
				((Vector2)(ref anchoredPosition))..ctor(0f - value, value);
				break;
			default:
				((Vector2)(ref val))..ctor(1f, 1f);
				((Vector2)(ref anchoredPosition))..ctor(0f - value, 0f - value);
				break;
			}
			_frame.anchorMin = val;
			_frame.anchorMax = val;
			_frame.pivot = val;
			_frame.anchoredPosition = anchoredPosition;
		}

		private void FollowTarget(StartOfRound round)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			ManualCameraRenderer mapScreen = round.mapScreen;
			Vector3 val = ((Component)_target).transform.position;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val + Vector3.up * 0.1f, Vector3.down, ref val2, 5f, round.collidersAndRoomMask, (QueryTriggerInteraction)1))
			{
				val = ((RaycastHit)(ref val2)).point + Vector3.up * 0.06f;
			}
			if (_target.isInHangarShipRoom)
			{
				_cam.nearClipPlane = -0.96f;
				_cam.farClipPlane = 7.52f;
			}
			else if (!_target.isInsideFactory)
			{
				_cam.nearClipPlane = mapScreen.cameraNearPlane - 18f;
				_cam.farClipPlane = mapScreen.cameraFarPlane + 18f;
			}
			else
			{
				_cam.nearClipPlane = mapScreen.cameraNearPlane;
				_cam.farClipPlane = mapScreen.cameraFarPlane;
			}
			((Component)_cam).transform.position = new Vector3(val.x, val.y + 3.636f, val.z);
			float num = (Plugin.RotateWithView.Value ? ((Component)_target).transform.eulerAngles.y : ((Component)_source).transform.eulerAngles.y);
			((Component)_cam).transform.rotation = Quaternion.Euler(90f, num, 0f);
			float num2 = Mathf.Clamp(Plugin.Zoom.Value, 0.4f, 3f);
			if (_cam.orthographic)
			{
				_cam.orthographicSize = _baseOrthoSize / num2;
			}
			else
			{
				_cam.fieldOfView = Mathf.Clamp(_baseFov / num2, 5f, 120f);
			}
			if ((Object)(object)_contourMap == (Object)null)
			{
				_contourMap = GameObject.FindGameObjectWithTag("TerrainContourMap");
			}
		}

		private void RefreshIconLists(StartOfRound round)
		{
			_teammates.Clear();
			_scrap.Clear();
			_enemies.Clear();
			_hazards.Clear();
			PlayerControllerB[] allPlayerScripts = round.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)_target))
				{
					if ((Object)(object)val.mapRadarDirectionIndicator != (Object)null)
					{
						_teammates.Add((Renderer)(object)val.mapRadarDirectionIndicator);
					}
					if ((Object)(object)val.mapRadarDotAnimator != (Object)null)
					{
						_teammates.AddRange(((Component)val.mapRadarDotAnimator).GetComponentsInChildren<Renderer>(true));
					}
					if ((Object)(object)val.deadBody != (Object)null && (Object)(object)val.deadBody.radarDot != (Object)null)
					{
						_teammates.AddRange(((Component)val.deadBody.radarDot).GetComponentsInChildren<Renderer>(true));
					}
				}
			}
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			foreach (GrabbableObject val2 in array)
			{
				if ((Object)(object)val2 != (Object)null && (Object)(object)val2.radarIcon != (Object)null)
				{
					_scrap.AddRange(((Component)val2.radarIcon).GetComponentsInChildren<Renderer>(true));
				}
			}
			if ((Object)(object)RoundManager.Instance != (Object)null)
			{
				foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
				{
					if ((Object)(object)spawnedEnemy != (Object)null)
					{
						AddMapOnly(((Component)spawnedEnemy).transform, _enemies);
					}
				}
			}
			Turret[] array2 = Object.FindObjectsOfType<Turret>();
			foreach (Turret val3 in array2)
			{
				AddMapOnly(((Component)val3).transform.root, _hazards);
			}
			Landmine[] array3 = Object.FindObjectsOfType<Landmine>();
			foreach (Landmine val4 in array3)
			{
				AddMapOnly(((Component)val4).transform.root, _hazards);
			}
			SpikeRoofTrap[] array4 = Object.FindObjectsOfType<SpikeRoofTrap>();
			foreach (SpikeRoofTrap val5 in array4)
			{
				AddMapOnly(((Component)val5).transform.root, _hazards);
			}
			EntranceTeleport[] array5 = Object.FindObjectsOfType<EntranceTeleport>();
			foreach (EntranceTeleport val6 in array5)
			{
				AddMapOnly(((Component)val6).transform, _hazards);
			}
			TerminalAccessibleObject[] array6 = Object.FindObjectsOfType<TerminalAccessibleObject>();
			foreach (TerminalAccessibleObject val7 in array6)
			{
				if ((Object)(object)val7.mapRadarObject != (Object)null)
				{
					_hazards.AddRange(val7.mapRadarObject.GetComponentsInChildren<Renderer>(true));
				}
			}
		}

		private void AddMapOnly(Transform root, List<Renderer> into)
		{
			Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && ((1 << ((Component)val).gameObject.layer) & _mapOnlyLayers) != 0)
				{
					into.Add(val);
				}
			}
		}

		private void OnBeginCamera(ScriptableRenderContext ctx, Camera camera)
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)camera != (Object)(object)_cam || (Object)(object)_cam == (Object)null)
			{
				return;
			}
			_hiddenThisFrame.Clear();
			if (!Plugin.ShowTeammates.Value)
			{
				Hide(_teammates);
			}
			if (!Plugin.ShowScrap.Value)
			{
				Hide(_scrap);
			}
			if (!Plugin.ShowEnemies.Value)
			{
				Hide(_enemies);
			}
			if (!Plugin.ShowDoorsExitsTraps.Value)
			{
				Hide(_hazards);
			}
			_contourChanged = false;
			if (!((Object)(object)_contourMap != (Object)null) || !((Object)(object)_target != (Object)null))
			{
				return;
			}
			bool num = !_target.isInsideFactory;
			_contourWasActive = _contourMap.activeSelf;
			_contourOldPos = _contourMap.transform.position;
			if (num)
			{
				_contourMap.transform.position = new Vector3(_contourOldPos.x, ((Component)_target).transform.position.y - 1.5f, _contourOldPos.z);
				if (!_contourWasActive)
				{
					_contourMap.SetActive(true);
				}
				_contourChanged = true;
			}
			else if (_contourWasActive)
			{
				_contourMap.SetActive(false);
				_contourChanged = true;
			}
		}

		private void OnEndCamera(ScriptableRenderContext ctx, Camera camera)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)camera != (Object)(object)_cam)
			{
				return;
			}
			foreach (Renderer item in _hiddenThisFrame)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.forceRenderingOff = false;
				}
			}
			_hiddenThisFrame.Clear();
			if (_contourChanged && (Object)(object)_contourMap != (Object)null)
			{
				_contourMap.transform.position = _contourOldPos;
				if (_contourMap.activeSelf != _contourWasActive)
				{
					_contourMap.SetActive(_contourWasActive);
				}
			}
		}

		private void Hide(List<Renderer> list)
		{
			foreach (Renderer item in list)
			{
				if (!((Object)(object)item == (Object)null) && !item.forceRenderingOff)
				{
					item.forceRenderingOff = true;
					_hiddenThisFrame.Add(item);
				}
			}
		}

		private void Cleanup()
		{
			if ((Object)(object)_cam != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_cam).gameObject);
			}
			if ((Object)(object)_canvas != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_canvas).gameObject);
			}
			if ((Object)(object)_rt != (Object)null)
			{
				_rt.Release();
				Object.Destroy((Object)(object)_rt);
			}
			_cam = null;
			_canvas = null;
			_rt = null;
			_source = null;
		}
	}
	public enum Corner
	{
		TopRight,
		BottomRight,
		BottomLeft,
		TopLeft
	}
	public enum MapSize
	{
		Small,
		Medium,
		Large
	}
	[BepInPlugin("SoulMods.Minimap", "Lethal Minimap", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "SoulMods.Minimap";

		public const string Name = "Lethal Minimap";

		public const string Version = "1.0.0";

		public static ManualLogSource Log;

		public static ConfigEntry<bool> Visible;

		public static ConfigEntry<Corner> Position;

		public static ConfigEntry<MapSize> Size;

		public static ConfigEntry<float> Zoom;

		public static ConfigEntry<float> Margin;

		public static ConfigEntry<bool> RotateWithView;

		public static ConfigEntry<bool> ShowTeammates;

		public static ConfigEntry<bool> ShowScrap;

		public static ConfigEntry<bool> ShowEnemies;

		public static ConfigEntry<bool> ShowDoorsExitsTraps;

		public static ConfigEntry<string> ToggleKey;

		public static ConfigEntry<string> ZoomInKey;

		public static ConfigEntry<string> ZoomOutKey;

		public static ConfigEntry<string> CornerKey;

		public static ConfigEntry<string> SizeKey;

		private static readonly Dictionary<string, Key> KeyCache = new Dictionary<string, Key>();

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Visible = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "Visible", true, "Whether the minimap is shown (the toggle key flips this).");
			Position = ((BaseUnityPlugin)this).Config.Bind<Corner>("Layout", "Corner", Corner.TopRight, "Which corner: TopRight, BottomRight, BottomLeft, TopLeft.");
			Size = ((BaseUnityPlugin)this).Config.Bind<MapSize>("Layout", "Size", MapSize.Medium, "Small, Medium or Large.");
			Zoom = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Zoom", 1f, "1 = same area as the ship monitor. Higher = zoomed in. (0.4 - 3)");
			Margin = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Margin", 16f, "Gap from the screen edges, in pixels (at 1080p).");
			RotateWithView = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "RotateWithView", true, "True: the map turns with you, so up is always where you're facing. False: fixed, like the ship monitor.");
			ShowTeammates = ((BaseUnityPlugin)this).Config.Bind<bool>("Show", "Teammates", true, "Other players (and their bodies).");
			ShowScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Show", "Scrap", true, "Scrap and keys lying around.");
			ShowEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Show", "Enemies", true, "Monsters.");
			ShowDoorsExitsTraps = ((BaseUnityPlugin)this).Config.Bind<bool>("Show", "DoorsExitsTraps", true, "Turrets, mines, spike traps, secure doors and entrances.");
			ToggleKey = ((BaseUnityPlugin)this).Config.Bind<string>("Keys", "Toggle", "M", "Show / hide the minimap. Unity Input System key names (M, F6, Backquote...).");
			ZoomInKey = ((BaseUnityPlugin)this).Config.Bind<string>("Keys", "ZoomIn", "Equals", "Zoom in (the +/= key). Numpad plus also works.");
			ZoomOutKey = ((BaseUnityPlugin)this).Config.Bind<string>("Keys", "ZoomOut", "Minus", "Zoom out. Numpad minus also works.");
			CornerKey = ((BaseUnityPlugin)this).Config.Bind<string>("Keys", "CycleCorner", "N", "Move it to the next corner.");
			SizeKey = ((BaseUnityPlugin)this).Config.Bind<string>("Keys", "CycleSize", "B", "Next size: Small, Medium, Large.");
			((Component)this).gameObject.AddComponent<Minimap>();
			Log.LogInfo((object)"Lethal Minimap 1.0.0 loaded");
		}

		public static bool Pressed(ConfigEntry<string> entry, Key fallback, Key alt = (Key)0)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			Keyboard current = Keyboard.current;
			if (current == null)
			{
				return false;
			}
			if (!KeyCache.TryGetValue(entry.Value, out var value))
			{
				if (!Enum.TryParse<Key>(entry.Value, ignoreCase: true, out value))
				{
					Log.LogWarning((object)$"Unknown key '{entry.Value}' for {((ConfigEntryBase)entry).Definition.Key}; using {fallback}");
					value = fallback;
				}
				KeyCache[entry.Value] = value;
			}
			if ((int)value == 0 || !((ButtonControl)current[value]).wasPressedThisFrame)
			{
				if ((int)alt != 0)
				{
					return ((ButtonControl)current[alt]).wasPressedThisFrame;
				}
				return false;
			}
			return true;
		}
	}
}