Decompiled source of M60E46 v1.2.0

M60E46.dll

Decompiled a day 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]
namespace JerryComponent
{
	public class GrabToUnlock : MonoBehaviour
	{
		public SnapToPointRigidbody Snap;

		public Rigidbody rig;

		public FVRInteractiveObject Grab;

		private void FixedUpdate()
		{
			if (Grab.m_isHeld)
			{
				rig.isKinematic = false;
				((Behaviour)Snap).enabled = false;
			}
			if (!Grab.m_isHeld)
			{
				rig.isKinematic = true;
				((Behaviour)Snap).enabled = true;
			}
		}
	}
	[RequireComponent(typeof(LineRenderer))]
	public class AmmoBeltChain : MonoBehaviour
	{
		[Header("链两端")]
		public Transform startPoint;

		public Transform endPoint;

		[Header("链节设置")]
		public int linkCount = 25;

		public float linkSpacing = 0.08f;

		public float damping = 0.92f;

		public float stiffness = 0.85f;

		public int constraintIterations = 6;

		[Header("物理与拖拽")]
		public Vector3 gravity = new Vector3(0f, -2f, 0f);

		public float maxDeltaTime = 0.033f;

		public bool isHeld = false;

		public float retractSpeed = 2.5f;

		[Header("节点 GameObject 设置")]
		public bool createNodeObjects = true;

		public GameObject nodePrefab;

		public float hideBehindStartZ = 0f;

		[Header("旋转限制")]
		public float maxBendAngleX = 15f;

		public float maxBendAngleY = 15f;

		public float maxTwistAngleZ = 180f;

		public bool bindEndRotation = false;

		[Header("收回设置")]
		public float fullyRetractedThreshold = 0.01f;

		private Vector3[] positions;

		private Vector3[] previousPositions;

		private Vector3 currentEndPosition;

		private float restDistance;

		private LineRenderer line;

		public GameObject[] nodeObjects;

		public Quaternion[] nodeRotations;

		private bool[] nodeRotationClamped;

		private bool isFullyRetracted = false;

		public float downright;

		public float upright;

		public float sideright;

		public float upnum;

		public float fore;

		public float rear;

		private void Start()
		{
			line = ((Component)this).GetComponent<LineRenderer>();
			if ((Object)(object)line == (Object)null)
			{
				line = ((Component)this).gameObject.AddComponent<LineRenderer>();
			}
			InitializeChain();
		}

		private void InitializeChain()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: 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_013e: 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)
			if (linkCount < 2)
			{
				linkCount = 2;
			}
			restDistance = Mathf.Max(0.01f, linkSpacing);
			if ((Object)(object)startPoint == (Object)null)
			{
				startPoint = ((Component)this).transform;
			}
			Vector3 position = startPoint.position;
			Vector3 val = (currentEndPosition = ((!((Object)(object)endPoint != (Object)null)) ? (position + ((Component)this).transform.forward * restDistance * (float)(linkCount - 1)) : endPoint.position));
			isFullyRetracted = false;
			positions = (Vector3[])(object)new Vector3[linkCount];
			previousPositions = (Vector3[])(object)new Vector3[linkCount];
			nodeRotationClamped = new bool[linkCount];
			for (int i = 0; i < linkCount; i++)
			{
				float num = ((linkCount <= 1) ? 0f : ((float)i / (float)(linkCount - 1)));
				ref Vector3 reference = ref positions[i];
				reference = Vector3.Lerp(position, val, num);
				ref Vector3 reference2 = ref previousPositions[i];
				reference2 = positions[i];
				nodeRotationClamped[i] = false;
			}
			if ((Object)(object)line != (Object)null)
			{
				line.useWorldSpace = true;
				line.numPositions = linkCount;
			}
			if (createNodeObjects)
			{
				CreateNodeObjects();
			}
		}

		private void CreateNodeObjects()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: 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_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			if (nodeObjects != null)
			{
				GameObject[] array = nodeObjects;
				foreach (GameObject val in array)
				{
					if ((Object)(object)val != (Object)null)
					{
						Object.Destroy((Object)(object)val);
					}
				}
			}
			nodeObjects = (GameObject[])(object)new GameObject[linkCount];
			nodeRotations = (Quaternion[])(object)new Quaternion[linkCount];
			nodeRotationClamped = new bool[linkCount];
			nodeObjects[0] = null;
			ref Quaternion reference = ref nodeRotations[0];
			reference = startPoint.rotation;
			nodeRotationClamped[0] = false;
			Vector3 val2 = positions[linkCount - 1] - positions[0];
			Vector3 val3 = ((Vector3)(ref val2)).normalized;
			if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f)
			{
				val3 = startPoint.forward;
			}
			for (int j = 1; j < linkCount; j++)
			{
				GameObject val4 = (GameObject)((!((Object)(object)nodePrefab != (Object)null)) ? ((object)new GameObject("ChainNode_" + j)) : ((object)Object.Instantiate<GameObject>(nodePrefab)));
				val4.transform.parent = ((Component)this).transform;
				val4.transform.position = positions[j];
				if (j == linkCount - 1 && (Object)(object)endPoint != (Object)null)
				{
					val4.transform.rotation = endPoint.rotation;
					ref Quaternion reference2 = ref nodeRotations[j];
					reference2 = endPoint.rotation;
				}
				else
				{
					val4.transform.rotation = Quaternion.LookRotation(val3, startPoint.up);
					ref Quaternion reference3 = ref nodeRotations[j];
					reference3 = val4.transform.rotation;
				}
				nodeObjects[j] = val4;
				nodeRotationClamped[j] = false;
			}
		}

		private void Update()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: 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_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: 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_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: 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_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			if (positions == null || positions.Length != linkCount)
			{
				InitializeChain();
				return;
			}
			Vector3 position = startPoint.position;
			if (isHeld && (Object)(object)endPoint != (Object)null)
			{
				currentEndPosition = endPoint.position;
				isFullyRetracted = false;
			}
			else
			{
				if (isFullyRetracted)
				{
					for (int i = 0; i < linkCount; i++)
					{
						positions[i] = position;
						previousPositions[i] = position;
						if (nodeObjects != null && (Object)(object)nodeObjects[i] != (Object)null)
						{
							nodeObjects[i].SetActive(false);
						}
					}
					if ((Object)(object)line != (Object)null)
					{
						for (int j = 0; j < linkCount; j++)
						{
							line.SetPosition(j, position);
						}
					}
					return;
				}
				currentEndPosition = Vector3.MoveTowards(currentEndPosition, position, retractSpeed * Time.deltaTime);
				if (Vector3.Distance(currentEndPosition, position) < fullyRetractedThreshold)
				{
					currentEndPosition = position;
					isFullyRetracted = true;
					SetAllNodesHidden(hidden: true);
				}
			}
			Vector3 val = currentEndPosition - position;
			float num = (float)(linkCount - 1) * restDistance;
			if (((Vector3)(ref val)).magnitude > num)
			{
				val = ((Vector3)(ref val)).normalized * num;
				currentEndPosition = position + val;
			}
			float num2 = Mathf.Min(Time.deltaTime, maxDeltaTime);
			positions[0] = position;
			ref Vector3 reference = ref previousPositions[0];
			reference = positions[0];
			for (int k = 1; k < linkCount; k++)
			{
				Vector3 val2 = (positions[k] - previousPositions[k]) * damping;
				Vector3 val3 = positions[k] + val2 + gravity * num2 * num2;
				ref Vector3 reference2 = ref previousPositions[k];
				reference2 = positions[k];
				positions[k] = val3;
			}
			int num3 = linkCount - 1;
			ref Vector3 reference3 = ref positions[num3];
			reference3 = currentEndPosition;
			ref Vector3 reference4 = ref previousPositions[num3];
			reference4 = positions[num3];
			for (int l = 0; l < constraintIterations; l++)
			{
				positions[0] = position;
				ref Vector3 reference5 = ref previousPositions[0];
				reference5 = positions[0];
				ref Vector3 reference6 = ref positions[num3];
				reference6 = currentEndPosition;
				ref Vector3 reference7 = ref previousPositions[num3];
				reference7 = positions[num3];
				for (int m = 0; m < linkCount - 1; m++)
				{
					ApplyDistanceConstraint(m, m + 1, restDistance);
				}
			}
			if (isFullyRetracted)
			{
				SetAllNodesHidden(hidden: false);
				isFullyRetracted = false;
			}
		}

		private void LateUpdate()
		{
			UpdateLineRenderer();
			UpdateNodeTransforms();
		}

		private void ApplyDistanceConstraint(int indexA, int indexB, float targetDistance)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = positions[indexB] - positions[indexA];
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude < 0.0001f)
			{
				((Vector3)(ref val))..ctor(0f, 0.01f, 0f);
				magnitude = ((Vector3)(ref val)).magnitude;
			}
			float num = magnitude - targetDistance;
			Vector3 val2 = val / magnitude * (num * 0.5f * stiffness);
			if (indexA != 0)
			{
				ref Vector3 reference = ref positions[indexA];
				reference += val2;
			}
			if (indexB != linkCount - 1)
			{
				ref Vector3 reference2 = ref positions[indexB];
				reference2 -= val2;
			}
		}

		private void UpdateLineRenderer()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)line == (Object)null) && positions != null)
			{
				for (int i = 0; i < positions.Length; i++)
				{
					line.SetPosition(i, positions[i]);
				}
			}
		}

		private void UpdateNodeTransforms()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_0106: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: 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_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: 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_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: 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_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: 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_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_0659: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: 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)
			if (nodeObjects == null || positions == null || nodeRotations == null || nodeRotationClamped == null)
			{
				return;
			}
			if (isFullyRetracted)
			{
				for (int i = 0; i < linkCount; i++)
				{
					if ((Object)(object)nodeObjects[i] != (Object)null && nodeObjects[i].activeSelf)
					{
						nodeObjects[i].SetActive(false);
					}
				}
				return;
			}
			Quaternion val;
			if (isHeld && bindEndRotation && (Object)(object)endPoint != (Object)null)
			{
				val = endPoint.rotation;
			}
			else
			{
				Vector3 val2 = currentEndPosition - startPoint.position;
				Vector3 val3 = ((Vector3)(ref val2)).normalized;
				if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f)
				{
					val3 = startPoint.forward;
				}
				val = Quaternion.LookRotation(val3, startPoint.up);
			}
			ref Quaternion reference = ref nodeRotations[0];
			reference = startPoint.rotation;
			nodeRotationClamped[0] = false;
			for (int j = 1; j < linkCount; j++)
			{
				if ((Object)(object)nodeObjects[j] == (Object)null && j != 0)
				{
					continue;
				}
				if ((Object)(object)nodeObjects[j] != (Object)null)
				{
					nodeObjects[j].transform.position = positions[j];
					if (nodeObjects[j].transform.localPosition.y > upnum)
					{
						nodeObjects[j].transform.localPosition = new Vector3(nodeObjects[j].transform.localPosition.x, upnum, nodeObjects[j].transform.localPosition.z);
					}
					if (nodeObjects[j].transform.localPosition.y < 0f)
					{
						nodeObjects[j].transform.localPosition = new Vector3(nodeObjects[j].transform.localPosition.x, 0f, nodeObjects[j].transform.localPosition.z);
					}
					if (nodeObjects[j].transform.localPosition.x > fore)
					{
						nodeObjects[j].transform.localPosition = new Vector3(fore, nodeObjects[j].transform.localPosition.y, nodeObjects[j].transform.localPosition.z);
					}
					if (nodeObjects[j].transform.localPosition.x < rear)
					{
						nodeObjects[j].transform.localPosition = new Vector3(rear, nodeObjects[j].transform.localPosition.y, nodeObjects[j].transform.localPosition.z);
					}
				}
				Vector3 val5;
				if (j < linkCount - 1)
				{
					Vector3 val4 = positions[j + 1] - positions[j];
					val5 = ((Vector3)(ref val4)).normalized;
				}
				else
				{
					Vector3 val6 = positions[j] - positions[j - 1];
					val5 = ((Vector3)(ref val6)).normalized;
				}
				if (((Vector3)(ref val5)).sqrMagnitude < 0.0001f)
				{
					val5 = nodeRotations[j - 1] * Vector3.forward;
				}
				float num = ((linkCount <= 1) ? 0f : ((float)j / (float)(linkCount - 1)));
				Quaternion val7 = Quaternion.Slerp(startPoint.rotation, val, num);
				Vector3 val8 = val7 * Vector3.up;
				Vector3.OrthoNormalize(ref val5, ref val8);
				Quaternion val9 = Quaternion.LookRotation(val5, val8);
				Quaternion val10 = Quaternion.Inverse(nodeRotations[j - 1]) * val9;
				Vector3 eulerAngles = ((Quaternion)(ref val10)).eulerAngles;
				float num2 = Mathf.DeltaAngle(0f, eulerAngles.x);
				float num3 = Mathf.DeltaAngle(0f, eulerAngles.y);
				float num4 = Mathf.DeltaAngle(0f, eulerAngles.z);
				float num5 = Mathf.Clamp(num2, 0f - maxBendAngleX, maxBendAngleX);
				float num6 = Mathf.Clamp(num3, 0f - maxBendAngleY, maxBendAngleY);
				float num7 = num4;
				if (maxTwistAngleZ < 180f)
				{
					num7 = Mathf.Clamp(num4, 0f - maxTwistAngleZ, maxTwistAngleZ);
				}
				bool flag = num5 != num2 || num6 != num3 || num7 != num4;
				nodeRotationClamped[j] = flag;
				Quaternion val11 = Quaternion.Euler(num5, num6, num7);
				ref Quaternion reference2 = ref nodeRotations[j];
				reference2 = nodeRotations[j - 1] * val11;
				if (j == linkCount - 1 && isHeld && bindEndRotation && (Object)(object)endPoint != (Object)null)
				{
					int num8 = linkCount - 2;
					ref Quaternion reference3 = ref nodeRotations[j];
					reference3 = endPoint.rotation;
				}
				if ((Object)(object)nodeObjects[j] != (Object)null)
				{
					nodeObjects[j].transform.rotation = nodeRotations[j];
				}
				bool flag2 = startPoint.InverseTransformPoint(positions[j]).z < hideBehindStartZ;
				if ((Object)(object)nodeObjects[j] != (Object)null && nodeObjects[j].activeSelf == flag2)
				{
					nodeObjects[j].SetActive(!flag2);
				}
			}
		}

		private void SetAllNodesHidden(bool hidden)
		{
			if (nodeObjects == null)
			{
				return;
			}
			GameObject[] array = nodeObjects;
			foreach (GameObject val in array)
			{
				if ((Object)(object)val != (Object)null && val.activeSelf != !hidden)
				{
					val.SetActive(!hidden);
				}
			}
		}

		public void SetHeld(bool held)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_006f: 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)
			//IL_0079: 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_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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			isHeld = held;
			if (held && isFullyRetracted)
			{
				if ((Object)(object)endPoint != (Object)null)
				{
					currentEndPosition = endPoint.position;
				}
				else
				{
					currentEndPosition = startPoint.position + startPoint.forward * restDistance * (float)(linkCount - 1);
				}
				isFullyRetracted = false;
				SetAllNodesHidden(hidden: false);
				Vector3 position = startPoint.position;
				for (int i = 0; i < linkCount; i++)
				{
					float num = ((linkCount <= 1) ? 0f : ((float)i / (float)(linkCount - 1)));
					ref Vector3 reference = ref positions[i];
					reference = Vector3.Lerp(position, currentEndPosition, num);
					ref Vector3 reference2 = ref previousPositions[i];
					reference2 = positions[i];
					nodeRotationClamped[i] = false;
				}
			}
		}
	}
	public class BeltGrabSystem : MonoBehaviour
	{
		public KillAfter ka;

		public AmmoBeltChain Belt;

		public FVRFireArmMagazine mag;

		public Transform magpos;

		public float fore;

		public float rear;

		public float up;

		public float down;

		public float left;

		public float right;

		public GameObject geo;

		public GameObject endpiece;

		public GameObject endpos;

		public FVRInteractiveObject Grab;

		public FVRFireArmAttachment att;

		public bool isAtt = false;

		public float cd = 5f;

		private void Update()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: 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_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: 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_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: 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_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0731: Unknown result type (might be due to invalid IL or missing references)
			//IL_0736: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_075a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)att == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			if (!((Object)(object)att != (Object)null))
			{
				return;
			}
			if (cd <= 0f)
			{
				((Component)att).gameObject.transform.localScale = Vector3.Lerp(((Component)att).gameObject.transform.localScale, new Vector3(0.0001f, 0.0001f, 0.0001f), Time.deltaTime * 5f);
			}
			if ((Object)(object)mag.FireArm == (Object)null)
			{
				((Component)mag).gameObject.transform.SetParent(magpos);
			}
			if ((Object)(object)mag == (Object)null && (Object)(object)((Component)this).gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			if (Grab.m_isHeld || (Object)(object)mag.FireArm != (Object)null)
			{
				geo.SetActive(true);
				Belt.isHeld = true;
				Belt.SetHeld(held: true);
			}
			if (Grab.m_isHeld)
			{
				if ((Object)(object)mag.FireArm == (Object)null)
				{
					((Component)mag).gameObject.transform.position = ((Component)Grab.m_hand).gameObject.transform.position;
					((Component)mag).gameObject.transform.rotation = ((Component)Grab.m_hand).gameObject.transform.rotation;
				}
				Belt.bindEndRotation = false;
			}
			if ((Object)(object)mag.FireArm != (Object)null)
			{
				Belt.bindEndRotation = true;
			}
			if (!Grab.m_isHeld && (Object)(object)mag.FireArm == (Object)null)
			{
				((Component)mag).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
				((Component)mag).gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				Belt.isHeld = false;
				Belt.SetHeld(held: false);
				Belt.bindEndRotation = false;
				if (Vector3.Distance(endpiece.transform.position, endpos.transform.position) < 0.005f)
				{
					geo.SetActive(false);
				}
			}
			if (mag.m_numRounds > 0)
			{
				Grab.IsSimpleInteract = false;
			}
			if (mag.m_numRounds <= 0)
			{
				Grab.IsSimpleInteract = true;
				Grab.ForceBreakInteraction();
				if ((Object)(object)att.curMount == (Object)null)
				{
					cd -= Time.deltaTime;
					((FVRInteractiveObject)att).IsSimpleInteract = true;
					((FVRInteractiveObject)att).ForceBreakInteraction();
					((FVRPhysicalObject)att).DistantGrabbable = false;
					((Behaviour)ka).enabled = true;
				}
			}
			if ((Object)(object)att.curMount != (Object)null)
			{
				if (!isAtt && att.curMount.EnableOnHover.transform.localPosition.y < -0.03f)
				{
					isAtt = true;
				}
				if (isAtt && att.curMount.EnableOnHover.transform.localPosition.y > 0.01f)
				{
					isAtt = false;
					att.curMount.DisableOnHover.SetActive(true);
					att.DetachFromMount();
				}
			}
			if ((Object)(object)mag.FireArm == (Object)null)
			{
				if (((Component)mag).gameObject.transform.localPosition.x > right)
				{
					((Component)mag).gameObject.transform.localPosition = new Vector3(right, ((Component)mag).gameObject.transform.localPosition.y, ((Component)mag).gameObject.transform.localPosition.z);
				}
				if (((Component)mag).gameObject.transform.localPosition.x < left)
				{
					((Component)mag).gameObject.transform.localPosition = new Vector3(left, ((Component)mag).gameObject.transform.localPosition.y, ((Component)mag).gameObject.transform.localPosition.z);
				}
				if (((Component)mag).gameObject.transform.localPosition.z > fore)
				{
					((Component)mag).gameObject.transform.localPosition = new Vector3(((Component)mag).gameObject.transform.localPosition.x, ((Component)mag).gameObject.transform.localPosition.y, fore);
				}
				if (((Component)mag).gameObject.transform.localPosition.z < rear)
				{
					((Component)mag).gameObject.transform.localPosition = new Vector3(((Component)mag).gameObject.transform.localPosition.x, ((Component)mag).gameObject.transform.localPosition.y, rear);
				}
				if (((Component)mag).gameObject.transform.localPosition.y > up)
				{
					((Component)mag).gameObject.transform.localPosition = new Vector3(((Component)mag).gameObject.transform.localPosition.x, up, ((Component)mag).gameObject.transform.localPosition.z);
				}
				if (((Component)mag).gameObject.transform.localPosition.y < down)
				{
					((Component)mag).gameObject.transform.localPosition = new Vector3(((Component)mag).gameObject.transform.localPosition.x, down, ((Component)mag).gameObject.transform.localPosition.z);
				}
			}
		}
	}
	public class DisableIfFilter : MonoBehaviour
	{
		public MeshRenderer R;

		public GameObject linkgeo;

		private void Update()
		{
			if ((Object)(object)((Renderer)R).material != (Object)null && ((Renderer)R).enabled)
			{
				linkgeo.SetActive(true);
			}
			if ((Object)(object)((Renderer)R).material == (Object)null || !((Renderer)R).enabled)
			{
				linkgeo.SetActive(false);
			}
		}
	}
	public class FlipPart : MonoBehaviour
	{
		public FVRInteractiveObject grab;

		public GameObject part;

		public GameObject refrot;

		public float uplimit;

		public float lowlimit;

		public AudioEvent open;

		public AudioEvent top;

		public AudioEvent close;

		public float rot;

		public bool isopen = false;

		public GameObject refpos;

		public bool istop = false;

		private void Update()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: 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_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: 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_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			part.transform.localEulerAngles = new Vector3(rot, 0f, 0f);
			rot = Mathf.Clamp(rot, lowlimit, uplimit);
			if (!istop && part.transform.localEulerAngles.x < uplimit - 5f)
			{
				istop = true;
			}
			if (istop && part.transform.localEulerAngles.x >= uplimit - 5f)
			{
				rot = uplimit;
				refrot.transform.localEulerAngles = new Vector3(uplimit, 0f, 0f);
				part.transform.localEulerAngles = new Vector3(uplimit, 0f, 0f);
				grab.ForceBreakInteraction();
				SM.PlayCoreSound((FVRPooledAudioType)41, top, part.transform.position);
				istop = false;
			}
			if (!isopen && part.transform.localEulerAngles.x > lowlimit + 5f)
			{
				SM.PlayCoreSound((FVRPooledAudioType)41, open, part.transform.position);
				isopen = true;
			}
			if (isopen && part.transform.localEulerAngles.x < lowlimit + 5f)
			{
				rot = lowlimit;
				refrot.transform.localEulerAngles = new Vector3(lowlimit, 0f, 0f);
				part.transform.localEulerAngles = new Vector3(lowlimit, 0f, 0f);
				grab.ForceBreakInteraction();
				SM.PlayCoreSound((FVRPooledAudioType)41, close, part.transform.position);
				isopen = false;
			}
			if (part.transform.localEulerAngles.x > uplimit && part.transform.localEulerAngles.x <= 90f)
			{
				part.transform.localEulerAngles = new Vector3(uplimit, 0f, 0f);
			}
			if (part.transform.localEulerAngles.x > 90f && part.transform.localEulerAngles.x < 180f)
			{
				part.transform.localEulerAngles = new Vector3(uplimit, 0f, 0f);
			}
			if (part.transform.localEulerAngles.x > 180f && part.transform.localEulerAngles.x < 270f)
			{
				part.transform.localEulerAngles = new Vector3(uplimit, 0f, 0f);
			}
			if (part.transform.localEulerAngles.x < lowlimit && part.transform.localEulerAngles.x >= 0f)
			{
				part.transform.localEulerAngles = new Vector3(lowlimit, 0f, 0f);
			}
			if (part.transform.localEulerAngles.x < 360f && part.transform.localEulerAngles.x >= 270f)
			{
				part.transform.localEulerAngles = new Vector3(lowlimit, 0f, 0f);
			}
			if (!grab.m_isHeld)
			{
				refpos.transform.localPosition = new Vector3(0f, 0f, 0f);
				refrot.transform.localEulerAngles = part.transform.localEulerAngles;
			}
			if (grab.m_isHeld)
			{
				refpos.transform.position = ((Component)grab.m_hand).gameObject.transform.position;
				if (refpos.transform.localPosition.z >= 0f)
				{
					AxisLookAt(refrot.transform, ((Component)grab.m_hand).gameObject.transform.position, Vector3.forward);
				}
				if (refpos.transform.localPosition.z < 0f)
				{
					refrot.transform.localEulerAngles = new Vector3(uplimit, 0f, 0f);
				}
				if (refrot.transform.localEulerAngles.x <= uplimit && refrot.transform.localEulerAngles.x >= lowlimit)
				{
					rot = refrot.transform.localEulerAngles.x;
				}
			}
		}

		private void AxisLookAt(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_006a: 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, 0f, 0f);
		}
	}
	public class LootAt : MonoBehaviour
	{
		public GameObject obj;

		public GameObject tar;

		private void AxisLookAt(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_006a: 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, 0f, 0f);
		}

		private void Update()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			AxisLookAt(obj.transform, tar.transform.position, Vector3.forward);
		}
	}
	public class OpenBOltBeltFed : MonoBehaviour
	{
		public WaggleJoint wag;

		public AR15HandleSightFlipper sight;

		public FVRFireArmAttachmentMount topm;

		public OpenBoltReceiver gun;

		public GameObject link;

		public Transform linkport;

		public GameObject cover;

		public FlipPart tray;

		public int randomnum;

		public bool isTroll;

		public bool Stop;

		public bool NonStop;

		public int numfired;

		public Collider magwellcol;

		public Collider boxmountcol;

		public Mac11_Stock boxposgrab;

		public GameObject trigflag;

		public FVRFireArmAttachmentMount boxmount;

		public float plus;

		public float minus;

		public float minus2;

		public Collider maggrab;

		public AudioEvent mal;

		private void OnShotFired(FVRFireArm firearm)
		{
			//IL_0024: 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)
			if ((Object)(object)firearm == (Object)(object)gun)
			{
				Object.Instantiate<GameObject>(link, ((Component)linkport).transform.position, ((Component)linkport).transform.rotation);
				if (!Stop && !NonStop)
				{
					numfired++;
					randomnum = Random.Range(0, 100);
				}
			}
		}

		private void Awake()
		{
			//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);
		}

		private void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: 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_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_063d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: 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_066e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: 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_079a: Unknown result type (might be due to invalid IL or missing references)
			//IL_079f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_080c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0811: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_082a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0727: Unknown result type (might be due to invalid IL or missing references)
			//IL_086a: Unknown result type (might be due to invalid IL or missing references)
			//IL_086f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0854: Unknown result type (might be due to invalid IL or missing references)
			//IL_0941: Unknown result type (might be due to invalid IL or missing references)
			//IL_0946: Unknown result type (might be due to invalid IL or missing references)
			//IL_088d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0892: Unknown result type (might be due to invalid IL or missing references)
			//IL_0964: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0903: Unknown result type (might be due to invalid IL or missing references)
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			if (cover.transform.localEulerAngles.x > 5f)
			{
				wag.useSpring = false;
			}
			if (cover.transform.localEulerAngles.x <= 5f)
			{
				wag.useSpring = true;
			}
			if (topm.HasAttachmentsOnIt())
			{
				sight.m_isLargeAperture = false;
			}
			if (!topm.HasAttachmentsOnIt())
			{
				sight.m_isLargeAperture = true;
			}
			if (trigflag.activeSelf)
			{
				((Component)boxposgrab).gameObject.transform.localPosition = new Vector3(((Component)boxposgrab).gameObject.transform.localPosition.x, ((Component)boxposgrab).gameObject.transform.localPosition.y, boxposgrab.ForwardPos.localPosition.z + minus);
				tray.lowlimit = 0f;
			}
			if (((FVRInteractiveObject)gun).m_isHeld)
			{
				if (tray.part.transform.localEulerAngles.x >= 75f)
				{
					((FVRInteractiveObject)boxposgrab).IsSimpleInteract = false;
				}
				if (tray.part.transform.localEulerAngles.x < 75f)
				{
					((FVRInteractiveObject)boxposgrab).IsSimpleInteract = true;
					((FVRInteractiveObject)boxposgrab).ForceBreakInteraction();
				}
				if (tray.part.transform.localEulerAngles.x >= 75f && (Object)(object)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable != (Object)null && Object.op_Implicit((Object)(object)((Component)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable).gameObject.GetComponent<FVRFireArmAttachment>()) && ((Component)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable).gameObject.GetComponent<FVRFireArmAttachment>().Type == boxmount.Type)
				{
					boxmountcol.enabled = true;
				}
				if (tray.part.transform.localEulerAngles.x < 75f || boxmount.AttachmentsList.Count > 0)
				{
					boxmountcol.enabled = false;
				}
			}
			if (!((FVRInteractiveObject)gun).m_isHeld)
			{
				((FVRInteractiveObject)boxposgrab).IsSimpleInteract = true;
				boxmountcol.enabled = false;
				((FVRInteractiveObject)boxposgrab).ForceBreakInteraction();
			}
			if (!trigflag.activeSelf)
			{
				if (((Component)boxposgrab).gameObject.transform.localPosition.z >= boxposgrab.ForwardPos.localPosition.z + minus2 && (Object)(object)((FVRFireArm)gun).Magazine != (Object)null && ((FVRFireArm)gun).Magazine.m_numRounds <= 0)
				{
					((FVRInteractiveObject)boxposgrab).ForceBreakInteraction();
				}
				if (((FVRInteractiveObject)gun).m_isHeld && (Object)(object)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable != (Object)null && (Object)(object)((Component)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable).gameObject.GetComponent<FVRFireArmAttachment>() != (Object)null && ((Component)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable).gameObject.GetComponent<FVRFireArmAttachment>().Type == boxmount.Type && ((FVRInteractiveObject)((Component)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable).gameObject.GetComponent<FVRFireArmAttachment>()).m_isHeld)
				{
					((FVRInteractiveObject)((Component)((FVRInteractiveObject)gun).m_hand.OtherHand.m_currentInteractable).gameObject.GetComponent<FVRFireArmAttachment>()).ForceBreakInteraction();
					if ((Object)(object)((FVRInteractiveObject)gun).m_hand != (Object)null)
					{
						((FVRInteractiveObject)boxposgrab).BeginInteraction(((FVRInteractiveObject)gun).m_hand.OtherHand);
						((FVRInteractiveObject)gun).m_hand.OtherHand.ForceSetInteractable((FVRInteractiveObject)(object)boxposgrab);
					}
				}
				if (((Component)boxposgrab).gameObject.transform.localPosition.z < boxposgrab.RearPos.localPosition.z + plus)
				{
					tray.lowlimit = 0f;
				}
				if (((Component)boxposgrab).gameObject.transform.localPosition.z >= boxposgrab.RearPos.localPosition.z + plus)
				{
					tray.lowlimit = 75f;
				}
			}
			if (cover.transform.localEulerAngles.x > 1f)
			{
				tray.uplimit = cover.transform.localEulerAngles.x;
			}
			if (cover.transform.localEulerAngles.x < 1f || (Object)(object)((FVRFireArm)gun).Magazine != (Object)null)
			{
				tray.grab.ForceBreakInteraction();
				tray.uplimit = 0f;
				tray.part.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			}
			if (((Component)tray).transform.localEulerAngles.x >= 75f)
			{
				boxmountcol.enabled = true;
			}
			if (((Component)tray).transform.localEulerAngles.x < 75f)
			{
				boxmountcol.enabled = false;
			}
			if (numfired >= Random.Range(250, 300))
			{
				if (randomnum >= 90 && !Stop)
				{
					SM.PlayCoreSound((FVRPooledAudioType)20, mal, ((Component)gun).gameObject.transform.position);
					Stop = true;
				}
				if (randomnum <= 10 && !NonStop)
				{
					SM.PlayCoreSound((FVRPooledAudioType)20, mal, ((Component)gun).gameObject.transform.position);
					NonStop = true;
				}
				if (randomnum > 10 && randomnum >= 90)
				{
				}
			}
			if (Stop)
			{
				gun.FireSelector_Modes[0].ModeType = (FireSelectorModeType)0;
				gun.EngageSeer();
			}
			if (NonStop && cover.transform.localEulerAngles.x < 10f)
			{
				gun.ReleaseSeer();
			}
			if ((Object)(object)((FVRFireArm)gun).Magazine != (Object)null && ((FVRFireArm)gun).Magazine.m_numRounds <= 0)
			{
				((FVRFireArm)gun).EjectMag(true);
			}
			if (tray.part.transform.localEulerAngles.x > cover.transform.localEulerAngles.x)
			{
				tray.part.transform.localEulerAngles = cover.transform.localEulerAngles;
			}
			if (cover.transform.localEulerAngles.x > 45f && cover.transform.localEulerAngles.x <= 90f)
			{
				gun.EngageSeer();
				if (tray.part.transform.localEulerAngles.x < 1f)
				{
					maggrab.enabled = true;
					magwellcol.enabled = true;
				}
				if (tray.part.transform.localEulerAngles.x >= 1f)
				{
					maggrab.enabled = false;
					magwellcol.enabled = false;
				}
			}
			if (cover.transform.localEulerAngles.x <= 45f && cover.transform.localEulerAngles.x >= 0f)
			{
				maggrab.enabled = false;
				magwellcol.enabled = 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);
		}
	}
	public class SpitLink : MonoBehaviour
	{
		public Rigidbody rig;

		private void Start()
		{
			//IL_0007: 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)
			rig.AddRelativeForce(Vector3.right * Random.Range(2.5f, 5f), (ForceMode)2);
		}
	}
}
namespace JerryAr.M60E46
{
	[BepInPlugin("JerryAr.M60E46", "M60E46", "1.2.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class M60E46Plugin : 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.M60E46");
			OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.M60E46", "", "", "m60e46", "");
		}
	}
}
public class SnapToPoint : MonoBehaviour
{
	public GameObject Obj;

	public GameObject Targ;

	private void Start()
	{
	}

	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)
		Obj.transform.position = Targ.transform.position;
		Obj.transform.rotation = Targ.transform.rotation;
	}
}
namespace JerryComponent
{
	public class RealFosbery : MonoBehaviour
	{
		public GameObject arm;

		public GameObject explospos;

		public Revolver gun;

		public GameObject frame;

		public GameObject safety;

		public Collider grab;

		public FVRInteractiveObject obj;

		public GameObject refp;

		public GameObject holder;

		public AudioEvent cock;

		public float zref;

		public Collider Explos;

		public void OnTriggerStay(Collider other)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)other).gameObject.GetComponent<FVRFireArmRound>() != (Object)null && (Object)(object)((Component)other).gameObject.GetComponent<Rigidbody>() != (Object)null)
			{
				((Component)other).gameObject.GetComponent<Rigidbody>().AddExplosionForce(1f, explospos.transform.position, 0.1f);
			}
		}

		private void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			if (arm.transform.localEulerAngles.x > 45f && arm.transform.localEulerAngles.x < 75f)
			{
				Explos.enabled = true;
			}
			else if (arm.transform.localEulerAngles.x < 45f || arm.transform.localEulerAngles.x > 75f)
			{
				Explos.enabled = false;
			}
			frame.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			if (gun.m_isCylinderArmLocked && !gun.m_isHammerLocked)
			{
				grab.enabled = true;
				frame.transform.localPosition = new Vector3(0f, 0f, Mathf.Clamp(frame.transform.localPosition.z, -0.0229f, 0f));
			}
			if (gun.m_isHammerLocked)
			{
				if (obj.IsHeld)
				{
					obj.ForceBreakInteraction();
				}
				grab.enabled = false;
			}
			if (!gun.m_isCylinderArmLocked || safety.transform.localEulerAngles.x > 15f)
			{
				if (obj.IsHeld)
				{
					obj.ForceBreakInteraction();
				}
				grab.enabled = false;
				frame.transform.localPosition = new Vector3(0f, 0f, 0f);
				gun.m_isHammerLocked = false;
			}
			if (frame.transform.localPosition.z <= -0.02f && !gun.m_isHammerLocked)
			{
				gun.m_isHammerLocked = true;
				SM.PlayCoreSound((FVRPooledAudioType)41, cock, ((Component)this).transform.position);
			}
			if (obj.IsHeld && ((Component)obj).transform.localPosition.z <= ((Component)gun.RecockingPoint_Forward).transform.localPosition.z && ((Component)obj).transform.localPosition.z >= ((Component)gun.RecockingPoint_Rearward).transform.localPosition.z)
			{
				frame.transform.localPosition = new Vector3(0f, 0f, ((Component)obj).transform.localPosition.z);
			}
			if (!obj.IsHeld)
			{
				((Component)obj).transform.localPosition = new Vector3(0f, 0f, 0f);
				frame.transform.localPosition = new Vector3(0f, 0f, Mathf.SmoothDamp(frame.transform.localPosition.z, 0f, ref zref, 0.1f));
			}
		}
	}
	public class SnapToPointRigidbody : MonoBehaviour
	{
		public Transform snapTo;

		[NonSerialized]
		private Rigidbody body;

		public float snapTime = 2f;

		[NonSerialized]
		private float dropTimer;

		public void Start()
		{
			body = ((Component)this).GetComponent<Rigidbody>();
		}

		public void FixedUpdate()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)snapTo == (Object)null && (Object)(object)((Component)this).gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			dropTimer += Time.deltaTime / (snapTime / 2f);
			body.isKinematic = dropTimer > 1f;
			if (dropTimer > 1f)
			{
				((Component)this).transform.position = snapTo.position;
				((Component)this).transform.rotation = snapTo.rotation;
				return;
			}
			float num = Mathf.Pow(35f, dropTimer);
			body.velocity = Vector3.Lerp(body.velocity, Vector3.zero, Time.fixedDeltaTime * 4f);
			if (body.useGravity)
			{
				body.AddForce(-Physics.gravity);
			}
			((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, snapTo.position, Time.fixedDeltaTime * num * 3f);
			((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, snapTo.rotation, Time.fixedDeltaTime * num * 2f);
		}
	}
	public class WebleyLoader : MonoBehaviour
	{
		public GameObject phys;

		public GameObject hooks;

		public Speedloader mag;

		public bool empty = false;

		public SnapToPointRigidbody snap;

		public SnapToPointRigidbody snap2;

		public Rigidbody main;

		public bool pressed = false;

		private void OnTriggerStay(Collider other)
		{
			if (!empty && (Object)(object)((Component)other).gameObject.GetComponent<RevolverCylinder>() != (Object)null)
			{
				pressed = true;
			}
		}

		private void Update()
		{
			//IL_001b: 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_004a: 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_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			hooks.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			hooks.transform.localPosition = new Vector3(0f, 0f, Mathf.Clamp(hooks.transform.localPosition.z, -0.01559f, 0.0103f));
			if (!mag.Chambers[0].IsLoaded && !mag.Chambers[1].IsLoaded && !mag.Chambers[2].IsLoaded && !mag.Chambers[3].IsLoaded && !mag.Chambers[4].IsLoaded && !mag.Chambers[5].IsLoaded)
			{
				empty = true;
			}
			if (mag.Chambers[0].IsLoaded || mag.Chambers[1].IsLoaded || mag.Chambers[2].IsLoaded || mag.Chambers[3].IsLoaded || mag.Chambers[4].IsLoaded || mag.Chambers[5].IsLoaded)
			{
				empty = false;
			}
			if (empty)
			{
				pressed = false;
				((Behaviour)snap).enabled = true;
				phys.SetActive(false);
			}
			if (!empty)
			{
				((Behaviour)snap).enabled = false;
				if (pressed)
				{
					((Behaviour)snap2).enabled = false;
				}
				else if (!pressed)
				{
					((Behaviour)snap2).enabled = true;
					((Behaviour)snap).enabled = false;
				}
				if (hooks.transform.localPosition.z < 0.01f)
				{
					hooks.transform.localPosition = new Vector3(0f, 0f, hooks.transform.localPosition.z + 0.5f * Time.deltaTime);
				}
				phys.SetActive(true);
			}
			if (((Behaviour)snap).enabled || ((Behaviour)snap2).enabled)
			{
				main.isKinematic = true;
			}
			else if (!((Behaviour)snap).enabled && !((Behaviour)snap2).enabled)
			{
				main.isKinematic = false;
			}
		}
	}
	public class control_component : MonoBehaviour
	{
		public GameObject Comp;

		public GameObject Comp2;

		public GameObject Rot;

		private bool is45;

		public bool changed;

		private void Start()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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)
			if (Rot.transform.localEulerAngles.x > 45f)
			{
				is45 = true;
			}
			if (Rot.transform.localEulerAngles.x < 45f)
			{
				is45 = false;
			}
		}

		private void over45()
		{
			if (is45)
			{
				Comp.SetActive(false);
				Comp2.SetActive(true);
				changed = true;
				changed = false;
			}
			is45 = false;
		}

		private void under45()
		{
			if (!is45)
			{
				Comp2.SetActive(false);
				Comp.SetActive(true);
				changed = true;
				changed = false;
			}
			is45 = true;
		}

		private void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (Rot.transform.localEulerAngles.x > 45f)
			{
				over45();
			}
			if (Rot.transform.localEulerAngles.x < 45f)
			{
				under45();
			}
		}
	}
}