Decompiled source of OmniseekerPlus v1.0.7

OmniseekerPlus.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("OmniseekerPlus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OmniseekerPlus")]
[assembly: AssemblyTitle("OmniseekerPlus")]
[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 OmniseekerPlus
{
	[BepInPlugin("com.certifired.OmniseekerPlus", "OmniseekerPlus", "1.0.7")]
	public class OmniseekerPlusPlugin : BaseUnityPlugin
	{
		public struct ScannableInfo
		{
			public Vector3 position;

			public string name;

			public float distance;

			public string type;

			public GameObject gameObject;
		}

		private const string MyGUID = "com.certifired.OmniseekerPlus";

		private const string PluginName = "OmniseekerPlus";

		private const string VersionString = "1.0.7";

		private static readonly Harmony Harmony = new Harmony("com.certifired.OmniseekerPlus");

		public static ManualLogSource Log;

		public static ConfigEntry<float> ScannerRangeMultiplier;

		public static ConfigEntry<float> MaxScanRange;

		public static ConfigEntry<bool> ExtendedRangeEnabled;

		public static ConfigEntry<bool> ScanHardDrives;

		public static ConfigEntry<bool> ScanHiddenChests;

		public static ConfigEntry<bool> ScanRareOres;

		public static ConfigEntry<bool> ScanAllOreTypes;

		public static ConfigEntry<bool> ScanLootContainers;

		public static ConfigEntry<bool> ScanMemoryTrees;

		public static ConfigEntry<bool> ShowDistanceOnHUD;

		public static ConfigEntry<bool> ColorCodeByDistance;

		public static ConfigEntry<bool> ShowScanPulseEffect;

		public static ConfigEntry<float> PulseIntensity;

		public static ConfigEntry<KeyCode> CycleModeKey;

		public static ConfigEntry<KeyCode> QuickScanKey;

		public static int currentScanMode = 0;

		public static string[] scanModeNames = new string[6] { "All", "Ores Only", "Hard Drives", "Loot", "Memory Trees", "Custom" };

		private static bool showGui = false;

		private static Rect windowRect = new Rect((float)(Screen.width - 320), 100f, 300f, 400f);

		private static Vector2 scrollPos = Vector2.zero;

		public static List<ScannableInfo> lastScanResults = new List<ScannableInfo>();

		private static float lastScanTime = 0f;

		private void Awake()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"PluginName: OmniseekerPlus, VersionString: 1.0.7 is loading...");
			ScannerRangeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Scanner Range", "Range Multiplier", 3f, new ConfigDescription("Multiplier for scanner range (default 3x)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
			MaxScanRange = ((BaseUnityPlugin)this).Config.Bind<float>("Scanner Range", "Max Scan Range", 500f, new ConfigDescription("Maximum scan range in meters", (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 2000f), Array.Empty<object>()));
			ExtendedRangeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Scanner Range", "Extended Range Enabled", true, "Enable extended scanner range");
			ScanHardDrives = ((BaseUnityPlugin)this).Config.Bind<bool>("Scannable Types", "Scan Hard Drives", true, "Enable scanning for Hard Drives (data storage devices)");
			ScanHiddenChests = ((BaseUnityPlugin)this).Config.Bind<bool>("Scannable Types", "Scan Hidden Chests", true, "Enable scanning for hidden/buried chests");
			ScanRareOres = ((BaseUnityPlugin)this).Config.Bind<bool>("Scannable Types", "Scan Rare Ores", true, "Enable scanning for rare ore types (Atlantum, etc)");
			ScanAllOreTypes = ((BaseUnityPlugin)this).Config.Bind<bool>("Scannable Types", "Scan All Ore Types", true, "Enable scanning for all ore vein types");
			ScanLootContainers = ((BaseUnityPlugin)this).Config.Bind<bool>("Scannable Types", "Scan Loot Containers", true, "Enable scanning for loot containers and crates");
			ScanMemoryTrees = ((BaseUnityPlugin)this).Config.Bind<bool>("Scannable Types", "Scan Memory Trees", true, "Enable scanning for Memory Trees (research core producers)");
			ShowDistanceOnHUD = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "Show Distance on HUD", true, "Display distance to scanned objects on the HUD");
			ColorCodeByDistance = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "Color Code by Distance", true, "Color-code scan results based on distance (green=close, yellow=medium, red=far)");
			ShowScanPulseEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "Show Scan Pulse Effect", true, "Display a visual pulse effect when scanning");
			PulseIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "Pulse Intensity", 1.5f, new ConfigDescription("Intensity of the scan pulse effect", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), Array.Empty<object>()));
			CycleModeKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "Cycle Mode Key", (KeyCode)111, "Key to cycle through scan modes");
			QuickScanKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "Quick Scan Key", (KeyCode)112, "Key to perform a quick area scan");
			Harmony.PatchAll();
			Log.LogInfo((object)"PluginName: OmniseekerPlus, VersionString: 1.0.7 is loaded.");
			Log.LogInfo((object)$"Press {CycleModeKey.Value} to cycle scan modes, {QuickScanKey.Value} for quick scan");
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(CycleModeKey.Value) && !Input.GetKey((KeyCode)304))
			{
				currentScanMode = (currentScanMode + 1) % scanModeNames.Length;
				Log.LogInfo((object)("Scan mode: " + scanModeNames[currentScanMode]));
			}
			if (Input.GetKeyDown(QuickScanKey.Value))
			{
				PerformQuickScan();
			}
			if (Input.GetKey((KeyCode)304) && Input.GetKeyDown(CycleModeKey.Value))
			{
				showGui = !showGui;
			}
		}

		private void OnGUI()
		{
			//IL_0014: 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)
			//IL_0034: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (showGui)
			{
				windowRect = GUILayout.Window(54321, windowRect, new WindowFunction(DrawWindow), "OmniseekerPlus", Array.Empty<GUILayoutOption>());
			}
		}

		private void DrawWindow(int id)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Current Mode: " + scanModeNames[currentScanMode], new GUIStyle(GUI.skin.label)
			{
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			for (int i = 0; i < 2; i++)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				for (int j = 0; j < 3; j++)
				{
					int num = i * 3 + j;
					if (num < scanModeNames.Length)
					{
						GUI.color = ((currentScanMode == num) ? Color.cyan : Color.white);
						if (GUILayout.Button(scanModeNames[num], (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
						{
							currentScanMode = num;
						}
					}
				}
				GUILayout.EndHorizontal();
			}
			GUI.color = Color.white;
			GUILayout.Space(10f);
			if (GUILayout.Button("Perform Quick Scan", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
			{
				PerformQuickScan();
			}
			GUILayout.Space(10f);
			GUILayout.Label($"Last Scan Results ({lastScanResults.Count} found):", Array.Empty<GUILayoutOption>());
			scrollPos = GUILayout.BeginScrollView(scrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(200f) });
			foreach (ScannableInfo item in lastScanResults.OrderBy((ScannableInfo r) => r.distance))
			{
				Color distanceColor = GetDistanceColor(item.distance);
				GUI.color = distanceColor;
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(item.name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
				GUILayout.Label($"{item.distance:F1}m", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
				GUILayout.Label(item.type, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
				GUILayout.EndHorizontal();
			}
			GUI.color = Color.white;
			GUILayout.EndScrollView();
			GUILayout.Space(10f);
			ExtendedRangeEnabled.Value = GUILayout.Toggle(ExtendedRangeEnabled.Value, " Extended Range", Array.Empty<GUILayoutOption>());
			ShowDistanceOnHUD.Value = GUILayout.Toggle(ShowDistanceOnHUD.Value, " Show Distance on HUD", Array.Empty<GUILayoutOption>());
			ColorCodeByDistance.Value = GUILayout.Toggle(ColorCodeByDistance.Value, " Color Code Results", Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.Label($"Range: {MaxScanRange.Value:F0}m (x{ScannerRangeMultiplier.Value:F1})", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.Label($"[{CycleModeKey.Value}] Cycle Mode | [{QuickScanKey.Value}] Quick Scan", Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Close", Array.Empty<GUILayoutOption>()))
			{
				showGui = false;
			}
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f));
		}

		private Color GetDistanceColor(float distance)
		{
			//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_0026: 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)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_006c: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			if (!ColorCodeByDistance.Value)
			{
				return Color.white;
			}
			if (distance < 50f)
			{
				return Color.green;
			}
			if (distance < 150f)
			{
				return Color.yellow;
			}
			if (distance < 300f)
			{
				return new Color(1f, 0.5f, 0f);
			}
			return Color.red;
		}

		public void PerformQuickScan()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Player.instance == (Object)null)
			{
				return;
			}
			lastScanResults.Clear();
			lastScanTime = Time.time;
			Vector3 position = ((Component)Player.instance).transform.position;
			float num = (ExtendedRangeEnabled.Value ? MaxScanRange.Value : 100f);
			Log.LogInfo((object)$"Performing quick scan at range {num}m in mode: {scanModeNames[currentScanMode]}...");
			switch (currentScanMode)
			{
			case 0:
				ScanForOres(position, num);
				ScanForChests(position, num);
				ScanForMachines(position, num);
				break;
			case 1:
				ScanForOres(position, num);
				break;
			case 2:
				ScanForDataObjects(position, num);
				break;
			case 3:
				ScanForChests(position, num);
				break;
			case 4:
				ScanForMachineType(position, num, "MemoryTree");
				break;
			case 5:
				if (ScanAllOreTypes.Value || ScanRareOres.Value)
				{
					ScanForOres(position, num);
				}
				if (ScanLootContainers.Value || ScanHiddenChests.Value)
				{
					ScanForChests(position, num);
				}
				if (ScanHardDrives.Value)
				{
					ScanForDataObjects(position, num);
				}
				if (ScanMemoryTrees.Value)
				{
					ScanForMachineType(position, num, "MemoryTree");
				}
				break;
			}
			Log.LogInfo((object)$"Quick scan complete: {lastScanResults.Count} objects found");
			if (ShowScanPulseEffect.Value)
			{
				CreateScanPulseEffect(position, num);
			}
		}

		private void ScanForOres(Vector3 center, float range)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				IEnumerable<GameObject> enumerable = from go in Object.FindObjectsOfType<GameObject>()
					where ((Object)go).name.ToLower().Contains("ore") || ((Object)go).name.ToLower().Contains("vein")
					where go.activeInHierarchy
					select go;
				foreach (GameObject item in enumerable)
				{
					float num = Vector3.Distance(center, item.transform.position);
					if (!(num > range))
					{
						string text = IdentifyOreType(((Object)item).name);
						if (currentScanMode != 5 || ((!(text == "Atlantum") || ScanRareOres.Value) && (!(text != "Atlantum") || ScanAllOreTypes.Value)))
						{
							lastScanResults.Add(new ScannableInfo
							{
								position = item.transform.position,
								name = text + " Ore",
								distance = num,
								type = "Ore",
								gameObject = item
							});
						}
					}
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Error scanning for ores: " + ex.Message));
			}
		}

		private string IdentifyOreType(string name)
		{
			string text = name.ToLower();
			if (text.Contains("atlantum"))
			{
				return "Atlantum";
			}
			if (text.Contains("copper"))
			{
				return "Copper";
			}
			if (text.Contains("iron"))
			{
				return "Iron";
			}
			if (text.Contains("limestone"))
			{
				return "Limestone";
			}
			if (text.Contains("gold"))
			{
				return "Gold";
			}
			if (text.Contains("coal"))
			{
				return "Coal";
			}
			return "Unknown";
		}

		private void ScanForChests(Vector3 center, float range)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			if (MachineManager.instance == null)
			{
				return;
			}
			try
			{
				MachineInstanceList<ChestInstance, ChestDefinition> machineList = MachineManager.instance.GetMachineList<ChestInstance, ChestDefinition>((MachineTypeEnum)3);
				if (machineList == null || machineList.myArray == null)
				{
					return;
				}
				ChestInstance[] myArray = machineList.myArray;
				for (int i = 0; i < myArray.Length; i++)
				{
					ChestInstance val = myArray[i];
					if (val.commonInfo.instanceId == 0)
					{
						continue;
					}
					GridInfo gridInfo = val.gridInfo;
					Vector3 center2 = ((GridInfo)(ref gridInfo)).Center;
					float num = Vector3.Distance(center, center2);
					if (num > range)
					{
						continue;
					}
					Inventory inventory = ((ChestInstance)(ref val)).GetInventory();
					bool flag = false;
					int num2 = 0;
					if (inventory.myStacks != null)
					{
						ResourceStack[] myStacks = inventory.myStacks;
						for (int j = 0; j < myStacks.Length; j++)
						{
							ResourceStack val2 = myStacks[j];
							if (!((ResourceStack)(ref val2)).isEmpty)
							{
								flag = true;
								num2 += val2.count;
							}
						}
					}
					string name = (flag ? $"Chest ({num2} items)" : "Empty Chest");
					lastScanResults.Add(new ScannableInfo
					{
						position = center2,
						name = name,
						distance = num,
						type = "Container",
						gameObject = val.commonInfo.refGameObj
					});
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Error scanning for chests: " + ex.Message));
			}
		}

		private void ScanForDataObjects(Vector3 center, float range)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				IEnumerable<GameObject> enumerable = from go in Object.FindObjectsOfType<GameObject>().Where(delegate(GameObject go)
					{
						string text = ((Object)go).name.ToLower();
						return text.Contains("harddrive") || text.Contains("hard_drive") || text.Contains("datastorage") || text.Contains("data_storage") || text.Contains("memory") || text.Contains("disk") || text.Contains("cache");
					})
					where go.activeInHierarchy
					select go;
				foreach (GameObject item in enumerable)
				{
					float num = Vector3.Distance(center, item.transform.position);
					if (!(num > range))
					{
						lastScanResults.Add(new ScannableInfo
						{
							position = item.transform.position,
							name = "Data Storage",
							distance = num,
							type = "HardDrive",
							gameObject = item
						});
					}
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Error scanning for data objects: " + ex.Message));
			}
		}

		private void ScanForMachines(Vector3 center, float range)
		{
			//IL_0010: 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)
			if (MachineManager.instance != null)
			{
				ScanForMachineType(center, range, "Generator");
				ScanForMachineType(center, range, "MemoryTree");
			}
		}

		private void ScanForMachineType(Vector3 center, float range, string machineTypeName)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				IEnumerable<GameObject> enumerable = from go in Object.FindObjectsOfType<GameObject>()
					where ((Object)go).name.ToLower().Contains(machineTypeName.ToLower())
					where go.activeInHierarchy
					select go;
				foreach (GameObject machine in enumerable)
				{
					float num = Vector3.Distance(center, machine.transform.position);
					if (!(num > range) && !lastScanResults.Any((ScannableInfo r) => (Object)(object)r.gameObject == (Object)(object)machine))
					{
						lastScanResults.Add(new ScannableInfo
						{
							position = machine.transform.position,
							name = machineTypeName,
							distance = num,
							type = "Machine",
							gameObject = machine
						});
					}
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Error scanning for " + machineTypeName + ": " + ex.Message));
			}
		}

		private void CreateScanPulseEffect(Vector3 center, float range)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Log.LogInfo((object)$"Scan pulse at {center} with range {range}m");
		}
	}
}