Decompiled source of BoltActionSemiKit v1.2.0

BoltActionSemiKit.dll

Decompiled 18 hours ago
using System;
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.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
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]
public class ToggleLauncherPhysics : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
namespace JerrySemiBolt
{
	public class BoltSemi : MonoBehaviour
	{
		public BoltActionRifle Gun;

		public GameObject GasTubePortGeo;

		public GameObject GasTubeGeo;

		public GameObject SliderPartGeo;

		public GameObject PistonPartGeo;

		public GameObject GasPistonGeo;

		public GameObject SliderGeo;

		public GameObject GasTubeRef;

		public GameObject GasTubeScaleRef;

		public GameObject GasTubeScalemove;

		public GameObject BoltRef;

		public GameObject BoltCarry;

		public GameObject GasPistonRef;

		public GameObject GasPistonRefPos;

		public FVRFireArmAttachment Att;

		public bool AttachedToBolt;

		public FVRInteractiveObject Graber;

		public GameObject GraberRef;

		public bool ShouldRetract;

		public bool ShouldLock;

		public float LockPos;

		public float UnlockPos;

		public GameObject BoltRear;

		public GameObject BoltFore;

		public GameObject BoltHandleRef;

		public bool isDriving;

		public float DrivingForce;

		public bool isEmptyGrabed;

		public GameObject graberroot;

		public GameObject graberroot2;

		public GameObject forePos;

		public float curZ;

		public float lastZ;

		public bool isMoving;

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			curZ = SliderPartGeo.transform.localPosition.z;
			lastZ = curZ;
			GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
		}

		private void OnShotFired(FVRFireArm firearm)
		{
			if ((Object)(object)Gun != (Object)null && (Object)(object)firearm == (Object)(object)Gun)
			{
				ShouldRetract = true;
			}
		}

		private void Update()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_17f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_1817: Unknown result type (might be due to invalid IL or missing references)
			//IL_1852: Unknown result type (might be due to invalid IL or missing references)
			//IL_1876: Unknown result type (might be due to invalid IL or missing references)
			//IL_1712: Unknown result type (might be due to invalid IL or missing references)
			//IL_1736: Unknown result type (might be due to invalid IL or missing references)
			//IL_1771: Unknown result type (might be due to invalid IL or missing references)
			//IL_1795: Unknown result type (might be due to invalid IL or missing references)
			//IL_1631: Unknown result type (might be due to invalid IL or missing references)
			//IL_1655: Unknown result type (might be due to invalid IL or missing references)
			//IL_1690: Unknown result type (might be due to invalid IL or missing references)
			//IL_16b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Invalid comparison between Unknown and I4
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Invalid comparison between Unknown and I4
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_0759: Unknown result type (might be due to invalid IL or missing references)
			//IL_076d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0772: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_071c: 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_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_08af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0860: Unknown result type (might be due to invalid IL or missing references)
			//IL_0894: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0904: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0971: Unknown result type (might be due to invalid IL or missing references)
			//IL_0976: Unknown result type (might be due to invalid IL or missing references)
			//IL_09df: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0adc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c13: Invalid comparison between Unknown and I4
			//IL_0c01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c84: Invalid comparison between Unknown and I4
			//IL_0d22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d28: Invalid comparison between Unknown and I4
			//IL_0cfc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d66: Invalid comparison between Unknown and I4
			//IL_0dbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fdf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1082: Unknown result type (might be due to invalid IL or missing references)
			//IL_1088: Invalid comparison between Unknown and I4
			//IL_101d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1022: Unknown result type (might be due to invalid IL or missing references)
			//IL_1040: Unknown result type (might be due to invalid IL or missing references)
			//IL_1045: Unknown result type (might be due to invalid IL or missing references)
			//IL_1063: Unknown result type (might be due to invalid IL or missing references)
			//IL_1068: Unknown result type (might be due to invalid IL or missing references)
			//IL_1071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1313: Unknown result type (might be due to invalid IL or missing references)
			//IL_1360: Unknown result type (might be due to invalid IL or missing references)
			//IL_138f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1395: Invalid comparison between Unknown and I4
			//IL_13ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_1405: Invalid comparison between Unknown and I4
			//IL_13a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_144f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1455: Invalid comparison between Unknown and I4
			//IL_13df: Unknown result type (might be due to invalid IL or missing references)
			//IL_13e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_14f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_14f9: Invalid comparison between Unknown and I4
			//IL_146b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1470: Unknown result type (might be due to invalid IL or missing references)
			//IL_1536: Unknown result type (might be due to invalid IL or missing references)
			//IL_153b: Unknown result type (might be due to invalid IL or missing references)
			//IL_155f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1564: Unknown result type (might be due to invalid IL or missing references)
			//IL_14cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_14d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_14e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_15bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_15c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_15d6: Unknown result type (might be due to invalid IL or missing references)
			PistonPartGeo.transform.position = GasTubeRef.transform.position;
			PistonPartGeo.transform.rotation = GasTubeRef.transform.rotation;
			GasTubeScalemove.transform.position = GasTubeScaleRef.transform.position;
			GasTubeGeo.transform.localScale = new Vector3(1f, 1f, Mathf.Abs(GasTubeScalemove.transform.localPosition.z));
			GasPistonGeo.transform.localScale = new Vector3(1f, 1f, Mathf.Abs(GasPistonRef.transform.localPosition.z));
			GasPistonRef.transform.position = GasPistonRefPos.transform.position;
			if ((Object)(object)Att.curMount != (Object)null)
			{
				if ((Object)(object)Att.curMount.Parent != (Object)null)
				{
					if ((Object)(object)((Component)Att.curMount.Parent).gameObject.GetComponent<BoltActionRifle>() != (Object)null)
					{
						Gun = ((Component)Att.curMount.Parent).gameObject.GetComponent<BoltActionRifle>();
						if (!((Object)(object)Gun != (Object)null))
						{
							return;
						}
						if (!AttachedToBolt)
						{
							Graber.IsSimpleInteract = true;
							Gun.BoltHandle.DriveBolt(-1f);
							Gun.UpdateBolt((BoltActionHandleState)0, 0f, false);
							if ((int)Gun.CurBoltHandleState == 0 && (int)Gun.BoltHandle.HandleRot == 2)
							{
								((FVRInteractiveObject)Gun.BoltHandle).IsSimpleInteract = true;
								BoltHandleRef.transform.position = ((Component)Gun.BoltHandle).gameObject.transform.position;
								GasTubeRef.transform.localPosition = new Vector3(GasTubeRef.transform.localPosition.x, GasTubeRef.transform.localPosition.y, BoltHandleRef.gameObject.transform.localPosition.z);
								SliderGeo.transform.localEulerAngles = new Vector3(0f, 0f, Gun.BoltHandle.BaseRotOffset);
								BoltRear.transform.position = ((Component)Gun.BoltHandle.Point_Rearward).transform.position;
								BoltFore.transform.position = ((Component)Gun.BoltHandle.Point_Forward).transform.position;
								BoltRef.transform.position = ((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.position;
								BoltCarry.transform.position = BoltRef.transform.position;
								AttachedToBolt = true;
							}
						}
						if (!AttachedToBolt)
						{
							return;
						}
						curZ = SliderPartGeo.transform.localPosition.z;
						if (curZ == lastZ)
						{
							isMoving = false;
						}
						if (curZ != lastZ)
						{
							isMoving = true;
						}
						lastZ = curZ;
						if (GraberRef.gameObject.transform.localPosition.z > forePos.transform.localPosition.z)
						{
							GraberRef.gameObject.transform.localPosition = new Vector3(0f, 0f, forePos.transform.localPosition.z);
						}
						if (Graber.m_isHeld)
						{
							graberroot.transform.position = ((Component)Graber.m_hand).gameObject.transform.position;
							GraberRef.transform.position = graberroot2.transform.position;
						}
						if (!Graber.m_isHeld)
						{
							graberroot.transform.localPosition = new Vector3(0f, 0f, 0f);
							GraberRef.transform.localPosition = new Vector3(0f, 0f, 0f);
						}
						if (!Gun.BoltMovingForward && (int)Gun.CurBoltHandleState == 2 && (double)Mathf.Abs(SliderPartGeo.transform.localPosition.z) + 0.04 > (double)Vector3.Distance(((Component)Gun.BoltHandle.Point_Forward).transform.position, ((Component)Gun.BoltHandle.Point_Rearward).transform.position))
						{
							SliderPartGeo.transform.localPosition = new Vector3(SliderPartGeo.transform.localPosition.x, SliderPartGeo.transform.localPosition.y, -1f * Vector3.Distance(((Component)Gun.BoltHandle.Point_Forward).transform.position, ((Component)Gun.BoltHandle.Point_Rearward).transform.position) - 0.04f);
						}
						if (isDriving)
						{
							Gun.BoltHandle.DriveBolt(DrivingForce);
						}
						if (isDriving && !ShouldLock)
						{
							BoltRef.transform.position = ((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.position;
						}
						if (!isDriving)
						{
							((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.position = BoltRef.transform.position;
						}
						if (BoltRef.transform.localPosition.z > BoltFore.transform.localPosition.z)
						{
							BoltRef.transform.localPosition = new Vector3(BoltRef.transform.localPosition.x, BoltRef.transform.localPosition.y, BoltFore.transform.localPosition.z);
						}
						if (BoltRef.transform.localPosition.z < BoltRear.transform.localPosition.z)
						{
							BoltRef.transform.localPosition = new Vector3(BoltRef.transform.localPosition.x, BoltRef.transform.localPosition.y, BoltRear.transform.localPosition.z);
						}
						if (SliderPartGeo.transform.localPosition.z <= UnlockPos)
						{
							if (!ShouldLock)
							{
								BoltRef.transform.position = BoltCarry.transform.position;
							}
							Gun.BoltHandle.rotAngle = Gun.BoltHandle.MaxRot;
							Gun.BoltHandle.HandleRot = (BoltActionHandleRot)0;
							((Component)Gun.BoltHandle.BoltActionHandle).transform.localEulerAngles = new Vector3(0f, 0f, Gun.BoltHandle.MaxRot);
						}
						if (SliderPartGeo.transform.localPosition.z > UnlockPos && SliderPartGeo.transform.localPosition.z < LockPos - 0.001f)
						{
							BoltCarry.transform.position = BoltRef.transform.position;
							if (!ShouldLock)
							{
								BoltRef.transform.position = BoltFore.transform.position;
							}
							Gun.BoltHandle.rotAngle = Mathf.Lerp(Gun.BoltHandle.MinRot, Gun.BoltHandle.MaxRot, Mathf.Abs(SliderPartGeo.transform.localPosition.z / UnlockPos));
							((Component)Gun.BoltHandle.BoltActionHandle).transform.localEulerAngles = new Vector3(0f, 0f, Mathf.Lerp(Gun.BoltHandle.MinRot, Gun.BoltHandle.MaxRot, Mathf.Abs(SliderPartGeo.transform.localPosition.z / UnlockPos)));
						}
						if ((int)Gun.CurBoltHandleState == 0)
						{
							DrivingForce = 0f;
							isDriving = false;
						}
						if (SliderPartGeo.transform.localPosition.z >= LockPos - 0.001f)
						{
							BoltCarry.transform.position = BoltRef.transform.position;
							if (!ShouldLock)
							{
								BoltRef.transform.position = BoltFore.transform.position;
							}
							Gun.BoltHandle.rotAngle = Gun.BoltHandle.MinRot;
							Gun.BoltHandle.HandleRot = (BoltActionHandleRot)2;
							if ((int)Gun.CurBoltHandleState != 0)
							{
								isDriving = true;
								DrivingForce = -1f;
							}
							((Component)Gun.BoltHandle.BoltActionHandle).transform.localEulerAngles = new Vector3(0f, 0f, Gun.BoltHandle.MinRot);
						}
						if (SliderPartGeo.transform.localPosition.z > LockPos)
						{
							Graber.ForceBreakInteraction();
						}
						if (SliderPartGeo.transform.localPosition.z > 0f)
						{
							SliderPartGeo.transform.localPosition = new Vector3(SliderPartGeo.transform.localPosition.x, SliderPartGeo.transform.localPosition.y, 0f);
						}
						if (SliderPartGeo.transform.localPosition.z == 0f)
						{
							Gun.CurBoltHandleState = (BoltActionHandleState)0;
						}
						if ((int)Gun.CurBoltHandleState == 2)
						{
							DrivingForce = 0f;
							isDriving = false;
						}
						if (((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.z <= ((Component)Gun.BoltHandle.Point_Rearward).transform.localPosition.z && (int)Gun.CurBoltHandleState != 2)
						{
							Gun.CockHammer();
							Gun.UpdateBolt((BoltActionHandleState)2, 1f, false);
						}
						if (((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.z >= ((Component)Gun.BoltHandle.Point_Forward).transform.localPosition.z && (int)Gun.CurBoltHandleState != 0)
						{
							Gun.UpdateBolt((BoltActionHandleState)0, 0f, false);
						}
						if ((int)Gun.CurBoltHandleState == 2 && !ShouldLock)
						{
							Gun.BoltMovingForward = false;
							Graber.ForceBreakInteraction();
							ShouldRetract = false;
						}
						if ((int)Gun.CurBoltHandleState == 1)
						{
							Gun.Chamber.IsAccessible = true;
							if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null)
							{
								((FVRFireArm)Gun).Magazine.IsExtractable = true;
							}
						}
						if (((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.z > ((Component)Gun.BoltHandle.Point_Rearward).transform.localPosition.z && ((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.z < ((Component)Gun.BoltHandle.Point_Forward).transform.localPosition.z && isMoving)
						{
							Gun.UpdateBolt((BoltActionHandleState)1, Mathf.Abs(Vector3.Distance(((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.position, ((Component)Gun.BoltHandle.Point_Forward).transform.position) / Vector3.Distance(((Component)Gun.BoltHandle.Point_Rearward).transform.position, ((Component)Gun.BoltHandle.Point_Forward).transform.position)), false);
						}
						if (((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.z < ((Component)Gun.BoltHandle.Point_Rearward).transform.localPosition.z)
						{
							((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition = new Vector3(((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.x, ((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.y, ((Component)Gun.BoltHandle.Point_Rearward).transform.localPosition.z);
						}
						if (((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.z > ((Component)Gun.BoltHandle.Point_Forward).transform.localPosition.z)
						{
							((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition = new Vector3(((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.x, ((Component)Gun.BoltHandle.BoltActionHandleRoot).transform.localPosition.y, ((Component)Gun.BoltHandle.Point_Forward).transform.localPosition.z);
						}
						if ((int)Gun.CurBoltHandleState == 2)
						{
							if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null && ((FVRFireArm)Gun).Magazine.m_numRounds <= 0)
							{
								isEmptyGrabed = true;
								ShouldLock = true;
								ShouldRetract = true;
							}
							if ((Object)(object)((FVRFireArm)Gun).Magazine == (Object)null && !Gun.Chamber.IsFull)
							{
								isEmptyGrabed = true;
								ShouldLock = true;
								ShouldRetract = true;
							}
						}
						if (ShouldLock)
						{
							if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null)
							{
								if (((FVRFireArm)Gun).Magazine.m_numRounds <= 0 && !Gun.Chamber.IsFull)
								{
									Graber.ForceBreakInteraction();
								}
								if (((FVRFireArm)Gun).Magazine.m_numRounds > 0 || (Gun.Chamber.IsFull && !Gun.Chamber.IsSpent))
								{
									if (Graber.m_isHeld)
									{
										isEmptyGrabed = false;
									}
									if (!isEmptyGrabed)
									{
										if (((FVRFireArm)Gun).UsesClips)
										{
											if ((Object)(object)((FVRFireArm)Gun).Clip == (Object)null)
											{
												ShouldLock = false;
												ShouldRetract = false;
											}
											if ((Object)(object)((FVRFireArm)Gun).Clip != (Object)null)
											{
												Graber.ForceBreakInteraction();
											}
										}
										else
										{
											ShouldLock = false;
											ShouldRetract = false;
										}
									}
								}
							}
							if ((Object)(object)((FVRFireArm)Gun).Magazine == (Object)null)
							{
								if (Gun.Chamber.IsFull && !Gun.Chamber.IsSpent)
								{
									if (Graber.m_isHeld)
									{
										isEmptyGrabed = false;
									}
									if (!isEmptyGrabed)
									{
										ShouldLock = false;
										ShouldRetract = false;
									}
								}
								if (!Gun.Chamber.IsFull || Gun.Chamber.IsSpent)
								{
									Graber.ForceBreakInteraction();
								}
							}
						}
						if ((int)Gun.FireSelector_Modes[Gun.m_fireSelectorMode].ModeType == 0)
						{
							Gun.UpdateBolt((BoltActionHandleState)0, 0f, false);
							Graber.IsSimpleInteract = true;
							Graber.ForceBreakInteraction();
						}
						if ((int)Gun.FireSelector_Modes[Gun.m_fireSelectorMode].ModeType != 0)
						{
							Graber.IsSimpleInteract = false;
						}
						if (Graber.m_isHeld)
						{
							if ((int)Gun.CurBoltHandleState != 2 && SliderPartGeo.transform.localPosition.z <= 0f)
							{
								SliderPartGeo.transform.localPosition = new Vector3(0f, 0f, GraberRef.transform.localPosition.z);
							}
							if ((int)Gun.CurBoltHandleState == 2 && !ShouldLock)
							{
								Graber.ForceBreakInteraction();
								ShouldRetract = false;
							}
						}
						if (Graber.m_isHeld)
						{
							return;
						}
						if (ShouldRetract)
						{
							if ((int)Gun.CurBoltHandleState != 2)
							{
								float num = 0.65f / Mathf.Abs(PistonPartGeo.transform.localPosition.z);
								if (num > 3f)
								{
									num = 3f;
								}
								if (num < 1.75f)
								{
									num = 1.75f;
								}
								SliderPartGeo.transform.localPosition = new Vector3(0f, 0f, SliderPartGeo.transform.localPosition.z - Time.deltaTime * num);
							}
							if ((int)Gun.CurBoltHandleState == 2)
							{
								ShouldRetract = false;
							}
						}
						if (ShouldRetract || ShouldLock)
						{
							return;
						}
						Gun.BoltMovingForward = true;
						if (SliderPartGeo.transform.localPosition.z < 0f)
						{
							float num2 = 0.48749998f / Mathf.Abs(PistonPartGeo.transform.localPosition.z);
							if (num2 > 2.5f)
							{
								num2 = 2.5f;
							}
							if (num2 < 1.25f)
							{
								num2 = 1.25f;
							}
							SliderPartGeo.transform.localPosition = new Vector3(0f, 0f, SliderPartGeo.transform.localPosition.z + Time.deltaTime * num2);
						}
					}
					else
					{
						if ((Object)(object)Gun != (Object)null)
						{
							((FVRInteractiveObject)Gun.BoltHandle).IsSimpleInteract = false;
							Gun = null;
						}
						BoltRef.transform.localPosition = new Vector3(0f, 0f, 0f);
						BoltCarry.transform.localPosition = new Vector3(0f, 0f, 0f);
						Graber.ForceBreakInteraction();
						Graber.IsSimpleInteract = false;
						GasTubeRef.transform.localPosition = new Vector3(0f, 0f, 0f);
						SliderGeo.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
						AttachedToBolt = false;
					}
				}
				else
				{
					if ((Object)(object)Gun != (Object)null)
					{
						((FVRInteractiveObject)Gun.BoltHandle).IsSimpleInteract = false;
						Gun = null;
					}
					BoltRef.transform.localPosition = new Vector3(0f, 0f, 0f);
					BoltCarry.transform.localPosition = new Vector3(0f, 0f, 0f);
					Graber.ForceBreakInteraction();
					Graber.IsSimpleInteract = false;
					GasTubeRef.transform.localPosition = new Vector3(0f, 0f, 0f);
					SliderGeo.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
					AttachedToBolt = false;
				}
			}
			else
			{
				if ((Object)(object)Gun != (Object)null)
				{
					((FVRInteractiveObject)Gun.BoltHandle).IsSimpleInteract = false;
					Gun = null;
				}
				BoltRef.transform.localPosition = new Vector3(0f, 0f, 0f);
				BoltCarry.transform.localPosition = new Vector3(0f, 0f, 0f);
				Graber.ForceBreakInteraction();
				Graber.IsSimpleInteract = false;
				GasTubeRef.transform.localPosition = new Vector3(0f, 0f, 0f);
				SliderGeo.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				AttachedToBolt = false;
			}
		}

		private void OnDestroy()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired);
		}
	}
}
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class DeferredNightVisionEffect : MonoBehaviour
{
	[SerializeField]
	[Tooltip("The main color of the NV effect")]
	public Color m_NVColor = new Color(0f, 1f, 0.1724138f, 0f);

	[SerializeField]
	[Tooltip("The color that the NV effect will 'bleach' towards (white = default)")]
	public Color m_TargetBleachColor = new Color(1f, 1f, 1f, 0f);

	[Range(0f, 0.1f)]
	[Tooltip("How much base lighting does the NV effect pick up")]
	public float m_baseLightingContribution = 0.025f;

	[Range(0f, 128f)]
	[Tooltip("The higher this value, the more bright areas will get 'bleached out'")]
	public float m_LightSensitivityMultiplier = 100f;

	private Material m_Material;

	private Shader m_Shader;

	[Tooltip("Do we want to apply a vignette to the edges of the screen?")]
	public bool useVignetting = true;

	public Shader NightVisionShader => m_Shader;

	private void DestroyMaterial(Material mat)
	{
		if (Object.op_Implicit((Object)(object)mat))
		{
			Object.DestroyImmediate((Object)(object)mat);
			mat = null;
		}
	}

	private void CreateMaterials()
	{
		if ((Object)(object)m_Shader == (Object)null)
		{
			m_Shader = Shader.Find("Custom/DeferredNightVisionShader");
		}
		if ((Object)(object)m_Material == (Object)null && (Object)(object)m_Shader != (Object)null && m_Shader.isSupported)
		{
			m_Material = CreateMaterial(m_Shader);
		}
	}

	private Material CreateMaterial(Shader shader)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)shader))
		{
			return null;
		}
		Material val = new Material(shader);
		((Object)val).hideFlags = (HideFlags)61;
		return val;
	}

	private void OnDisable()
	{
		DestroyMaterial(m_Material);
		m_Material = null;
		m_Shader = null;
	}

	[ContextMenu("UpdateShaderValues")]
	public void UpdateShaderValues()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)m_Material == (Object)null))
		{
			m_Material.SetVector("_NVColor", Color.op_Implicit(m_NVColor));
			m_Material.SetVector("_TargetWhiteColor", Color.op_Implicit(m_TargetBleachColor));
			m_Material.SetFloat("_BaseLightingContribution", m_baseLightingContribution);
			m_Material.SetFloat("_LightSensitivityMultiplier", m_LightSensitivityMultiplier);
			m_Material.shaderKeywords = null;
			if (useVignetting)
			{
				Shader.EnableKeyword("USE_VIGNETTE");
			}
			else
			{
				Shader.DisableKeyword("USE_VIGNETTE");
			}
		}
	}

	private void OnEnable()
	{
		CreateMaterials();
		UpdateShaderValues();
	}

	public void ReloadShaders()
	{
		OnDisable();
	}

	private void OnRenderImage(RenderTexture source, RenderTexture destination)
	{
		UpdateShaderValues();
		CreateMaterials();
		Graphics.Blit((Texture)(object)source, destination, m_Material);
	}
}
public class RollAndLock2 : MonoBehaviour
{
	public FVRFireArmRecoilProfile hold;

	public FVRFireArmRecoilProfile unhold;

	public Transform MagazinePoint;

	public Transform MagazinePivot;

	public float lowerlimit;

	public float upperlimit;

	private HingeJoint Joint;

	public float eject;

	public float lockangle;

	public bool magejectonmag;

	private bool locked = false;

	private bool isPhysRel = false;

	public Collider[] colliders;

	public FVRFireArm Gun;

	public GameObject GunRig;

	[NonSerialized]
	public FVRFireArmMagazine Magazine;

	public GameObject maglatch;

	public Collider col;

	private void Update()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: 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_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_055f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0584: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0439: Unknown result type (might be due to invalid IL or missing references)
		//IL_043e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_045b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)Gun).transform.InverseTransformPoint(MagazinePoint.position);
		Vector3 val2 = ((Component)Gun).transform.InverseTransformPoint(MagazinePivot.position);
		if ((Object)(object)Magazine != (Object)null)
		{
			if (((FVRInteractiveObject)Magazine).IsHeld)
			{
				Gun.RecoilProfile = hold;
			}
			else if (!((FVRInteractiveObject)Magazine).IsHeld)
			{
				Gun.RecoilProfile = unhold;
			}
			if (Quaternion.Angle(MagazinePoint.rotation, ((Component)Magazine).transform.rotation) < lockangle && !locked)
			{
				JointLimits limits = default(JointLimits);
				((JointLimits)(ref limits)).max = lowerlimit;
				((JointLimits)(ref limits)).min = lowerlimit;
				Joint.limits = limits;
				locked = true;
				if ((Object)(object)Gun.Magazine == (Object)null)
				{
					Gun.LoadMag(Magazine);
					Magazine.FireArm = Gun;
				}
			}
			if ((Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null && (Object)(object)((FVRInteractiveObject)Magazine).m_hand != (Object)null)
			{
				if (locked && !((FVRInteractiveObject)Magazine).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)Magazine).m_hand.Input.TouchpadSouthPressed)
				{
					locked = false;
					JointLimits limits2 = default(JointLimits);
					((JointLimits)(ref limits2)).max = upperlimit;
					((JointLimits)(ref limits2)).min = lowerlimit;
					if ((Object)(object)Joint != (Object)null)
					{
						Joint.limits = limits2;
						Object.Destroy((Object)(object)Joint);
					}
					Collider[] array = ((FVRInteractiveObject)Magazine).m_colliders;
					foreach (Collider val3 in array)
					{
						Collider[] array2 = colliders;
						foreach (Collider val4 in array2)
						{
							Physics.IgnoreCollision(val4, val3, false);
						}
					}
					if ((Object)(object)Gun.Magazine != (Object)null)
					{
						Gun.EjectMag(false);
						Magazine = null;
					}
				}
				if (locked && ((FVRInteractiveObject)Magazine).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)Magazine).m_hand.Input.AXButtonPressed)
				{
					locked = false;
					JointLimits limits3 = default(JointLimits);
					((JointLimits)(ref limits3)).max = upperlimit;
					((JointLimits)(ref limits3)).min = lowerlimit;
					if ((Object)(object)Joint != (Object)null)
					{
						Joint.limits = limits3;
						Object.Destroy((Object)(object)Joint);
					}
					Collider[] array3 = ((FVRInteractiveObject)Magazine).m_colliders;
					foreach (Collider val5 in array3)
					{
						Collider[] array4 = colliders;
						foreach (Collider val6 in array4)
						{
							Physics.IgnoreCollision(val6, val5, false);
						}
					}
					if ((Object)(object)Gun.Magazine != (Object)null)
					{
						Gun.EjectMag(false);
						Magazine = null;
					}
				}
			}
			if ((Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null && (Object)(object)((FVRInteractiveObject)Gun).m_hand.OtherHand.m_currentInteractable != (Object)null && (Object)(object)((Component)((FVRInteractiveObject)Gun).m_hand.OtherHand.m_currentInteractable).gameObject.GetComponent<FVRFireArmMagazine>() != (Object)null && maglatch.transform.localEulerAngles.x > 180f && maglatch.transform.localEulerAngles.x < 335f)
			{
				locked = false;
				JointLimits limits4 = default(JointLimits);
				((JointLimits)(ref limits4)).max = upperlimit;
				((JointLimits)(ref limits4)).min = lowerlimit;
				if ((Object)(object)Joint != (Object)null)
				{
					Joint.limits = limits4;
					Object.Destroy((Object)(object)Joint);
				}
				Collider[] array5 = ((FVRInteractiveObject)Magazine).m_colliders;
				foreach (Collider val7 in array5)
				{
					Collider[] array6 = colliders;
					foreach (Collider val8 in array6)
					{
						Physics.IgnoreCollision(val8, val7, false);
					}
				}
				if ((Object)(object)Gun.Magazine != (Object)null)
				{
					Gun.EjectMag(false);
					Magazine = null;
				}
			}
			if (locked)
			{
				((Component)Magazine).gameObject.transform.position = ((Component)MagazinePoint).transform.position;
				((Component)Magazine).gameObject.transform.rotation = ((Component)MagazinePoint).transform.rotation;
			}
		}
		else if ((Object)(object)Magazine == (Object)null)
		{
			Gun.RecoilProfile = unhold;
		}
	}

	public void OnTriggerStay(Collider other)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: 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_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>() != (Object)null) || !((Object)(object)((FVRInteractiveObject)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).m_hand != (Object)null))
		{
			return;
		}
		Transform transform = new GameObject().transform;
		transform.rotation = ((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).gameObject.transform.rotation;
		transform.parent = MagazinePoint;
		Vector3 val = ((Component)Gun).transform.InverseTransformPoint(MagazinePoint.position);
		Vector3 val2 = ((Component)Gun).transform.InverseTransformPoint(MagazinePivot.position);
		Joint = ((Component)Gun).gameObject.AddComponent<HingeJoint>();
		((Joint)Joint).autoConfigureConnectedAnchor = false;
		JointLimits limits = default(JointLimits);
		((JointLimits)(ref limits)).max = upperlimit;
		((JointLimits)(ref limits)).min = lowerlimit;
		Joint.limits = limits;
		((Joint)Joint).anchor = val2;
		Joint.useLimits = true;
		((Joint)Joint).connectedAnchor = val2 - val;
		((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).transform.rotation = MagazinePoint.rotation;
		((Joint)Joint).axis = ((Component)Gun).transform.InverseTransformDirection(MagazinePoint.right);
		((Joint)Joint).connectedBody = ((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).GetComponent<Rigidbody>();
		Magazine = ((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine;
		((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).transform.rotation = transform.rotation;
		Object.Destroy((Object)(object)((Component)transform).gameObject);
		Collider[] array = ((FVRInteractiveObject)Magazine).m_colliders;
		foreach (Collider val3 in array)
		{
			Collider[] array2 = colliders;
			foreach (Collider val4 in array2)
			{
				Physics.IgnoreCollision(val4, val3, true);
			}
		}
	}
}
public class Bezier : MonoBehaviour
{
	public Transform[] controlPoints;

	public LineRenderer lineRenderer;

	private int _segmentNum = 50;

	private void Start()
	{
	}

	private void Update()
	{
		DrawCurve();
	}

	private void DrawCurve()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 1; i <= _segmentNum; i++)
		{
			float t = (float)i / (float)_segmentNum;
			int num = 0;
			Vector3 val = CalculateCubicBezierPoint(t, controlPoints[num].position, controlPoints[num + 1].position, controlPoints[num + 2].position);
			lineRenderer.positionCount = i;
			lineRenderer.SetPosition(i - 1, val);
		}
	}

	private Vector3 CalculateCubicBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_0038: 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_003e: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		float num = 1f - t;
		float num2 = t * t;
		float num3 = num * num;
		Vector3 val = num3 * p0;
		val += 2f * num * t * p1;
		return val + num2 * p2;
	}
}
public class BezierUtils
{
	private static Vector3 CalculateCubicBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_003e: 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)
		float num = 1f - t;
		float num2 = t * t;
		float num3 = num * num;
		Vector3 val = num3 * p0;
		val += 2f * num * t * p1;
		return val + num2 * p2;
	}

	public static Vector3[] GetBeizerList(Vector3 startPoint, Vector3 controlPoint, Vector3 endPoint, int segmentNum)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		Vector3[] array = (Vector3[])(object)new Vector3[segmentNum];
		for (int i = 1; i <= segmentNum; i++)
		{
			float t = (float)i / (float)segmentNum;
			Vector3 val = CalculateCubicBezierPoint(t, startPoint, controlPoint, endPoint);
			array[i - 1] = val;
			Debug.Log((object)array[i - 1]);
		}
		return array;
	}
}
namespace JerryAr.BoltActionSemiKit
{
	[BepInPlugin("JerryAr.BoltActionSemiKit", "BoltActionSemiKit", "1.2.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class BoltActionSemiKitPlugin : 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.BoltActionSemiKit");
			OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.BoltActionSemiKit", "", "", "boltsemikit", "");
		}
	}
}
public class RollAndLock : MonoBehaviour
{
	public Transform MagazinePoint;

	public Transform MagazinePivot;

	public float lowerlimit;

	public float upperlimit;

	private HingeJoint Joint;

	public float eject;

	public float lockangle;

	public bool magejectonmag;

	private bool locked = false;

	private bool isPhysRel = false;

	public Collider[] colliders;

	public OpenBoltReceiver Gun;

	public GameObject GunRig;

	[NonSerialized]
	public FVRFireArmMagazine Magazine;

	public Collider col;

	private void Update()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: 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_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: 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_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)Gun).transform.InverseTransformPoint(MagazinePoint.position);
		Vector3 val2 = ((Component)Gun).transform.InverseTransformPoint(MagazinePivot.position);
		if (!((Object)(object)Magazine != (Object)null))
		{
			return;
		}
		if (Quaternion.Angle(MagazinePoint.rotation, ((Component)Magazine).transform.rotation) < lockangle && !locked)
		{
			JointLimits limits = default(JointLimits);
			((JointLimits)(ref limits)).max = lowerlimit;
			((JointLimits)(ref limits)).min = lowerlimit;
			Joint.limits = limits;
			locked = true;
			if ((Object)(object)((FVRFireArm)Gun).Magazine == (Object)null)
			{
				((FVRFireArm)Gun).LoadMag(Magazine);
				Magazine.FireArm = (FVRFireArm)(object)Gun;
				((Behaviour)Magazine.BeltGrabTrigger).enabled = true;
				Magazine.Load((FVRFireArm)(object)Gun);
				((FVRFireArm)Gun).ConnectedToBox = true;
			}
		}
		if ((Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null && (Object)(object)((FVRInteractiveObject)Magazine).m_hand != (Object)null && ((FVRInteractiveObject)Magazine).m_hand.Input.TriggerPressed)
		{
			locked = false;
			JointLimits limits2 = default(JointLimits);
			((JointLimits)(ref limits2)).max = upperlimit;
			((JointLimits)(ref limits2)).min = lowerlimit;
			if ((Object)(object)Joint != (Object)null)
			{
				Joint.limits = limits2;
				Object.Destroy((Object)(object)Joint);
			}
			Collider[] array = ((FVRInteractiveObject)Magazine).m_colliders;
			foreach (Collider val3 in array)
			{
				Collider[] array2 = colliders;
				foreach (Collider val4 in array2)
				{
					Physics.IgnoreCollision(val4, val3, false);
				}
			}
			if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null)
			{
				((Behaviour)Magazine.BeltGrabTrigger).enabled = false;
				((FVRFireArm)Gun).EjectMag(false);
				((FVRFireArm)Gun).ConnectedToBox = false;
				Magazine = null;
			}
		}
		if (locked)
		{
			((Component)Magazine).gameObject.transform.position = ((Component)MagazinePoint).transform.position;
			((Component)Magazine).gameObject.transform.rotation = ((Component)MagazinePoint).transform.rotation;
		}
	}

	public void OnTriggerStay(Collider other)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>() != (Object)null) || !((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine.IsBeltBox || !((Object)(object)((FVRInteractiveObject)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).m_hand != (Object)null))
		{
			return;
		}
		Transform transform = new GameObject().transform;
		transform.rotation = ((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).gameObject.transform.rotation;
		transform.parent = MagazinePoint;
		Vector3 val = ((Component)Gun).transform.InverseTransformPoint(MagazinePoint.position);
		Vector3 val2 = ((Component)Gun).transform.InverseTransformPoint(MagazinePivot.position);
		Joint = ((Component)Gun).gameObject.AddComponent<HingeJoint>();
		((Joint)Joint).autoConfigureConnectedAnchor = false;
		JointLimits limits = default(JointLimits);
		((JointLimits)(ref limits)).max = upperlimit;
		((JointLimits)(ref limits)).min = lowerlimit;
		Joint.limits = limits;
		((Joint)Joint).anchor = val2;
		Joint.useLimits = true;
		((Joint)Joint).connectedAnchor = val2 - val;
		((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).transform.rotation = MagazinePoint.rotation;
		((Joint)Joint).axis = ((Component)Gun).transform.InverseTransformDirection(MagazinePoint.forward);
		((Joint)Joint).connectedBody = ((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).GetComponent<Rigidbody>();
		Magazine = ((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine;
		((Component)((Component)other).GetComponent<FVRFireArmReloadTriggerMag>().Magazine).transform.rotation = transform.rotation;
		Object.Destroy((Object)(object)((Component)transform).gameObject);
		Collider[] array = ((FVRInteractiveObject)Magazine).m_colliders;
		foreach (Collider val3 in array)
		{
			Collider[] array2 = colliders;
			foreach (Collider val4 in array2)
			{
				Physics.IgnoreCollision(val4, val3, true);
			}
		}
	}
}
public class MagPosChange : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class SlideScopeH3 : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}