Decompiled source of ShotGun Shouldering v1.2.1

ShotGun_Shouldering.dll

Decompiled 2 weeks ago
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace JerryShotGun
{
	[BepInPlugin("JerryShotGun", "JSG", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	public class JerryShotGunShoulder : BaseUnityPlugin
	{
		private bool isPalmable = true;

		private bool isLeftShoulder = true;

		private bool isActivated = true;

		private TubeFedShotgun Gun;

		private FVRQuickBeltSlot slot;

		private bool wasHarnessed = false;

		private FVRAlternateGrip Grip;

		private bool shouldered = false;

		private bool palmed = false;

		private GameObject shoulderpos;

		private GameObject headpos;

		private GameObject Gunholder;

		private GameObject Gunref;

		private float shoulderdis = 0.25f;

		public static ConfigEntry<float> ShoulderDistance;

		public static ConfigEntry<bool> ShotGunShoulderingEnabled;

		public static ConfigEntry<bool> LeftShoulder;

		public static ConfigEntry<bool> ShotGunShellPalmingEnabled;

		public static ConfigEntry<Vector3> PalmedRoundRotation;

		public static ConfigEntry<Vector3> PalmedRoundPosition;

		public static ConfigEntry<bool> Collision;

		private Vector3 Pos;

		private Vector3 Rot;

		private bool hasCol = true;

		private void Start()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			LoadConfigFile();
			isActivated = ShotGunShoulderingEnabled.Value;
			isPalmable = ShotGunShellPalmingEnabled.Value;
			Pos = PalmedRoundPosition.Value;
			Rot = PalmedRoundRotation.Value;
			isLeftShoulder = LeftShoulder.Value;
			shoulderdis = ShoulderDistance.Value;
			hasCol = Collision.Value;
		}

		private void LoadConfigFile()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			ShotGunShoulderingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "ShotGunShouldering", true, "Toggle the function (requires restart.)");
			LeftShoulder = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "UseLeftShoulder", true, "Toggle the which shoulder you use to reload (requires restart.)");
			ShoulderDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Float", "ShoulderDistance", 0.25f, "Change the distance of stock shouldering detection (requires restart.)");
			ShotGunShellPalmingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "ShotGunShellPalming", true, "Toggle the function (requires restart.)");
			PalmedRoundRotation = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Vector3", "PalmedRoundRotation", new Vector3(125f, 0f, 0f), "Change the Rotation of palmed shells (requires restart.)");
			PalmedRoundPosition = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Vector3", "PalmedRoundPosition", new Vector3(0f, -0.05f, -0.05f), "Change the Position of palmed shells (requires restart.)");
			Collision = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "ShellCollision", true, "Toggle the collider on shells (requires restart.)");
		}

		private void Update()
		{
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Expected O, but got Unknown
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb0: Expected O, but got Unknown
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Expected O, but got Unknown
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c54: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdd: Expected O, but got Unknown
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0823: Unknown result type (might be due to invalid IL or missing references)
			//IL_084c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0877: Unknown result type (might be due to invalid IL or missing references)
			//IL_0898: Unknown result type (might be due to invalid IL or missing references)
			//IL_089d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1036: Unknown result type (might be due to invalid IL or missing references)
			//IL_105f: Unknown result type (might be due to invalid IL or missing references)
			//IL_108a: Unknown result type (might be due to invalid IL or missing references)
			//IL_10ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_10b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_095d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_1170: Unknown result type (might be due to invalid IL or missing references)
			//IL_1199: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e36: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_0750: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f63: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Gun == (Object)null || (Object)(object)Grip == (Object)null || (Object)(object)slot == (Object)null)
			{
			}
			if (isPalmable && shouldered && (Object)(object)Gun != (Object)null)
			{
				if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>() != (Object)null)
				{
					FVRFireArmRound component = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>();
					if ((Object)(object)component != (Object)null && component.RoundType == ((FVRFireArm)Gun).RoundType)
					{
						((Component)component).gameObject.transform.SetParent(((Component)((FVRInteractiveObject)component).m_hand).gameObject.transform);
						((Component)component).gameObject.transform.localPosition = Pos;
						((Component)component).gameObject.transform.localEulerAngles = Rot;
						if (!hasCol)
						{
							((FVRInteractiveObject)component).SetAllCollidersToLayer(false, "Interactable");
						}
						else if (hasCol)
						{
							((FVRInteractiveObject)component).SetAllCollidersToLayer(false, "Default");
						}
						if (component.ProxyRounds.Count == 1)
						{
							component.ProxyRounds[0].GO.transform.localPosition = new Vector3(0f, 0f, -0.065f);
						}
					}
				}
				if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>() != (Object)null)
				{
					FVRFireArmRound component2 = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRFireArmRound>();
					if ((Object)(object)component2 != (Object)null && component2.RoundType == ((FVRFireArm)Gun).RoundType)
					{
						((Component)component2).gameObject.transform.SetParent(((Component)((FVRInteractiveObject)component2).m_hand).gameObject.transform);
						((Component)component2).gameObject.transform.localPosition = Pos;
						((Component)component2).gameObject.transform.localEulerAngles = Rot;
						if (!hasCol)
						{
							((FVRInteractiveObject)component2).SetAllCollidersToLayer(false, "Interactable");
						}
						else if (hasCol)
						{
							((FVRInteractiveObject)component2).SetAllCollidersToLayer(false, "Default");
						}
						if (component2.ProxyRounds.Count == 1)
						{
							component2.ProxyRounds[0].GO.transform.localPosition = new Vector3(0f, 0f, -0.065f);
						}
					}
				}
			}
			if (!isActivated || !((Object)(object)GM.CurrentMovementManager != (Object)null))
			{
				return;
			}
			if ((Object)(object)Gunholder == (Object)null)
			{
				Gunholder = new GameObject("Gunholder");
				Debug.Log((object)"GunHolder");
			}
			if ((Object)(object)Gunref == (Object)null)
			{
				Gunref = new GameObject("Gunref");
				Debug.Log((object)"Gunref");
			}
			if (isLeftShoulder)
			{
				if ((Object)(object)headpos == (Object)null)
				{
					headpos = new GameObject("HeadPos");
					Debug.Log((object)"Headpos");
				}
				if ((Object)(object)shoulderpos == (Object)null)
				{
					shoulderpos = new GameObject("ShoulderPos");
					Debug.Log((object)"ShoulderPos");
					if ((Object)(object)headpos != (Object)null)
					{
						shoulderpos.transform.SetParent(headpos.transform);
						shoulderpos.transform.localPosition = new Vector3(-0.15f, -0.1f, 0f);
					}
				}
				headpos.transform.position = ((Component)GM.CurrentMovementManager.Head).transform.position;
				headpos.transform.eulerAngles = ((Component)GM.CurrentMovementManager.Head).transform.eulerAngles;
				if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>() != (Object)null && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>()).HasActiveShoulderStock)
				{
					Gun = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>();
				}
				if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)Gun != (Object)null && (Object)(object)shoulderpos != (Object)null && (Object)(object)headpos != (Object)null)
				{
					if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>() != (Object)null)
					{
						Grip = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>();
					}
					if ((Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)(object)Gun) || (Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null))
					{
						if (((FVRPhysicalObject)Gun).m_isHardnessed)
						{
							wasHarnessed = true;
							slot = ((FVRPhysicalObject)Gun).m_quickbeltSlot;
							slot.CurObject = null;
							((FVRPhysicalObject)Gun).m_quickbeltSlot = null;
							((FVRPhysicalObject)Gun).m_isHardnessed = false;
						}
						if (!shouldered)
						{
							Gunholder.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position;
							Gunholder.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles;
							Gunref.transform.position = ((Component)Gun).transform.position;
							Gunref.transform.eulerAngles = ((Component)Gun).transform.eulerAngles;
							((FVRInteractiveObject)Gun).ForceBreakInteraction();
							((FVRInteractiveObject)Grip).ForceBreakInteraction();
							((FVRPhysicalObject)Gun).StoreAndDestroyRigidbody();
							shouldered = true;
						}
					}
				}
				if (shouldered && GM.CurrentMovementManager.Hands[0].Input.GripPressed)
				{
					if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null)
					{
						Gunref.transform.SetParent(Gunholder.transform);
						((Component)Gun).gameObject.transform.SetParent(Gunref.transform);
						((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
						((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
						Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position;
						LeftAxisLookAt(Gunholder.transform, shoulderpos.transform.position, Vector3.back);
						GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(false);
					}
					else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null)
					{
						if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)(object)Gun)
						{
							Gunref.transform.SetParent(Gunholder.transform);
							((Component)Gun).gameObject.transform.SetParent(Gunref.transform);
							((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
							((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
							Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[0]).gameObject.transform.position;
							LeftAxisLookAt(Gunholder.transform, shoulderpos.transform.position, Vector3.back);
							GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(false);
						}
						else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun)
						{
							if (wasHarnessed && (Object)(object)slot != (Object)null)
							{
								((FVRPhysicalObject)Gun).m_quickbeltSlot = slot;
								slot.CurObject = (FVRPhysicalObject)(object)Gun;
								((FVRPhysicalObject)Gun).m_isHardnessed = true;
								wasHarnessed = false;
							}
							((FVRInteractiveObject)Gun).BeginInteraction(GM.CurrentMovementManager.Hands[1]);
							((FVRInteractiveObject)Grip).BeginInteraction(GM.CurrentMovementManager.Hands[0]);
							GM.CurrentMovementManager.Hands[0].ForceSetInteractable((FVRInteractiveObject)(object)Grip);
							shouldered = false;
						}
					}
				}
				else if (shouldered && !GM.CurrentMovementManager.Hands[0].Input.GripPressed)
				{
					if (wasHarnessed && (Object)(object)slot != (Object)null)
					{
						((FVRPhysicalObject)Gun).m_quickbeltSlot = slot;
						slot.CurObject = (FVRPhysicalObject)(object)Gun;
						((FVRPhysicalObject)Gun).m_isHardnessed = true;
						wasHarnessed = false;
					}
					((Component)Gun).gameObject.transform.SetParent((Transform)null);
					((FVRPhysicalObject)Gun).RecoverRigidbody();
					GM.CurrentMovementManager.Hands[0].Display_Controller.SetActive(true);
					shouldered = false;
				}
			}
			if (isLeftShoulder)
			{
				return;
			}
			if ((Object)(object)headpos == (Object)null)
			{
				headpos = new GameObject("HeadPos");
				Debug.Log((object)"Headpos");
			}
			if ((Object)(object)shoulderpos == (Object)null)
			{
				shoulderpos = new GameObject("ShoulderPos");
				Debug.Log((object)"ShoulderPos");
				if ((Object)(object)headpos != (Object)null)
				{
					shoulderpos.transform.SetParent(headpos.transform);
					shoulderpos.transform.localPosition = new Vector3(0.15f, -0.1f, 0f);
				}
			}
			headpos.transform.position = ((Component)GM.CurrentMovementManager.Head).transform.position;
			headpos.transform.eulerAngles = ((Component)GM.CurrentMovementManager.Head).transform.eulerAngles;
			if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>() != (Object)null && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>()).HasActiveShoulderStock)
			{
				Gun = ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<TubeFedShotgun>();
			}
			if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null && (Object)(object)Gun != (Object)null && (Object)(object)shoulderpos != (Object)null && (Object)(object)headpos != (Object)null)
			{
				if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>() != (Object)null)
				{
					Grip = ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRAlternateGrip>();
				}
				if ((Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)(object)Gun) || (Vector3.Distance(((FVRFireArm)Gun).StockPos.position, shoulderpos.transform.position) < shoulderdis && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)(object)Gun && (Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null))
				{
					if (((FVRPhysicalObject)Gun).m_isHardnessed)
					{
						wasHarnessed = true;
						slot = ((FVRPhysicalObject)Gun).m_quickbeltSlot;
						slot.CurObject = null;
						((FVRPhysicalObject)Gun).m_quickbeltSlot = null;
						((FVRPhysicalObject)Gun).m_isHardnessed = false;
					}
					if (!shouldered)
					{
						Gunholder.transform.position = ((FVRFireArm)Gun).Foregrip.transform.position;
						Gunholder.transform.eulerAngles = ((FVRFireArm)Gun).Foregrip.transform.eulerAngles;
						Gunref.transform.position = ((Component)Gun).transform.position;
						Gunref.transform.eulerAngles = ((Component)Gun).transform.eulerAngles;
						((FVRInteractiveObject)Gun).ForceBreakInteraction();
						((FVRInteractiveObject)Grip).ForceBreakInteraction();
						((FVRPhysicalObject)Gun).StoreAndDestroyRigidbody();
						shouldered = true;
					}
				}
			}
			if (shouldered && GM.CurrentMovementManager.Hands[1].Input.GripPressed)
			{
				if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null)
				{
					Gunref.transform.SetParent(Gunholder.transform);
					((Component)Gun).gameObject.transform.SetParent(Gunref.transform);
					((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
					((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
					Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position;
					RightAxisLookAt(Gunholder.transform, shoulderpos.transform.position, Vector3.back);
					GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(false);
				}
				else
				{
					if (!((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null))
					{
						return;
					}
					if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)(object)Gun)
					{
						Gunref.transform.SetParent(Gunholder.transform);
						((Component)Gun).gameObject.transform.SetParent(Gunref.transform);
						((Component)Gun).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
						((Component)Gun).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
						Gunholder.transform.position = ((Component)GM.CurrentMovementManager.Hands[1]).gameObject.transform.position;
						RightAxisLookAt(Gunholder.transform, shoulderpos.transform.position, Vector3.back);
						GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(false);
					}
					else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)(object)Gun)
					{
						if (wasHarnessed && (Object)(object)slot != (Object)null)
						{
							((FVRPhysicalObject)Gun).m_quickbeltSlot = slot;
							slot.CurObject = (FVRPhysicalObject)(object)Gun;
							((FVRPhysicalObject)Gun).m_isHardnessed = true;
							wasHarnessed = false;
						}
						((FVRInteractiveObject)Gun).BeginInteraction(GM.CurrentMovementManager.Hands[0]);
						((FVRInteractiveObject)Grip).BeginInteraction(GM.CurrentMovementManager.Hands[1]);
						GM.CurrentMovementManager.Hands[1].ForceSetInteractable((FVRInteractiveObject)(object)Grip);
						shouldered = false;
					}
				}
			}
			else if (shouldered && !GM.CurrentMovementManager.Hands[1].Input.GripPressed)
			{
				if (wasHarnessed && (Object)(object)slot != (Object)null)
				{
					((FVRPhysicalObject)Gun).m_quickbeltSlot = slot;
					slot.CurObject = (FVRPhysicalObject)(object)Gun;
					((FVRPhysicalObject)Gun).m_isHardnessed = true;
					wasHarnessed = false;
				}
				((Component)Gun).gameObject.transform.SetParent((Transform)null);
				((FVRPhysicalObject)Gun).RecoverRigidbody();
				GM.CurrentMovementManager.Hands[1].Display_Controller.SetActive(true);
				shouldered = false;
			}
		}

		private void LeftAxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = tr_self.rotation;
			Vector3 val = lookPos - tr_self.position;
			Vector3 val2 = tr_self.rotation * directionAxis;
			Vector3 val3 = Vector3.Cross(val2, val);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num = Vector3.Angle(val2, val);
			tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
			tr_self.localEulerAngles = new Vector3(tr_self.localEulerAngles.x, tr_self.localEulerAngles.y, 90f);
		}

		private void RightAxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = tr_self.rotation;
			Vector3 val = lookPos - tr_self.position;
			Vector3 val2 = tr_self.rotation * directionAxis;
			Vector3 val3 = Vector3.Cross(val2, val);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num = Vector3.Angle(val2, val);
			tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
			tr_self.localEulerAngles = new Vector3(tr_self.localEulerAngles.x, tr_self.localEulerAngles.y, 270f);
		}
	}
}
namespace JerryAr.ShotGun_Shouldering
{
	[BepInPlugin("JerryAr.ShotGun_Shouldering", "ShotGun_Shouldering", "1.2.1")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	public class ShotGun_ShoulderingPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "JerryAr.ShotGun_Shouldering");
		}
	}
}