Decompiled source of Wider Scan v1.0.0

LCMODRadialScan.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LCMODRadialScan.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LCMODRadialScan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCMODRadialScan")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4a848c62-0e58-45ff-b811-371764e8aa92")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LCMODConstantScan
{
	[BepInPlugin("UnscriptedLogic.RadialScanMod", "Radial Scan Mod", "1.0.0.0")]
	public class RadialScanModBase : BaseUnityPlugin
	{
		private const string modGUID = "UnscriptedLogic.RadialScanMod";

		private const string modName = "Radial Scan Mod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("UnscriptedLogic.RadialScanMod");

		public static RadialScanModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("UnscriptedLogic.RadialScanMod");
			mls.LogInfo((object)"Patching Radial Scan Mod...");
			harmony.PatchAll(typeof(RadialScanModBase));
			harmony.PatchAll(typeof(RadialScanMod));
			mls.LogInfo((object)"Radial Mod Patch Complete!");
		}
	}
}
namespace LCMODRadialScan.Patches
{
	internal class RadialScanMod
	{
		[HarmonyPatch(typeof(HUDManager), "AssignNewNodes")]
		[HarmonyPrefix]
		private static bool AssignNewNodesOverride(HUDManager __instance, PlayerControllerB playerScript, ref RectTransform[] ___scanElements, ref List<ScanNodeProperties> ___nodesOnScreen, ref int ___scannedScrapNum, ref RaycastHit[] ___scanNodesHit)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			int num = Physics.SphereCastNonAlloc(new Ray(((Component)playerScript.gameplayCamera).transform.position + ((Component)playerScript.gameplayCamera).transform.forward, ((Component)playerScript.gameplayCamera).transform.forward), 100f, ___scanNodesHit, 1000f, 4194304);
			if (num > ___scanElements.Length)
			{
				num = ___scanElements.Length;
			}
			___nodesOnScreen.Clear();
			___scannedScrapNum = 0;
			MethodInfo methodInfo = AccessTools.Method(typeof(HUDManager), "AttemptScanNode", (Type[])null, (Type[])null);
			if (num > ___scanElements.Length)
			{
				for (int i = 0; i < num; i++)
				{
					ScanNodeProperties component = ((Component)((RaycastHit)(ref ___scanNodesHit[i])).transform).gameObject.GetComponent<ScanNodeProperties>();
					if (component.nodeType == 1 || component.nodeType == 2)
					{
						methodInfo?.Invoke(__instance, new object[3] { component, i, playerScript });
					}
				}
			}
			if (___nodesOnScreen.Count < ___scanElements.Length)
			{
				for (int j = 0; j < num; j++)
				{
					ScanNodeProperties component2 = ((Component)((RaycastHit)(ref ___scanNodesHit[j])).transform).gameObject.GetComponent<ScanNodeProperties>();
					methodInfo?.Invoke(__instance, new object[3] { component2, j, playerScript });
				}
			}
			return false;
		}
	}
}