Decompiled source of BiteableGrenadePins v1.0.0

BiteableGrenadePins.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BiteableGrenadePins;
using HBMF.GameResources;
using HBMF.ModMenu;
using Il2Cpp;
using MelonLoader;
using MelonLoader.Preferences;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Mod), "BiteableGrenadePins", "1.0.0", "korbykob", null)]
[assembly: MelonGame("GexagonVR", "Hard Bullet")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BiteableGrenadePins")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BiteableGrenadePins")]
[assembly: AssemblyTitle("BiteableGrenadePins")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BiteableGrenadePins;

public class Mod : MelonMod
{
	internal static MelonPreferences_Entry<bool> enabled;

	public override void OnInitializeMelon()
	{
		enabled = MelonPreferences.CreateCategory("BiteableGrenadePins").CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		Menu.CreateCategory("BITEABLE GRENADE PINS").CreateBool("ENABLE", enabled.Value, (Action<bool>)delegate(bool value)
		{
			enabled.Value = value;
		});
		GameResources.ResourcesReady = (Action)Delegate.Combine(GameResources.ResourcesReady, (Action)delegate
		{
			//IL_0001: 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_0046: 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)
			Transform transform = new GameObject().transform;
			((Collider)((Component)transform).gameObject.AddComponent<BoxCollider>()).isTrigger = true;
			transform.parent = GameResources.Camera;
			transform.localPosition = new Vector3(0f, -0.1f, 0f);
			transform.localRotation = Quaternion.identity;
			transform.localScale = new Vector3(0.2f, 0.1f, 0.2f);
			((Component)transform).gameObject.AddComponent<BiteablePin>();
		});
	}
}
[RegisterTypeInIl2Cpp]
public class BiteablePin : MonoBehaviour
{
	public BiteablePin(IntPtr pointer)
		: base(pointer)
	{
	}

	internal void OnTriggerExit(Collider other)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Invalid comparison between Unknown and I4
		if (Mod.enabled.Value)
		{
			GrenadeRing componentInParent = ((Component)other).GetComponentInParent<GrenadeRing>();
			if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.CurentState != 2)
			{
				componentInParent.PullOutPin();
			}
		}
	}
}