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 NoScanner v1.0.1
No-Scanner.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("No-Scanner")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+20a07d014c01ad6c8426f8caf77b8da46ec4e76e")] [assembly: AssemblyProduct("No-Scanner")] [assembly: AssemblyTitle("No-Scanner")] [assembly: AssemblyVersion("1.0.0.0")] [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 Dawn.LC.NoScanner { public static class PluginInfo { public const string PLUGIN_GUID = "No-Scanner"; public const string PLUGIN_NAME = "No-Scanner"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace NoScanner { [BepInPlugin("No-Scanner", "No-Scanner", "1.0.0")] internal sealed class Plugin : BaseUnityPlugin { public static ConfigEntry<bool> DisableOnlyInShip; public static ManualLogSource ModLogger { get; private set; } private void Awake() { ModLogger = ((BaseUnityPlugin)this).Logger; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); DisableOnlyInShip = ((BaseUnityPlugin)this).Config.Bind<bool>("NoScanner", "DisableOnlyInShip", false, "Disables the use of the Scanner in the ship, everywhere else it's allowed"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Checking in ;)"); } } } namespace NoScanner.Harmony { [HarmonyPatch(typeof(HUDManager), "CanPlayerScan")] internal static class PreventPlayerFromScanning_Patch { private static bool _loggedErrorOnce; private static bool _isInShip => GameNetworkManager.Instance.localPlayerController.isInElevator; [UsedImplicitly] [HarmonyPrefix] private static bool OnCanPlayerScan(ref bool __result) { try { if (Plugin.DisableOnlyInShip.Value) { return !_isInShip; } return __result = false; } catch (Exception ex) { if (_loggedErrorOnce) { return true; } Plugin.ModLogger.LogError((object)ex); _loggedErrorOnce = true; return true; } } } }