Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Toggle Scan v1.0.0
LCMODConstantScan.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LCMODConstantScan.Patches; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LCMODConstantScan")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCMODConstantScan")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("89acc5e4-1df0-43be-ab70-a24ae9f14b22")] [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.ConstantScanMpd", "Constant Scan Mod", "1.0.0.0")] public class ConstantScanModBase : BaseUnityPlugin { private const string modGUID = "UnscriptedLogic.ConstantScanMpd"; private const string modName = "Constant Scan Mod"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("UnscriptedLogic.ConstantScanMpd"); public static ConstantScanModBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("UnscriptedLogic.ConstantScanMpd"); mls.LogInfo((object)"Patching Constant Scan Mod..."); harmony.PatchAll(typeof(ConstantScanModBase)); harmony.PatchAll(typeof(ConstantScanPatch)); mls.LogInfo((object)"Constant Scan Mod Patch Complete"); } } } namespace LCMODConstantScan.Patches { internal class ConstantScanPatch { private static CallbackContext pingContext; private static bool toggleScanning; [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] private static void UpdatePatch(HUDManager __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false).IsPressed()) { toggleScanning = !toggleScanning; } if (toggleScanning) { AccessTools.Method(typeof(HUDManager), "PingScan_performed", (Type[])null, (Type[])null)?.Invoke(__instance, new object[1] { pingContext }); } } [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] [HarmonyPrefix] private static void OnScanPrefix(HUDManager __instance, CallbackContext context) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) pingContext = context; } [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] [HarmonyPostfix] private static void OnScanPostFix(HUDManager __instance, CallbackContext context, ref float ___playerPingingScan) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { MethodInfo methodInfo = AccessTools.Method(typeof(HUDManager), "CanPlayerScan", (Type[])null, (Type[])null); if (toggleScanning && (bool)methodInfo?.Invoke(__instance, new object[0]) && ___playerPingingScan <= -1f) { ___playerPingingScan = 0.3f; } } } } }