Decompiled source of OpenScripts2 v2.9.2

plugins/OpenScripts2.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using IL;
using IL.FistVR;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On;
using On.FistVR;
using OpenScripts2;
using Popcron;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Serialization;
using UnityEngine.UI;
using Valve.VR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("OpenScripts2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenScripts2")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("db04f669-7223-4552-9745-c06832a51db2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace System.Collections.Generic
{
	public static class CSharpExtensions
	{
		public static string ToCSV<T>(this IEnumerable<T> enumerable)
		{
			if (enumerable == null || !enumerable.Any())
			{
				return string.Empty;
			}
			return string.Join(",", enumerable.Select((T item) => item.ToString()).ToArray());
		}

		public static void AddOrReplace<T, U>(this Dictionary<T, U> dic, T key, U value)
		{
			if (!dic.ContainsKey(key))
			{
				dic.Add(key, value);
			}
			else
			{
				dic[key] = value;
			}
		}
	}
}
namespace UnityEngine
{
	public static class UnityEngineExtensions
	{
		public static T GetComponentInDirectChildren<T>(this Component parent) where T : Component
		{
			return parent.GetComponentInDirectChildren<T>(includeInactive: false);
		}

		public static T GetComponentInDirectChildren<T>(this Component parent, bool includeInactive) where T : Component
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			foreach (Transform item in parent.transform)
			{
				Transform val = item;
				if (includeInactive || ((Component)val).gameObject.activeInHierarchy)
				{
					T component = ((Component)val).GetComponent<T>();
					if ((Object)(object)component != (Object)null)
					{
						return component;
					}
				}
			}
			return default(T);
		}

		public static T[] GetComponentsInDirectChildren<T>(this Component parent) where T : Component
		{
			return parent.GetComponentsInDirectChildren<T>(includeInactive: false);
		}

		public static T[] GetComponentsInDirectChildren<T>(this Component parent, bool includeInactive) where T : Component
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			List<T> list = new List<T>();
			foreach (Transform item in parent.transform)
			{
				Transform val = item;
				if (includeInactive || ((Component)val).gameObject.activeInHierarchy)
				{
					list.AddRange(((Component)val).GetComponents<T>());
				}
			}
			return list.ToArray();
		}

		public static T GetComponentInSiblings<T>(this Component sibling) where T : Component
		{
			return sibling.GetComponentInSiblings<T>(includeInactive: false);
		}

		public static T GetComponentInSiblings<T>(this Component sibling, bool includeInactive) where T : Component
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			Transform parent = sibling.transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return default(T);
			}
			foreach (Transform item in parent)
			{
				Transform val = item;
				if ((includeInactive || ((Component)val).gameObject.activeInHierarchy) && (Object)(object)val != (Object)(object)sibling)
				{
					T component = ((Component)val).GetComponent<T>();
					if ((Object)(object)component != (Object)null)
					{
						return component;
					}
				}
			}
			return default(T);
		}

		public static T[] GetComponentsInSiblings<T>(this Component sibling) where T : Component
		{
			return sibling.GetComponentsInSiblings<T>(includeInactive: false);
		}

		public static T[] GetComponentsInSiblings<T>(this Component sibling, bool includeInactive) where T : Component
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			Transform parent = sibling.transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return null;
			}
			List<T> list = new List<T>();
			foreach (Transform item in parent)
			{
				Transform val = item;
				if ((includeInactive || ((Component)val).gameObject.activeInHierarchy) && (Object)(object)val != (Object)(object)sibling)
				{
					list.AddRange(((Component)val).GetComponents<T>());
				}
			}
			return list.ToArray();
		}

		public static T GetComponentInDirectParent<T>(this Component child) where T : Component
		{
			Transform parent = child.transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return default(T);
			}
			return ((Component)parent).GetComponent<T>();
		}

		public static T[] GetComponentsInDirectParent<T>(this Component child) where T : Component
		{
			Transform parent = child.transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return null;
			}
			return ((Component)parent).GetComponents<T>();
		}

		public static bool TryGetComponent<T>(this Component mainComponent, out T foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponent<T>();
			return (Object)(object)foundComponent != (Object)null;
		}

		public static bool TryGetComponentInChildren<T>(this Component mainComponent, out T foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentInChildren<T>();
			return (Object)(object)foundComponent != (Object)null;
		}

		public static bool TryGetComponentInParent<T>(this Component mainComponent, out T foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentInParent<T>();
			return (Object)(object)foundComponent != (Object)null;
		}

		public static bool TryGetComponents<T>(this Component mainComponent, out T[] foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponents<T>();
			return foundComponent != null;
		}

		public static bool TryGetComponentsInChildren<T>(this Component mainComponent, out T[] foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentsInChildren<T>();
			return foundComponent != null;
		}

		public static bool TryGetComponentsInParent<T>(this Component mainComponent, out T[] foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentsInParent<T>();
			return foundComponent != null;
		}

		public static bool TryGetComponent<T>(this GameObject mainComponent, out T foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponent<T>();
			return (Object)(object)foundComponent != (Object)null;
		}

		public static bool TryGetComponentInChildren<T>(this GameObject mainComponent, out T foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentInChildren<T>();
			return (Object)(object)foundComponent != (Object)null;
		}

		public static bool TryGetComponentInParent<T>(this GameObject mainComponent, out T foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentInParent<T>();
			return (Object)(object)foundComponent != (Object)null;
		}

		public static bool TryGetComponents<T>(this GameObject mainComponent, out T[] foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponents<T>();
			return foundComponent != null;
		}

		public static bool TryGetComponentsInChildren<T>(this GameObject mainComponent, out T[] foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentsInChildren<T>();
			return foundComponent != null;
		}

		public static bool TryGetComponentsInParent<T>(this GameObject mainComponent, out T[] foundComponent) where T : Component
		{
			foundComponent = mainComponent.GetComponentsInParent<T>();
			return foundComponent != null;
		}

		public static bool IsGreaterThan(this Vector3 local, Vector3 other)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001c: 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)
			if (local.x > other.x && local.y > other.y && local.z > other.z)
			{
				return true;
			}
			return false;
		}

		public static bool IsGreaterThanOrEqual(this Vector3 local, Vector3 other)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001c: 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)
			if (local.x >= other.x && local.y >= other.y && local.z >= other.z)
			{
				return true;
			}
			return false;
		}

		public static bool IsLessThan(this Vector3 local, Vector3 other)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001c: 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)
			if (local.x < other.x && local.y < other.y && local.z < other.z)
			{
				return true;
			}
			return false;
		}

		public static bool IsLessThanOrEqual(this Vector3 local, Vector3 other)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001c: 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)
			if (local.x <= other.x && local.y <= other.y && local.z <= other.z)
			{
				return true;
			}
			return false;
		}

		public static Vector3 Clamp(this Vector3 vector, Vector3 vA, Vector3 vB)
		{
			//IL_0002: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0044: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			vector.x = Mathf.Clamp(vector.x, vA.x, vB.x);
			vector.y = Mathf.Clamp(vector.y, vA.y, vB.y);
			vector.z = Mathf.Clamp(vector.z, vA.z, vB.z);
			return vector;
		}

		public static Vector3 ProjectOnPlaneThroughPoint(this Vector3 vector, Vector3 point, Vector3 planeNormal)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//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_000e: 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)
			return Vector3.ProjectOnPlane(vector, planeNormal) + Vector3.Dot(point, planeNormal) * planeNormal;
		}

		public static Vector3 GetLocalDirAxis(this Transform transform, OpenScripts2_BasePlugin.Axis axis)
		{
			//IL_0015: 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_0023: 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)
			return (Vector3)(axis switch
			{
				OpenScripts2_BasePlugin.Axis.X => transform.right, 
				OpenScripts2_BasePlugin.Axis.Y => transform.up, 
				OpenScripts2_BasePlugin.Axis.Z => transform.forward, 
				_ => Vector3.zero, 
			});
		}

		public static float GetLocalPositionAxisValue(this Transform transform, OpenScripts2_BasePlugin.Axis axis)
		{
			//IL_0015: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			return axis switch
			{
				OpenScripts2_BasePlugin.Axis.X => transform.localPosition.x, 
				OpenScripts2_BasePlugin.Axis.Y => transform.localPosition.y, 
				OpenScripts2_BasePlugin.Axis.Z => transform.localPosition.z, 
				_ => 0f, 
			};
		}

		public static float GetLocalScaleAxisValue(this Transform transform, OpenScripts2_BasePlugin.Axis axis)
		{
			//IL_0015: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			return axis switch
			{
				OpenScripts2_BasePlugin.Axis.X => transform.localScale.x, 
				OpenScripts2_BasePlugin.Axis.Y => transform.localScale.y, 
				OpenScripts2_BasePlugin.Axis.Z => transform.localScale.z, 
				_ => 0f, 
			};
		}

		public static float GetAxisValue(this Vector3 vector, OpenScripts2_BasePlugin.Axis axis)
		{
			return ((Vector3)(ref vector))[(int)axis];
		}

		public static Vector3 GetAxisVector(this Vector3 vector, OpenScripts2_BasePlugin.Axis axis)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			switch (axis)
			{
			case OpenScripts2_BasePlugin.Axis.X:
				zero.x = vector.x;
				break;
			case OpenScripts2_BasePlugin.Axis.Y:
				zero.y = vector.y;
				break;
			case OpenScripts2_BasePlugin.Axis.Z:
				zero.z = vector.z;
				break;
			}
			return zero;
		}

		public static Vector3 GetCombinedAxisVector(this Vector3 vector, OpenScripts2_BasePlugin.Axis axis, Vector3 other)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0027: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			Vector3 result = other;
			switch (axis)
			{
			case OpenScripts2_BasePlugin.Axis.X:
				result.x = vector.x;
				break;
			case OpenScripts2_BasePlugin.Axis.Y:
				result.y = vector.y;
				break;
			case OpenScripts2_BasePlugin.Axis.Z:
				result.z = vector.z;
				break;
			}
			return result;
		}

		public static float GetAxisValue(this Quaternion quaternion, OpenScripts2_BasePlugin.Axis axis)
		{
			//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)
			Vector3 eulerAngles = ((Quaternion)(ref quaternion)).eulerAngles;
			return ((Vector3)(ref eulerAngles))[(int)axis];
		}

		public static Vector3 ModifyAxisValue(this Vector3 vector, OpenScripts2_BasePlugin.Axis axis, float value)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			((Vector3)(ref vector))[(int)axis] = value;
			return vector;
		}

		public static Vector3 RemoveAxisValue(this Vector3 vector, OpenScripts2_BasePlugin.Axis axis)
		{
			//IL_0000: 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)
			return vector.ModifyAxisValue(axis, 0f);
		}

		public static void ModifyLocalTransform(this Transform transform, OpenScripts2_BasePlugin.TransformType type, OpenScripts2_BasePlugin.Axis axis, float value)
		{
			switch (type)
			{
			case OpenScripts2_BasePlugin.TransformType.Movement:
				transform.ModifyLocalPositionAxisValue(axis, value);
				break;
			case OpenScripts2_BasePlugin.TransformType.Rotation:
				transform.ModifyLocalRotationAxisValue(axis, value);
				break;
			case OpenScripts2_BasePlugin.TransformType.Scale:
				transform.ModifyLocalScaleAxisValue(axis, value);
				break;
			}
		}

		public static void ModifyPositionAxisValue(this Transform transform, OpenScripts2_BasePlugin.Axis axis, float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0016: 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)
			Vector3 position = transform.position;
			((Vector3)(ref position))[(int)axis] = value;
			if (VectorsNotEqual(transform.position, position))
			{
				transform.position = position;
			}
		}

		public static void ModifyLocalPositionAxisValue(this Transform transform, OpenScripts2_BasePlugin.Axis axis, float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0016: 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)
			Vector3 localPosition = transform.localPosition;
			((Vector3)(ref localPosition))[(int)axis] = value;
			if (VectorsNotEqual(transform.localPosition, localPosition))
			{
				transform.localPosition = localPosition;
			}
		}

		public static void ModifyRotationAxisValue(this Transform transform, OpenScripts2_BasePlugin.Axis axis, float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0069: 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)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = transform.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			((Vector3)(ref eulerAngles))[(int)axis] = value;
			if (axis == OpenScripts2_BasePlugin.Axis.X && eulerAngles.y >= 179f && eulerAngles.z >= 179f)
			{
				eulerAngles.y -= 180f;
				eulerAngles.z -= 180f;
			}
			if (QuaternionsNotEqual(transform.rotation, Quaternion.Euler(eulerAngles)))
			{
				transform.rotation = Quaternion.Euler(eulerAngles);
			}
		}

		public static void ModifyLocalRotationAxisValue(this Transform transform, OpenScripts2_BasePlugin.Axis axis, float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0069: 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)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			Quaternion localRotation = transform.localRotation;
			Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles;
			((Vector3)(ref eulerAngles))[(int)axis] = value;
			if (axis == OpenScripts2_BasePlugin.Axis.X && eulerAngles.y >= 179f && eulerAngles.z >= 179f)
			{
				eulerAngles.y -= 180f;
				eulerAngles.z -= 180f;
			}
			if (QuaternionsNotEqual(transform.localRotation, Quaternion.Euler(eulerAngles)))
			{
				transform.localRotation = Quaternion.Euler(eulerAngles);
			}
		}

		public static void ModifyLocalScaleAxisValue(this Transform transform, OpenScripts2_BasePlugin.Axis axis, float value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0016: 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)
			Vector3 localScale = transform.localScale;
			((Vector3)(ref localScale))[(int)axis] = value;
			if (VectorsNotEqual(transform.localScale, localScale))
			{
				transform.localScale = localScale;
			}
		}

		public static void GoToTransformProxy(this Transform transform, TransformProxy proxy)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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)
			transform.position = proxy.position;
			transform.rotation = proxy.rotation;
			transform.localScale = proxy.localScale;
		}

		public static Quaternion TransformRotation(this Transform transform, Quaternion rot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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)
			return transform.rotation * rot;
		}

		public static Quaternion InverseTransformRotation(this Transform transform, Quaternion rot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return Quaternion.Inverse(transform.rotation) * rot;
		}

		public static Vector3 MultiplyComponentWise(this Vector3 v1, Vector3 v2)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			float num = v1.x * v2.x;
			float num2 = v1.y * v2.y;
			float num3 = v1.z * v2.z;
			return new Vector3(num, num2, num3);
		}

		public static Vector3 ApproximateInfiniteComponent(this Vector3 v1, float infinityApproximation)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = v1;
			if (float.IsInfinity(val.x))
			{
				val.x = (float.IsPositiveInfinity(val.x) ? infinityApproximation : (0f - infinityApproximation));
			}
			if (float.IsInfinity(val.y))
			{
				val.y = (float.IsPositiveInfinity(val.y) ? infinityApproximation : (0f - infinityApproximation));
			}
			if (float.IsInfinity(val.z))
			{
				val.z = (float.IsPositiveInfinity(val.z) ? infinityApproximation : (0f - infinityApproximation));
			}
			return val;
		}

		public static Quaternion Subtract(this Quaternion a, Quaternion b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//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)
			return a * Quaternion.Inverse(b);
		}

		public static bool VectorsNotEqual(Vector3 a, Vector3 b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0018: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			bool flag = a.x != b.x;
			bool flag2 = a.y != b.y;
			bool flag3 = a.z != b.z;
			return flag || flag2 || flag3;
		}

		public static bool QuaternionsNotEqual(Quaternion a, Quaternion b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0018: 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_002a: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			bool flag = a.x != b.x;
			bool flag2 = a.y != b.y;
			bool flag3 = a.z != b.z;
			bool flag4 = a.w != b.w;
			return flag || flag2 || flag3 || flag4;
		}
	}
}
namespace FistVR
{
	public class ClosedBoltRotatingChargingHandle : FVRInteractiveObject
	{
		public enum Placement
		{
			Forward,
			Middle,
			Rearward
		}

		[Header("Closed Bolt Rotating Charging Handle")]
		public Transform Handle;

		public Transform ReferenceVector;

		public float RotLimit;

		public ClosedBolt Bolt;

		public float ForwardSpeed = 360f;

		private float m_currentHandleZ;

		private Placement m_curPos;

		private Placement m_lastPos;

		public override void Awake()
		{
			//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_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_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)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).Awake();
			m_currentHandleZ = RotLimit;
			Vector3 val = Quaternion.AngleAxis(m_currentHandleZ, ReferenceVector.up) * ReferenceVector.forward;
			Handle.rotation = Quaternion.LookRotation(val, ReferenceVector.up);
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_000d: 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)
			//IL_0022: 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_0037: 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_0055: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			Vector3 val = Vector3.ProjectOnPlane(((HandInput)(ref hand.Input)).Pos - ((Component)Handle).transform.position, ReferenceVector.up);
			Vector3 v = Vector3.RotateTowards(ReferenceVector.forward, val, (float)Math.PI / 180f * RotLimit, 1f);
			float num = (m_currentHandleZ = AngleSigned(ReferenceVector.forward, v, ReferenceVector.up));
			Vector3 val2 = Quaternion.AngleAxis(m_currentHandleZ, ReferenceVector.up) * ReferenceVector.forward;
			Handle.rotation = Quaternion.LookRotation(val2, ReferenceVector.up);
			float num2 = Mathf.InverseLerp(RotLimit, 0f - RotLimit, num);
			Bolt.UpdateHandleHeldState(true, num2);
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).EndInteraction(hand);
			Bolt.UpdateHandleHeldState(false, 0f);
		}

		public override void FVRUpdate()
		{
			//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_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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			float num = Mathf.InverseLerp(RotLimit, 0f - RotLimit, m_currentHandleZ);
			if (num < 0.01f)
			{
				m_curPos = Placement.Forward;
			}
			else if (num > 0.99f)
			{
				m_curPos = Placement.Rearward;
			}
			else
			{
				m_curPos = Placement.Middle;
			}
			if (!((FVRInteractiveObject)this).IsHeld && Mathf.Abs(m_currentHandleZ - RotLimit) >= 0.01f)
			{
				m_currentHandleZ = Mathf.MoveTowards(m_currentHandleZ, RotLimit, Time.deltaTime * ForwardSpeed);
				Vector3 val = Quaternion.AngleAxis(m_currentHandleZ, ReferenceVector.up) * ReferenceVector.forward;
				Handle.rotation = Quaternion.LookRotation(val, ReferenceVector.up);
			}
			if (m_curPos == Placement.Forward && m_lastPos != 0)
			{
				((FVRFireArm)Bolt.Weapon).PlayAudioEvent((FirearmAudioEventType)11, 1f);
			}
			else if (m_lastPos == Placement.Rearward && m_lastPos != Placement.Rearward)
			{
				((FVRFireArm)Bolt.Weapon).PlayAudioEvent((FirearmAudioEventType)10, 1f);
			}
			m_lastPos = m_curPos;
		}

		public float AngleSigned(Vector3 v1, Vector3 v2, Vector3 n)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Atan2(Vector3.Dot(n, Vector3.Cross(v1, v2)), Vector3.Dot(v1, v2)) * 57.29578f;
		}
	}
}
namespace OpenScripts2
{
	public class AdvancedMovingFireArmAttachmentInterface : FVRFireArmAttachmentInterface
	{
		public enum EDegreesOfFreedom
		{
			Linear,
			Planar,
			Spacial
		}

		[Serializable]
		public class MovementMode
		{
			public string ModeText;

			public EDegreesOfFreedom DegreesOfFreedom;

			public OpenScripts2_BasePlugin.Axis LimitingAxis;
		}

		[Header("Advanced Moving FireArm Attachment Interface Config")]
		[Tooltip("One degree means linear movement, two degrees means movement on a plane, three degrees free spacial movement.")]
		public EDegreesOfFreedom DegreesOfFreedom;

		public float[] RotationStepOptions = new float[5] { 90f, 45f, 22.5f, 11.25f, 5.625f };

		public OpenScripts2_BasePlugin.Axis LimitingAxis;

		public Vector2 XLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

		public Vector2 YLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

		public Vector2 ZLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

		public bool OverridesDisableOnHoverOfMount;

		[Tooltip("Something placed on this mount will disable the hover on disable piece again.")]
		public FVRFireArmAttachmentMount OverrideDisableOverrideMount;

		[Tooltip("This transforms position will be vaulted as well")]
		public Transform SecondaryPiece;

		public bool CanRotate;

		public float RotationStep = 45f;

		public bool CanSwitchModes;

		public Text ModeDisplay;

		public MovementMode[] MovementModes = new MovementMode[4]
		{
			new MovementMode
			{
				ModeText = "All",
				DegreesOfFreedom = EDegreesOfFreedom.Spacial,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.X
			},
			new MovementMode
			{
				ModeText = "X Limited",
				DegreesOfFreedom = EDegreesOfFreedom.Planar,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.X
			},
			new MovementMode
			{
				ModeText = "Y Limited",
				DegreesOfFreedom = EDegreesOfFreedom.Planar,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.Y
			},
			new MovementMode
			{
				ModeText = "Z Limited",
				DegreesOfFreedom = EDegreesOfFreedom.Planar,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.Z
			}
		};

		private int _currentMode;

		private Vector3 _lastPos;

		private Vector3 _lastHandPos;

		private Vector3 _startPos;

		private Vector3 _lowerLimit;

		private Vector3 _upperLimit;

		[HideInInspector]
		public GameObject DisableOnHover;

		[HideInInspector]
		public GameObject EnableOnHover;

		public const string POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Position";

		public const string ROTATION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Rotation";

		public const string SECONDARY_POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Secondary Position";

		public override void Awake()
		{
			//IL_0028: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArmAttachmentInterface)this).Awake();
			_lowerLimit = new Vector3(XLimits.x, YLimits.x, ZLimits.x);
			_upperLimit = new Vector3(XLimits.y, YLimits.y, ZLimits.y);
			_startPos = ((Component)((AnvilAsset)((FVRPhysicalObject)base.Attachment).ObjectWrapper).GetGameObject().GetComponent<FVRFireArmAttachment>().AttachmentInterface).transform.localPosition;
			if ((Object)(object)ModeDisplay != (Object)null)
			{
				ModeDisplay.text = MovementModes[_currentMode].ModeText;
			}
		}

		public override void OnAttach()
		{
			((FVRFireArmAttachmentInterface)this).OnAttach();
			if (OverridesDisableOnHoverOfMount && base.Attachment.curMount.HasHoverDisablePiece)
			{
				if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment && ((FVRFireArmAttachment)customOpenScripts2Attachment).AttachmentInterface is MovingFireArmAttachmentInterface movingFireArmAttachmentInterface)
				{
					DisableOnHover = movingFireArmAttachmentInterface.DisableOnHover;
					movingFireArmAttachmentInterface.DisableOnHover = null;
					GameObject disableOnHover = DisableOnHover;
					if (disableOnHover != null)
					{
						disableOnHover.SetActive(true);
					}
				}
				else
				{
					DisableOnHover = base.Attachment.curMount.DisableOnHover;
					base.Attachment.curMount.DisableOnHover = null;
					GameObject disableOnHover2 = DisableOnHover;
					if (disableOnHover2 != null)
					{
						disableOnHover2.SetActive(true);
					}
				}
			}
			if (!OverridesDisableOnHoverOfMount || !base.Attachment.curMount.HasHoverEnablePiece)
			{
				return;
			}
			if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment2 && ((FVRFireArmAttachment)customOpenScripts2Attachment2).AttachmentInterface is MovingFireArmAttachmentInterface movingFireArmAttachmentInterface2)
			{
				EnableOnHover = movingFireArmAttachmentInterface2.EnableOnHover;
				movingFireArmAttachmentInterface2.EnableOnHover = null;
				GameObject enableOnHover = EnableOnHover;
				if (enableOnHover != null)
				{
					enableOnHover.SetActive(false);
				}
			}
			else
			{
				EnableOnHover = base.Attachment.curMount.EnableOnHover;
				base.Attachment.curMount.EnableOnHover = null;
				GameObject enableOnHover2 = EnableOnHover;
				if (enableOnHover2 != null)
				{
					enableOnHover2.SetActive(false);
				}
			}
		}

		public override void OnDetach()
		{
			if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment && ((FVRFireArmAttachment)customOpenScripts2Attachment).AttachmentInterface is MovingFireArmAttachmentInterface movingFireArmAttachmentInterface)
			{
				movingFireArmAttachmentInterface.DisableOnHover = DisableOnHover;
				movingFireArmAttachmentInterface.EnableOnHover = EnableOnHover;
			}
			else
			{
				base.Attachment.curMount.DisableOnHover = DisableOnHover;
				base.Attachment.curMount.EnableOnHover = EnableOnHover;
			}
			DisableOnHover = null;
			EnableOnHover = null;
			((FVRFireArmAttachmentInterface)this).OnDetach();
		}

		public override void FVRUpdate()
		{
			((FVRInteractiveObject)this).FVRUpdate();
			if (!OverridesDisableOnHoverOfMount || !((Object)(object)OverrideDisableOverrideMount != (Object)null))
			{
				return;
			}
			if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
			{
				GameObject disableOnHover = DisableOnHover;
				if (disableOnHover != null)
				{
					disableOnHover.SetActive(false);
				}
			}
			else
			{
				GameObject disableOnHover2 = DisableOnHover;
				if (disableOnHover2 != null)
				{
					disableOnHover2.SetActive(true);
				}
			}
			if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
			{
				GameObject enableOnHover = EnableOnHover;
				if (enableOnHover != null)
				{
					enableOnHover.SetActive(true);
				}
			}
			else
			{
				GameObject enableOnHover2 = EnableOnHover;
				if (enableOnHover2 != null)
				{
					enableOnHover2.SetActive(false);
				}
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			//IL_000e: 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_001f: 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)
			((FVRInteractiveObject)this).BeginInteraction(hand);
			_lastPos = ((Component)this).transform.position;
			_lastHandPos = hand.Input.FilteredPos;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_00c5: 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_0028: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00b9: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
			if (hand.Input.TriggerFloat > 0f)
			{
				Vector3 val = (hand.Input.FilteredPos - _lastHandPos) * hand.Input.TriggerFloat;
				Vector3 val2 = (((Component)this).transform.position - _lastPos) * hand.Input.TriggerFloat;
				Vector3 newPosRaw = ((Component)this).transform.position + val - val2;
				switch (DegreesOfFreedom)
				{
				case EDegreesOfFreedom.Linear:
					OneDegreeOfFreedom(newPosRaw);
					break;
				case EDegreesOfFreedom.Planar:
					TwoDegreesOfFreedom(newPosRaw);
					break;
				case EDegreesOfFreedom.Spacial:
					ThreeDegreesOfFreedom(newPosRaw);
					break;
				}
			}
			else if (OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.up))
			{
				((Component)this).transform.localPosition = _startPos;
			}
			else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.left))
			{
				((Component)this).transform.Rotate(0f, 0f, RotationStep);
			}
			else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.right))
			{
				((Component)this).transform.Rotate(0f, 0f, 0f - RotationStep);
			}
			else if (CanSwitchModes && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.down))
			{
				SwitchMode();
			}
			_lastPos = ((Component)this).transform.position;
			_lastHandPos = hand.Input.FilteredPos;
		}

		private void OneDegreeOfFreedom(Vector3 newPosRaw)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0046: 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_0055: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_006a: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localPosition;
			if (CanSwitchModes)
			{
				Vector3 val = _lowerLimit.GetCombinedAxisVector(LimitingAxis, ((Component)this).transform.localPosition).ApproximateInfiniteComponent(100f);
				Vector3 val2 = _upperLimit.GetCombinedAxisVector(LimitingAxis, ((Component)this).transform.localPosition).ApproximateInfiniteComponent(100f);
				localPosition = ((FVRInteractiveObject)this).GetClosestValidPoint(val, val2, ((Component)this).transform.parent.InverseTransformPoint(newPosRaw));
			}
			else
			{
				localPosition = ((Component)this).transform.parent.InverseTransformPoint(newPosRaw).GetAxisVector(LimitingAxis).Clamp(_lowerLimit, _upperLimit);
			}
			((Component)this).transform.localPosition = localPosition;
		}

		private void TwoDegreesOfFreedom(Vector3 newPosRaw)
		{
			//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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002f: 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_005b: 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_0067: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((!CanSwitchModes) ? ((Component)this).transform.parent.InverseTransformPoint(newPosRaw).RemoveAxisValue(LimitingAxis) : newPosRaw.ProjectOnPlaneThroughPoint(((Component)this).transform.position, ((Component)this).transform.parent.GetLocalDirAxis(LimitingAxis)));
			Vector3 vector = ((Component)this).transform.parent.InverseTransformPoint(val).Clamp(_lowerLimit, _upperLimit);
			((Component)this).transform.localPosition = vector.ModifyAxisValue(LimitingAxis, _startPos.GetAxisValue(LimitingAxis));
		}

		private void ThreeDegreesOfFreedom(Vector3 newPosRaw)
		{
			//IL_0011: 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_0018: 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)
			((Component)this).transform.localPosition = ((Component)this).transform.parent.InverseTransformPoint(newPosRaw).Clamp(_lowerLimit, _upperLimit);
		}

		[ContextMenu("Copy existing Interface's values")]
		public void CopyAttachment()
		{
			FVRFireArmAttachmentInterface[] components = ((Component)this).GetComponents<FVRFireArmAttachmentInterface>();
			FVRFireArmAttachmentInterface val = components.Single((FVRFireArmAttachmentInterface c) => (Object)(object)c != (Object)(object)this);
			val.Attachment.AttachmentInterface = (FVRFireArmAttachmentInterface)(object)this;
			((Component)(object)this).CopyComponent<FVRFireArmAttachmentInterface>(val);
		}

		private void SwitchMode()
		{
			_currentMode = (_currentMode + 1) % MovementModes.Length;
			if ((Object)(object)ModeDisplay != (Object)null)
			{
				ModeDisplay.text = MovementModes[_currentMode].ModeText;
			}
			DegreesOfFreedom = MovementModes[_currentMode].DegreesOfFreedom;
			LimitingAxis = MovementModes[_currentMode].LimitingAxis;
		}
	}
	public class InvertingMount : FVRFireArmAttachmentMount
	{
		private static bool _wasPatched;

		public void Start()
		{
			if (!_wasPatched)
			{
				Harmony.CreateAndPatchAll(typeof(InvertingMount), (string)null);
				_wasPatched = true;
			}
		}

		[HarmonyPatch(typeof(FVRFireArmAttachment), "AttachToMount")]
		[HarmonyPostfix]
		public static void FVRFireArmAttachment_AttachToMount_Postfix(FVRFireArmAttachment __instance, FVRFireArmAttachmentMount m)
		{
			//IL_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0079: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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_010f: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_0196: 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)
			//IL_019f: 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_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			if (!(m is InvertingMount))
			{
				return;
			}
			Vector3 localPosition = ((Component)__instance).transform.localPosition;
			localPosition.x = 0f - localPosition.x;
			((Component)__instance).transform.localPosition = localPosition;
			MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val in componentsInChildren)
			{
				Vector3 localScale = ((Component)val).transform.localScale;
				localScale.x = 0f - localScale.x;
				((Component)val).transform.localScale = localScale;
				localPosition = ((Component)val).transform.localPosition;
				localPosition.x = 0f - localPosition.x;
				((Component)val).transform.localPosition = localPosition;
			}
			foreach (Collider item in ((FVRInteractiveObject)__instance).m_colliders.Where((Collider c) => !c.isTrigger))
			{
				Vector3 localScale = ((Component)item).transform.localScale;
				localScale.x = 0f - localScale.x;
				((Component)item).transform.localScale = localScale;
				localPosition = ((Component)item).transform.localPosition;
				localPosition.x = 0f - localPosition.x;
				((Component)item).transform.localPosition = localPosition;
			}
			foreach (FVRFireArmAttachmentMount attachmentMount in ((FVRPhysicalObject)__instance).AttachmentMounts)
			{
				if (!((Object)(object)attachmentMount == (Object)null))
				{
					localPosition = ((Component)attachmentMount).transform.localPosition;
					localPosition.x = 0f - localPosition.x;
					((Component)attachmentMount).transform.localPosition = localPosition;
					Vector3 localEulerAngles = ((Component)attachmentMount).transform.localEulerAngles;
					localEulerAngles.z = 0f - localEulerAngles.z;
					((Component)attachmentMount).transform.localEulerAngles = localEulerAngles;
					if ((Object)(object)attachmentMount.Point_Front.parent != (Object)(object)((Component)attachmentMount).transform)
					{
						localEulerAngles = attachmentMount.Point_Front.localEulerAngles;
						localEulerAngles.z = 0f - localEulerAngles.z;
						attachmentMount.Point_Front.localEulerAngles = localEulerAngles;
					}
					localPosition = attachmentMount.Point_Front.localPosition;
					localPosition.x = 0f - localPosition.x;
					attachmentMount.Point_Front.localPosition = localPosition;
					if ((Object)(object)attachmentMount.Point_Rear.parent != (Object)(object)((Component)attachmentMount).transform)
					{
						localEulerAngles = attachmentMount.Point_Rear.localEulerAngles;
						localEulerAngles.z = 0f - localEulerAngles.z;
						attachmentMount.Point_Rear.localEulerAngles = localEulerAngles;
					}
					localPosition = attachmentMount.Point_Rear.localPosition;
					localPosition.x = 0f - localPosition.x;
					attachmentMount.Point_Rear.localPosition = localPosition;
				}
			}
		}

		[HarmonyPatch(typeof(FVRFireArmAttachment), "DetachFromMount")]
		[HarmonyPrefix]
		public static void FVRFireArmAttachment_DetachFromMount_Prefix(FVRFireArmAttachment __instance)
		{
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0069: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: 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_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: 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_01e9: 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_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			if (!(__instance.curMount is InvertingMount))
			{
				return;
			}
			Vector3 localPosition = ((Component)__instance).transform.localPosition;
			localPosition.x = 0f - localPosition.x;
			((Component)__instance).transform.localPosition = localPosition;
			MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val in componentsInChildren)
			{
				Vector3 localScale = ((Component)val).transform.localScale;
				localScale.x = 0f - localScale.x;
				((Component)val).transform.localScale = localScale;
				localPosition = ((Component)val).transform.localPosition;
				localPosition.x = 0f - localPosition.x;
				((Component)val).transform.localPosition = localPosition;
			}
			foreach (Collider item in ((FVRInteractiveObject)__instance).m_colliders.Where((Collider c) => !c.isTrigger))
			{
				Vector3 localScale = ((Component)item).transform.localScale;
				localScale.x = 0f - localScale.x;
				((Component)item).transform.localScale = localScale;
				localPosition = ((Component)item).transform.localPosition;
				localPosition.x = 0f - localPosition.x;
				((Component)item).transform.localPosition = localPosition;
			}
			foreach (FVRFireArmAttachmentMount attachmentMount in ((FVRPhysicalObject)__instance).AttachmentMounts)
			{
				if (!((Object)(object)attachmentMount == (Object)null))
				{
					Vector3 localEulerAngles = ((Component)attachmentMount).transform.localEulerAngles;
					localEulerAngles.z = 0f - localEulerAngles.z;
					((Component)attachmentMount).transform.localEulerAngles = localEulerAngles;
					localPosition = ((Component)attachmentMount).transform.localPosition;
					localPosition.x = 0f - localPosition.x;
					((Component)attachmentMount).transform.localPosition = localPosition;
					if ((Object)(object)attachmentMount.Point_Front.parent != (Object)(object)((Component)attachmentMount).transform)
					{
						localEulerAngles = attachmentMount.Point_Front.localEulerAngles;
						localEulerAngles.z = 0f - localEulerAngles.z;
						attachmentMount.Point_Front.localEulerAngles = localEulerAngles;
					}
					localPosition = attachmentMount.Point_Front.localPosition;
					localPosition.x = 0f - localPosition.x;
					attachmentMount.Point_Front.localPosition = localPosition;
					if ((Object)(object)attachmentMount.Point_Rear.parent != (Object)(object)((Component)attachmentMount).transform)
					{
						localEulerAngles = attachmentMount.Point_Rear.localEulerAngles;
						localEulerAngles.z = 0f - localEulerAngles.z;
						attachmentMount.Point_Rear.localEulerAngles = localEulerAngles;
					}
					localPosition = attachmentMount.Point_Rear.localPosition;
					localPosition.x = 0f - localPosition.x;
					attachmentMount.Point_Rear.localPosition = localPosition;
				}
			}
		}
	}
	public class SupressableMuzzleNoiseMaker : MuzzleNoiseMaker
	{
		public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (!f.IsSuppressed())
			{
				((MuzzleNoiseMaker)this).OnShot(f, tailClass);
			}
		}

		public override void OnShot(AttachableFirearm f, FVRTailSoundClass tailClass)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (!f.IsSuppressed())
			{
				((MuzzleNoiseMaker)this).OnShot(f, tailClass);
			}
		}

		[ContextMenu("Copy Noise Maker")]
		public void CopyNoiseMaker()
		{
			MuzzleNoiseMaker[] components = ((Component)this).GetComponents<MuzzleNoiseMaker>();
			MuzzleNoiseMaker val = components.Single((MuzzleNoiseMaker c) => (Object)(object)c != (Object)(object)this);
			foreach (FVRFireArmAttachmentMount attachmentMount in ((FVRPhysicalObject)val).AttachmentMounts)
			{
				attachmentMount.MyObject = (FVRPhysicalObject)(object)this;
				attachmentMount.Parent = (FVRPhysicalObject)(object)this;
			}
			((FVRFireArmAttachment)val).AttachmentInterface.Attachment = (FVRFireArmAttachment)(object)this;
			((FVRFireArmAttachment)val).Sensor.Attachment = (FVRFireArmAttachment)(object)this;
			((Component)(object)this).CopyComponent<MuzzleNoiseMaker>(val);
		}
	}
	public class CustomMuzzleEffectsForMuzzleDevice : MonoBehaviour
	{
		public MuzzleDevice MuzzleDevice;

		public CustomMuzzleEffect[] CustomMuzzleEffects;

		public float MuzzleDeviceEffectSizeMultiplier = 1f;

		private static readonly List<FVRFireArmAttachment> _existingCustomMuzzleEffectsForMuzzleDevices;

		public void Awake()
		{
			_existingCustomMuzzleEffectsForMuzzleDevices.Add((FVRFireArmAttachment)(object)MuzzleDevice);
		}

		public void OnDestroy()
		{
			_existingCustomMuzzleEffectsForMuzzleDevices.Remove((FVRFireArmAttachment)(object)MuzzleDevice);
		}

		static CustomMuzzleEffectsForMuzzleDevice()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			_existingCustomMuzzleEffectsForMuzzleDevices = new List<FVRFireArmAttachment>();
			FVRFireArmAttachment.AttachToMount += new hook_AttachToMount(FVRFireArmAttachment_AttachToMount);
		}

		private static void FVRFireArmAttachment_AttachToMount(orig_AttachToMount orig, FVRFireArmAttachment self, FVRFireArmAttachmentMount m, bool playSound)
		{
			if (_existingCustomMuzzleEffectsForMuzzleDevices.Contains(self))
			{
				FVRPhysicalObject myObject = m.GetRootMount().MyObject;
				FVRFireArm val = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null);
				if ((Object)(object)val != (Object)null && !((Component)(object)val).TryGetComponentInChildren<CustomMuzzleEffectsController>(out CustomMuzzleEffectsController _))
				{
					((Component)val).gameObject.AddComponent<CustomMuzzleEffectsController>();
				}
			}
			orig.Invoke(self, m, playSound);
		}
	}
	public class MovingFireArmAttachmentInterface : FVRFireArmAttachmentInterface
	{
		public enum EDegreesOfFreedom
		{
			Linear,
			Planar,
			Spacial
		}

		[Serializable]
		public class MovementMode
		{
			public string ModeText;

			public EDegreesOfFreedom DegreesOfFreedom;

			public OpenScripts2_BasePlugin.Axis LimitingAxis;
		}

		[Header("Moving FireArm Attachment Interface Config")]
		[Tooltip("One degree means linear movement, two degrees means movement on a plane, three degrees free spacial movement.")]
		public EDegreesOfFreedom DegreesOfFreedom;

		public OpenScripts2_BasePlugin.Axis LimitingAxis;

		public Vector2 XLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

		public Vector2 YLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

		public Vector2 ZLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

		public bool OverridesDisableOnHoverOfMount;

		[Tooltip("Something placed on this mount will disabled the hover on disable piece again.")]
		public FVRFireArmAttachmentMount OverrideDisableOverrideMount;

		[Tooltip("This transforms position will be vaulted as well")]
		public Transform SecondaryPiece;

		public bool CanRotate;

		public float RotationStep = 45f;

		public bool CanSwitchModes;

		public Text ModeDisplay;

		public MovementMode[] MovementModes = new MovementMode[4]
		{
			new MovementMode
			{
				ModeText = "All",
				DegreesOfFreedom = EDegreesOfFreedom.Spacial,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.X
			},
			new MovementMode
			{
				ModeText = "X Limited",
				DegreesOfFreedom = EDegreesOfFreedom.Planar,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.X
			},
			new MovementMode
			{
				ModeText = "Y Limited",
				DegreesOfFreedom = EDegreesOfFreedom.Planar,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.Y
			},
			new MovementMode
			{
				ModeText = "Z Limited",
				DegreesOfFreedom = EDegreesOfFreedom.Planar,
				LimitingAxis = OpenScripts2_BasePlugin.Axis.Z
			}
		};

		private int _currentMode;

		private Vector3 _lastPos;

		private Vector3 _lastHandPos;

		private Vector3 _startPos;

		private Vector3 _lowerLimit;

		private Vector3 _upperLimit;

		[HideInInspector]
		public GameObject DisableOnHover;

		[HideInInspector]
		public GameObject EnableOnHover;

		public const string POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Position";

		public const string ROTATION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Rotation";

		public const string SECONDARY_POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Secondary Position";

		public override void Awake()
		{
			//IL_0028: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArmAttachmentInterface)this).Awake();
			_lowerLimit = new Vector3(XLimits.x, YLimits.x, ZLimits.x);
			_upperLimit = new Vector3(XLimits.y, YLimits.y, ZLimits.y);
			_startPos = ((Component)((AnvilAsset)((FVRPhysicalObject)base.Attachment).ObjectWrapper).GetGameObject().GetComponent<FVRFireArmAttachment>().AttachmentInterface).transform.localPosition;
			if ((Object)(object)ModeDisplay != (Object)null)
			{
				ModeDisplay.text = MovementModes[_currentMode].ModeText;
			}
		}

		public override void OnAttach()
		{
			((FVRFireArmAttachmentInterface)this).OnAttach();
			if (OverridesDisableOnHoverOfMount && base.Attachment.curMount.HasHoverDisablePiece)
			{
				if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment && ((FVRFireArmAttachment)customOpenScripts2Attachment).AttachmentInterface is MovingFireArmAttachmentInterface movingFireArmAttachmentInterface)
				{
					DisableOnHover = movingFireArmAttachmentInterface.DisableOnHover;
					movingFireArmAttachmentInterface.DisableOnHover = null;
					GameObject disableOnHover = DisableOnHover;
					if (disableOnHover != null)
					{
						disableOnHover.SetActive(true);
					}
				}
				else
				{
					DisableOnHover = base.Attachment.curMount.DisableOnHover;
					base.Attachment.curMount.DisableOnHover = null;
					GameObject disableOnHover2 = DisableOnHover;
					if (disableOnHover2 != null)
					{
						disableOnHover2.SetActive(true);
					}
				}
			}
			if (!OverridesDisableOnHoverOfMount || !base.Attachment.curMount.HasHoverEnablePiece)
			{
				return;
			}
			if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment2 && ((FVRFireArmAttachment)customOpenScripts2Attachment2).AttachmentInterface is MovingFireArmAttachmentInterface movingFireArmAttachmentInterface2)
			{
				EnableOnHover = movingFireArmAttachmentInterface2.EnableOnHover;
				movingFireArmAttachmentInterface2.EnableOnHover = null;
				GameObject enableOnHover = EnableOnHover;
				if (enableOnHover != null)
				{
					enableOnHover.SetActive(false);
				}
			}
			else
			{
				EnableOnHover = base.Attachment.curMount.EnableOnHover;
				base.Attachment.curMount.EnableOnHover = null;
				GameObject enableOnHover2 = EnableOnHover;
				if (enableOnHover2 != null)
				{
					enableOnHover2.SetActive(false);
				}
			}
		}

		public override void OnDetach()
		{
			if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment && ((FVRFireArmAttachment)customOpenScripts2Attachment).AttachmentInterface is MovingFireArmAttachmentInterface movingFireArmAttachmentInterface)
			{
				movingFireArmAttachmentInterface.DisableOnHover = DisableOnHover;
				movingFireArmAttachmentInterface.EnableOnHover = EnableOnHover;
			}
			else
			{
				base.Attachment.curMount.DisableOnHover = DisableOnHover;
				base.Attachment.curMount.EnableOnHover = EnableOnHover;
			}
			DisableOnHover = null;
			EnableOnHover = null;
			((FVRFireArmAttachmentInterface)this).OnDetach();
		}

		public override void FVRUpdate()
		{
			((FVRInteractiveObject)this).FVRUpdate();
			if (!OverridesDisableOnHoverOfMount || !((Object)(object)OverrideDisableOverrideMount != (Object)null))
			{
				return;
			}
			if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
			{
				GameObject disableOnHover = DisableOnHover;
				if (disableOnHover != null)
				{
					disableOnHover.SetActive(false);
				}
			}
			else
			{
				GameObject disableOnHover2 = DisableOnHover;
				if (disableOnHover2 != null)
				{
					disableOnHover2.SetActive(true);
				}
			}
			if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
			{
				GameObject enableOnHover = EnableOnHover;
				if (enableOnHover != null)
				{
					enableOnHover.SetActive(true);
				}
			}
			else
			{
				GameObject enableOnHover2 = EnableOnHover;
				if (enableOnHover2 != null)
				{
					enableOnHover2.SetActive(false);
				}
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			//IL_000e: 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_001f: 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)
			((FVRInteractiveObject)this).BeginInteraction(hand);
			_lastPos = ((Component)this).transform.position;
			_lastHandPos = hand.Input.FilteredPos;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_00c5: 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_0028: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00b9: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
			if (hand.Input.TriggerFloat > 0f)
			{
				Vector3 val = (hand.Input.FilteredPos - _lastHandPos) * hand.Input.TriggerFloat;
				Vector3 val2 = (((Component)this).transform.position - _lastPos) * hand.Input.TriggerFloat;
				Vector3 newPosRaw = ((Component)this).transform.position + val - val2;
				switch (DegreesOfFreedom)
				{
				case EDegreesOfFreedom.Linear:
					OneDegreeOfFreedom(newPosRaw);
					break;
				case EDegreesOfFreedom.Planar:
					TwoDegreesOfFreedom(newPosRaw);
					break;
				case EDegreesOfFreedom.Spacial:
					ThreeDegreesOfFreedom(newPosRaw);
					break;
				}
			}
			else if (OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.up))
			{
				((Component)this).transform.localPosition = _startPos;
			}
			else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.left))
			{
				((Component)this).transform.Rotate(0f, 0f, RotationStep);
			}
			else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.right))
			{
				((Component)this).transform.Rotate(0f, 0f, 0f - RotationStep);
			}
			else if (CanSwitchModes && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.down))
			{
				SwitchMode();
			}
			_lastPos = ((Component)this).transform.position;
			_lastHandPos = hand.Input.FilteredPos;
		}

		private void OneDegreeOfFreedom(Vector3 newPosRaw)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0046: 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_0055: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_006a: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localPosition;
			if (CanSwitchModes)
			{
				Vector3 val = _lowerLimit.GetCombinedAxisVector(LimitingAxis, ((Component)this).transform.localPosition).ApproximateInfiniteComponent(100f);
				Vector3 val2 = _upperLimit.GetCombinedAxisVector(LimitingAxis, ((Component)this).transform.localPosition).ApproximateInfiniteComponent(100f);
				localPosition = ((FVRInteractiveObject)this).GetClosestValidPoint(val, val2, ((Component)this).transform.parent.InverseTransformPoint(newPosRaw));
			}
			else
			{
				localPosition = ((Component)this).transform.parent.InverseTransformPoint(newPosRaw).GetAxisVector(LimitingAxis).Clamp(_lowerLimit, _upperLimit);
			}
			((Component)this).transform.localPosition = localPosition;
		}

		private void TwoDegreesOfFreedom(Vector3 newPosRaw)
		{
			//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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002f: 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_005b: 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_0067: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((!CanSwitchModes) ? ((Component)this).transform.parent.InverseTransformPoint(newPosRaw).RemoveAxisValue(LimitingAxis) : newPosRaw.ProjectOnPlaneThroughPoint(((Component)this).transform.position, ((Component)this).transform.parent.GetLocalDirAxis(LimitingAxis)));
			Vector3 vector = ((Component)this).transform.parent.InverseTransformPoint(val).Clamp(_lowerLimit, _upperLimit);
			((Component)this).transform.localPosition = vector.ModifyAxisValue(LimitingAxis, _startPos.GetAxisValue(LimitingAxis));
		}

		private void ThreeDegreesOfFreedom(Vector3 newPosRaw)
		{
			//IL_0011: 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_0018: 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)
			((Component)this).transform.localPosition = ((Component)this).transform.parent.InverseTransformPoint(newPosRaw).Clamp(_lowerLimit, _upperLimit);
		}

		[ContextMenu("Copy existing Interface's values")]
		public void CopyAttachment()
		{
			FVRFireArmAttachmentInterface[] components = ((Component)this).GetComponents<FVRFireArmAttachmentInterface>();
			FVRFireArmAttachmentInterface val = components.Single((FVRFireArmAttachmentInterface c) => (Object)(object)c != (Object)(object)this);
			val.Attachment.AttachmentInterface = (FVRFireArmAttachmentInterface)(object)this;
			((Component)(object)this).CopyComponent<FVRFireArmAttachmentInterface>(val);
		}

		private void SwitchMode()
		{
			_currentMode = (_currentMode + 1) % MovementModes.Length;
			if ((Object)(object)ModeDisplay != (Object)null)
			{
				ModeDisplay.text = MovementModes[_currentMode].ModeText;
			}
			DegreesOfFreedom = MovementModes[_currentMode].DegreesOfFreedom;
			LimitingAxis = MovementModes[_currentMode].LimitingAxis;
		}
	}
	public class FirearmFeatureChangerAttachment : CustomOpenScripts2Attachment
	{
		public enum EFirearmFeature
		{
			BoltRelease,
			BoltCatch,
			MagazineRelease,
			FireSelector
		}

		public EFirearmFeature FirearmFeature;

		public bool ActivateFeature = true;

		private FVRFireArm _firearm;

		public override void FVRUpdate()
		{
			((FVRPhysicalObject)this).FVRUpdate();
			if ((Object)(object)((FVRFireArmAttachment)this).curMount == (Object)null && (Object)(object)_firearm != (Object)null)
			{
				ChangeFeature(!ActivateFeature);
				_firearm = null;
			}
		}

		public override void AttachToMount(FVRFireArmAttachmentMount m, bool playSound)
		{
			((FVRFireArmAttachment)this).AttachToMount(m, playSound);
			ref FVRFireArm firearm = ref _firearm;
			FVRPhysicalObject myObject = m.GetRootMount().MyObject;
			firearm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null);
			if ((Object)(object)_firearm != (Object)null)
			{
				ChangeFeature(ActivateFeature);
			}
		}

		private void ChangeFeature(bool active)
		{
			FVRFireArm firearm = _firearm;
			ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((firearm is ClosedBoltWeapon) ? firearm : null);
			if (val == null)
			{
				OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((firearm is OpenBoltReceiver) ? firearm : null);
				if (val2 == null)
				{
					Handgun val3 = (Handgun)(object)((firearm is Handgun) ? firearm : null);
					if (val3 == null)
					{
						BoltActionRifle val4 = (BoltActionRifle)(object)((firearm is BoltActionRifle) ? firearm : null);
						if (val4 == null)
						{
							TubeFedShotgun val5 = (TubeFedShotgun)(object)((firearm is TubeFedShotgun) ? firearm : null);
							if (val5 != null)
							{
								ChangeFeatureTubeFed(val5, active);
							}
							else
							{
								OpenScripts2_BepInExPlugin.LogWarning((MonoBehaviour)(object)this, "Firearm Type not supported!");
							}
						}
						else
						{
							ChangeFeatureBoltAction(val4, active);
						}
					}
					else
					{
						ChangeFeatureHandgun(val3, active);
					}
				}
				else
				{
					ChangeFeatureOpenBolt(val2, active);
				}
			}
			else
			{
				ChangeFeatureClosedBolt(val, active);
			}
		}

		private void ChangeFeatureClosedBolt(ClosedBoltWeapon w, bool active)
		{
			switch (FirearmFeature)
			{
			case EFirearmFeature.BoltRelease:
				w.HasBoltReleaseButton = active;
				break;
			case EFirearmFeature.BoltCatch:
				w.HasBoltCatchButton = active;
				break;
			case EFirearmFeature.MagazineRelease:
				w.HasMagReleaseButton = active;
				break;
			case EFirearmFeature.FireSelector:
				w.HasFireSelectorButton = active;
				break;
			default:
				OpenScripts2_BepInExPlugin.LogWarning((MonoBehaviour)(object)this, $"{FirearmFeature} not supported for  {((object)w).GetType()}!");
				break;
			}
		}

		private void ChangeFeatureOpenBolt(OpenBoltReceiver w, bool active)
		{
			switch (FirearmFeature)
			{
			case EFirearmFeature.MagazineRelease:
				w.HasMagReleaseButton = active;
				break;
			case EFirearmFeature.FireSelector:
				w.HasFireSelectorButton = active;
				break;
			default:
				OpenScripts2_BepInExPlugin.LogWarning((MonoBehaviour)(object)this, $"{FirearmFeature} not supported for  {((object)w).GetType()}!");
				break;
			}
		}

		private void ChangeFeatureHandgun(Handgun w, bool active)
		{
			switch (FirearmFeature)
			{
			case EFirearmFeature.BoltRelease:
				w.HasSlideReleaseControl = active;
				break;
			case EFirearmFeature.MagazineRelease:
				w.HasMagReleaseButton = active;
				break;
			case EFirearmFeature.FireSelector:
				w.HasSafetyControl = active;
				break;
			default:
				OpenScripts2_BepInExPlugin.LogWarning((MonoBehaviour)(object)this, $"{FirearmFeature} not supported for  {((object)w).GetType()}!");
				break;
			}
		}

		private void ChangeFeatureBoltAction(BoltActionRifle w, bool active)
		{
			EFirearmFeature firearmFeature = FirearmFeature;
			if (firearmFeature == EFirearmFeature.MagazineRelease)
			{
				w.HasMagEjectionButton = active;
			}
			else
			{
				OpenScripts2_BepInExPlugin.LogWarning((MonoBehaviour)(object)this, $"{FirearmFeature} not supported for  {((object)w).GetType()}!");
			}
		}

		private void ChangeFeatureTubeFed(TubeFedShotgun w, bool active)
		{
			if (FirearmFeature == EFirearmFeature.BoltRelease)
			{
				w.HasSlideReleaseButton = active;
			}
			else
			{
				OpenScripts2_BepInExPlugin.LogWarning((MonoBehaviour)(object)this, $"{FirearmFeature} not supported for  {((object)w).GetType()}!");
			}
		}
	}
	public class CustomOpenScripts2Attachment : FVRFireArmAttachment
	{
		public override void Awake()
		{
			((FVRFireArmAttachment)this).Awake();
			if (((Component)base.AttachmentInterface).gameObject.activeSelf && (Object)(object)base.curMount == (Object)null)
			{
				((Component)base.AttachmentInterface).gameObject.SetActive(false);
			}
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			Dictionary<string, string> flagDic = ((FVRFireArmAttachment)this).GetFlagDic();
			FVRFireArmAttachmentInterface attachmentInterface = base.AttachmentInterface;
			CustomReflexSightInterface customReflexSightInterface = attachmentInterface as CustomReflexSightInterface;
			if (customReflexSightInterface == null)
			{
				CustomScopeInterface customScopeInterface = attachmentInterface as CustomScopeInterface;
				if (customScopeInterface == null)
				{
					CustomLinearZoomScopeInterface customLinearZoomScopeInterface = attachmentInterface as CustomLinearZoomScopeInterface;
					if (customLinearZoomScopeInterface == null && attachmentInterface is MovingFireArmAttachmentInterface i)
					{
						MovingFireArmAttachmentInterfaceFlagDic(flagDic, save: true, i);
					}
				}
			}
			SkinChanger component = ((Component)this).GetComponent<SkinChanger>();
			if ((Object)(object)component != (Object)null)
			{
				SkinChangerFlagDic(flagDic, save: true, component);
			}
			return flagDic;
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			((FVRFireArmAttachment)this).ConfigureFromFlagDic(f);
			FVRFireArmAttachmentInterface attachmentInterface = base.AttachmentInterface;
			CustomReflexSightInterface customReflexSightInterface = attachmentInterface as CustomReflexSightInterface;
			if (customReflexSightInterface == null)
			{
				CustomScopeInterface customScopeInterface = attachmentInterface as CustomScopeInterface;
				if (customScopeInterface == null)
				{
					CustomLinearZoomScopeInterface customLinearZoomScopeInterface = attachmentInterface as CustomLinearZoomScopeInterface;
					if (customLinearZoomScopeInterface == null && attachmentInterface is MovingFireArmAttachmentInterface i)
					{
						MovingFireArmAttachmentInterfaceFlagDic(f, save: false, i);
					}
				}
			}
			SkinChanger component = ((Component)this).GetComponent<SkinChanger>();
			if ((Object)(object)component != (Object)null)
			{
				SkinChangerFlagDic(f, save: false, component);
			}
		}

		private void MovingFireArmAttachmentInterfaceFlagDic(Dictionary<string, string> flagDic, bool save, MovingFireArmAttachmentInterface i)
		{
			//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_005e: 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_0150: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			string value;
			if (save)
			{
				Vector3 localPosition = ((Component)i).transform.localPosition;
				value = ((Vector3)(ref localPosition)).ToString("F6").Replace(" ", "").Replace("(", "")
					.Replace(")", "");
				flagDic.Add("MovingFireArmAttachmentInterface Position", value);
				Quaternion localRotation = ((Component)i).transform.localRotation;
				value = ((Quaternion)(ref localRotation)).ToString("F6").Replace(" ", "").Replace("(", "")
					.Replace(")", "");
				flagDic.Add("MovingFireArmAttachmentInterface Rotation", value);
				if ((Object)(object)i.SecondaryPiece != (Object)null)
				{
					localPosition = i.SecondaryPiece.localPosition;
					value = ((Vector3)(ref localPosition)).ToString("F6").Replace(" ", "").Replace("(", "")
						.Replace(")", "");
					flagDic.Add("MovingFireArmAttachmentInterface Secondary Position", value);
				}
			}
			else if (flagDic.TryGetValue("MovingFireArmAttachmentInterface Position", out value))
			{
				string[] array = value.Split(new char[1] { ',' });
				((Component)i).transform.localPosition = new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
				if (flagDic.TryGetValue("MovingFireArmAttachmentInterface Rotation", out value))
				{
					array = value.Split(new char[1] { ',' });
					((Component)i).transform.localRotation = new Quaternion(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]), float.Parse(array[3]));
				}
				if (flagDic.TryGetValue("MovingFireArmAttachmentInterface Secondary Position", out value) && (Object)(object)i.SecondaryPiece != (Object)null)
				{
					array = value.Split(new char[1] { ',' });
					i.SecondaryPiece.localPosition = new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
				}
			}
		}

		private void SkinChangerFlagDic(Dictionary<string, string> flagDic, bool save, SkinChanger i)
		{
			string value;
			if (save)
			{
				value = i.CurrentSkinIndex.ToString();
				flagDic.Add("SkinChanger Skin", value);
			}
			else if (flagDic.TryGetValue("SkinChanger Skin", out value))
			{
				int skinIndex = int.Parse(value);
				i.SelectSkin(skinIndex);
			}
		}

		[ContextMenu("Copy existing Attachment's values")]
		public void CopyAttachment()
		{
			FVRFireArmAttachment[] components = ((Component)this).GetComponents<FVRFireArmAttachment>();
			FVRFireArmAttachment val = components.Single((FVRFireArmAttachment c) => (Object)(object)c != (Object)(object)this);
			val.AttachmentInterface.Attachment = (FVRFireArmAttachment)(object)this;
			val.Sensor.Attachment = (FVRFireArmAttachment)(object)this;
			((Component)(object)this).CopyComponent<FVRFireArmAttachment>(val);
		}
	}
	public class HeadQBSlot : FVRQuickBeltSlot
	{
		[ContextMenu("CopyQBSlot")]
		public void CopyQBSlot()
		{
			((Component)(object)this).CopyComponent<FVRQuickBeltSlot>(((Component)this).GetComponent<FVRQuickBeltSlot>());
		}
	}
	public class HolsterStockQBSlot : FVRQuickBeltSlot
	{
		[Header("Holster Config")]
		public FVRPhysicalObject PhysicalObject;

		public Transform StockCap;

		public OpenScripts2_BasePlugin.Axis CapAxis;

		public float CapClosed;

		public float CapOpen;

		private static readonly List<FVRQuickBeltSlot> _existingHolsterStockQBSlots;

		private const string DEFAULT_LAYER = "Default";

		private const string INTERACTABLE_LAYER = "Interactable";

		public void Start()
		{
			_existingHolsterStockQBSlots.Add((FVRQuickBeltSlot)(object)this);
		}

		public void OnDestroy()
		{
			_existingHolsterStockQBSlots.Remove((FVRQuickBeltSlot)(object)this);
		}

		static HolsterStockQBSlot()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			_existingHolsterStockQBSlots = new List<FVRQuickBeltSlot>();
			FVRQuickBeltSlot.Update += new hook_Update(FVRQuickBeltSlot_Update);
		}

		private static void FVRQuickBeltSlot_Update(orig_Update orig, FVRQuickBeltSlot self)
		{
			//IL_0122: 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_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (self is HolsterStockQBSlot holsterStockQBSlot && _existingHolsterStockQBSlots.Contains(self))
			{
				if ((Object)(object)((FVRQuickBeltSlot)holsterStockQBSlot).HeldObject != (Object)null && (Object)(object)holsterStockQBSlot.PhysicalObject.QuickbeltSlot != (Object)null)
				{
					((Component)holsterStockQBSlot.PhysicalObject).gameObject.layer = LayerMask.NameToLayer("Default");
					((Component)holsterStockQBSlot).gameOb