Decompiled source of DisableLethalThingsDartScanNodes v0.0.1

DisableLethalThingsDartScanNodes.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LethalThings.MonoBehaviours;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 DisableLethalThingsDartScanNodes
{
	[HarmonyPatch(typeof(Dart))]
	internal static class PatchDart
	{
		private static IEnumerable<CodeInstruction> DartAssignNewNodesTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				yield return instruction;
				if (instruction.opcode == OpCodes.Callvirt)
				{
					break;
				}
			}
			yield return new CodeInstruction(OpCodes.Ret, (object)null);
		}

		[HarmonyTranspiler]
		[HarmonyPatch("HUDManager_AssignNewNodes")]
		private static IEnumerable<CodeInstruction> DartAssignNewNodesTranspiler2(IEnumerable<CodeInstruction> instructions)
		{
			IEnumerable<CodeInstruction> enumerable = DartAssignNewNodesTranspiler(instructions);
			foreach (CodeInstruction item in enumerable)
			{
				Debug.Log((object)item);
				yield return item;
			}
		}
	}
	[BepInPlugin("Zaggy1024.DisableLethalThingsDartScanNodes", "DisableLethalThingsDartScanNodes", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string MOD_NAME = "DisableLethalThingsDartScanNodes";

		public const string MOD_UNIQUE_NAME = "Zaggy1024.DisableLethalThingsDartScanNodes";

		public const string MOD_VERSION = "0.0.1";

		private readonly Harmony harmony = new Harmony("Zaggy1024.DisableLethalThingsDartScanNodes");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"DisableLethalThingsDartScanNodes starting up:");
			harmony.PatchAll(typeof(PatchDart));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched LethalThings to stop checking for darts to add them to the HUD.");
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}