Decompiled source of AddChamberTriggerToEveryGun v1.0.0

Niko666.AddChamberTriggerToEveryGun.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Niko666")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Add chamber triggers to every gun so you can manually insert a round into the chamber")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Niko666.AddChamberTriggerToEveryGun")]
[assembly: AssemblyTitle("AddChamberTriggerToEveryGun")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace Niko666
{
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("Niko666.AddChamberTriggerToEveryGun", "AddChamberTriggerToEveryGun", "1.0.0")]
	public class AddChamberTriggerToEveryGun : BaseUnityPlugin
	{
		public const string Id = "Niko666.AddChamberTriggerToEveryGun";

		internal static ManualLogSource Logger { get; private set; }

		public static string Name => "AddChamberTriggerToEveryGun";

		public static string Version => "1.0.0";

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogMessage((object)("Hello, world! Sent from Niko666.AddChamberTriggerToEveryGun " + Version));
		}
	}
	public class HarmonyPatches : MonoBehaviour
	{
		[HarmonyPatch(typeof(FVRFireArmChamber), "Awake")]
		[HarmonyPostfix]
		private static void Awake_Postfix(FVRFireArmChamber __instance)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<Collider>() == (Object)null)
			{
				CapsuleCollider obj = ((Component)__instance).gameObject.AddComponent<CapsuleCollider>();
				((Collider)obj).isTrigger = true;
				obj.center = new Vector3(0f, 0f, -0.03f);
				obj.radius = 0.011f;
				obj.height = 0.13f;
				__instance.IsManuallyChamberable = true;
			}
		}
	}
}