using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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;
}
}
}
public class MagazineHelperGizmo : MonoBehaviour
{
public float GizmoSize;
}
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 enum EColliderType
{
Sphere,
Capsule,
Box
}
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 GetLocalEulerAnglesAxisValue(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.localEulerAngles.x,
OpenScripts2_BasePlugin.Axis.Y => transform.localEulerAngles.y,
OpenScripts2_BasePlugin.Axis.Z => transform.localEulerAngles.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 Approximately(this 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 = Mathf.Approximately(a.x, b.x);
bool flag2 = Mathf.Approximately(a.y, b.y);
bool flag3 = Mathf.Approximately(a.z, b.z);
return flag && flag2 && flag3;
}
public static bool NotEqual(this 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;
}
public static bool NotEqual(this 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;
}
public static bool Approximately(this 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 = Mathf.Approximately(a.x, b.x);
bool flag2 = Mathf.Approximately(a.y, b.y);
bool flag3 = Mathf.Approximately(a.z, b.z);
bool flag4 = Mathf.Approximately(a.w, b.w);
return flag && flag2 && flag3 && flag4;
}
public static Quaternion Invert(this Quaternion a)
{
//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)
return Quaternion.Inverse(a);
}
public static void Analyze(this Collider collider, out Vector3 center, out Vector3 size, out EColliderType type, out OpenScripts2_BasePlugin.Axis axis)
{
//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_0044: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
CapsuleCollider val = (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null);
if (val == null)
{
SphereCollider val2 = (SphereCollider)(object)((collider is SphereCollider) ? collider : null);
if (val2 == null)
{
BoxCollider val3 = (BoxCollider)(object)((collider is BoxCollider) ? collider : null);
if (val3 == null)
{
throw new ArgumentException($"Collider type {((object)collider).GetType()} not supported!");
}
center = val3.center;
size = val3.size;
type = EColliderType.Box;
axis = (OpenScripts2_BasePlugin.Axis)(-1);
}
else
{
center = val2.center;
size = new Vector3(val2.radius, 0f, 0f);
type = EColliderType.Sphere;
axis = (OpenScripts2_BasePlugin.Axis)(-1);
}
}
else
{
center = val.center;
size = new Vector3(val.radius, val.height, 0f);
type = EColliderType.Capsule;
axis = val.direction switch
{
0 => OpenScripts2_BasePlugin.Axis.X,
1 => OpenScripts2_BasePlugin.Axis.Y,
2 => OpenScripts2_BasePlugin.Axis.Z,
_ => OpenScripts2_BasePlugin.Axis.X,
};
}
}
public static Vector3 Center(this Collider collider)
{
//IL_0021: 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_0051: 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_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)
CapsuleCollider val = (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null);
if (val == null)
{
SphereCollider val2 = (SphereCollider)(object)((collider is SphereCollider) ? collider : null);
if (val2 == null)
{
BoxCollider val3 = (BoxCollider)(object)((collider is BoxCollider) ? collider : null);
if (val3 != null)
{
return val3.center;
}
throw new ArgumentException($"Collider type {((object)collider).GetType()} not supported!");
}
return val2.center;
}
return val.center;
}
public static Vector3 Size(this Collider collider)
{
//IL_0072: 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)
CapsuleCollider val = (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null);
Vector3 size = default(Vector3);
if (val == null)
{
SphereCollider val2 = (SphereCollider)(object)((collider is SphereCollider) ? collider : null);
if (val2 == null)
{
BoxCollider val3 = (BoxCollider)(object)((collider is BoxCollider) ? collider : null);
if (val3 != null)
{
size = val3.size;
return size;
}
throw new ArgumentException($"Collider type {((object)collider).GetType()} not supported!");
}
((Vector3)(ref size))..ctor(val2.radius, 0f, 0f);
}
else
{
((Vector3)(ref size))..ctor(val.radius, val.height, 0f);
}
return size;
}
}
}
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 EMovementMode
{
Linear,
Planar,
Spacial
}
public enum EResetMode
{
Axis,
Rotation,
All
}
[Header("Advanced Moving FireArm Attachment Interface Config")]
public GameObject Menu;
public Transform MenuPoint;
[HideInInspector]
public TransformProxy MenuPointProxy;
public EMovementMode CurrentMovementMode;
public float[] RotationStepOptions = new float[5] { 90f, 45f, 22.5f, 11.25f, 5.625f };
public int CurrentRotationalStepOption;
public OpenScripts2_BasePlugin.Axis CurrentLimitingAxis = OpenScripts2_BasePlugin.Axis.Z;
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 OpenScripts2_BasePlugin.Axis CurrentRotationalAxis = OpenScripts2_BasePlugin.Axis.Z;
public Transform PinCheckSource;
public LayerMask PinLayerMask;
[HideInInspector]
public string UnvaultingPinTransformPath = string.Empty;
private Transform _origParent;
private Transform _pinTarget;
private bool _isPinned;
[Header("Primarily Muzzle Device Features")]
public bool OverridesDisableOnHoverOfMount;
[Tooltip("Something placed on this mount will disable the hover on disable piece again.")]
public FVRFireArmAttachmentMount OverrideDisableOverrideMount;
[Header("Secondary Clamping Part")]
[Tooltip("This transforms position will be vaulted as well")]
public Transform SecondaryPiece;
public EResetMode ResetMode;
private Vector3 _lastPos;
private Vector3 _lastHandPos;
private Vector3 _startPos;
[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 const string PIN_TRANFORM_PATH_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Pin Transform Path";
private static AssetBundle _AMFAIM_AssetBundle;
private static GameObject _AMFAIM_Prefab;
private const string ASSETBUNDLENAME = "advancedmovingattachmentinterfacemenu";
private const string PREFABNAME = "AdvancedMovingAttachmentInterfaceMenu";
private float RotationStep => RotationStepOptions[CurrentRotationalStepOption];
private Vector3 LowerLimit => new Vector3(XLimits.x, YLimits.x, ZLimits.x);
private Vector3 UpperLimit => new Vector3(XLimits.y, YLimits.y, ZLimits.y);
public bool IsPinned => _isPinned;
public override void Awake()
{
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArmAttachmentInterface)this).Awake();
MenuPointProxy = new TransformProxy(MenuPoint, deleteReferenceGameObject: true);
if ((Object)(object)Menu == (Object)null && (Object)(object)_AMFAIM_AssetBundle == (Object)null && (Object)(object)_AMFAIM_Prefab == (Object)null)
{
string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)OpenScripts2_BepInExPlugin.Instance).Info.Location), "advancedmovingattachmentinterfacemenu");
_AMFAIM_AssetBundle = AssetBundle.LoadFromFile(text);
_AMFAIM_Prefab = _AMFAIM_AssetBundle.LoadAsset<GameObject>("AdvancedMovingAttachmentInterfaceMenu");
}
_startPos = ((Component)((AnvilAsset)((FVRPhysicalObject)base.Attachment).ObjectWrapper).GetGameObject().GetComponent<FVRFireArmAttachment>().AttachmentInterface).transform.localPosition;
if ((Object)(object)Menu == (Object)null)
{
((Component)((Component)this).transform.parent).gameObject.SetActive(false);
Menu = Object.Instantiate<GameObject>(_AMFAIM_Prefab, ((Component)this).transform.parent);
((Component)((Component)this).transform.parent).gameObject.SetActive(true);
}
Menu.GetComponent<AdvancedMovingFireArmAttachmentMenu>().Interface = this;
Menu.SetActive(false);
}
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 AdvancedMovingFireArmAttachmentInterface advancedMovingFireArmAttachmentInterface)
{
DisableOnHover = advancedMovingFireArmAttachmentInterface.DisableOnHover;
advancedMovingFireArmAttachmentInterface.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)
{
if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment2 && ((FVRFireArmAttachment)customOpenScripts2Attachment2).AttachmentInterface is AdvancedMovingFireArmAttachmentInterface advancedMovingFireArmAttachmentInterface2)
{
EnableOnHover = advancedMovingFireArmAttachmentInterface2.EnableOnHover;
advancedMovingFireArmAttachmentInterface2.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);
}
}
}
_origParent = ((Component)base.Attachment).transform.parent;
if (UnvaultingPinTransformPath != string.Empty)
{
PinToPathTarget(UnvaultingPinTransformPath);
UnvaultingPinTransformPath = string.Empty;
}
}
public override void OnDetach()
{
if (base.Attachment.curMount.MyObject is CustomOpenScripts2Attachment customOpenScripts2Attachment && ((FVRFireArmAttachment)customOpenScripts2Attachment).AttachmentInterface is AdvancedMovingFireArmAttachmentInterface advancedMovingFireArmAttachmentInterface)
{
advancedMovingFireArmAttachmentInterface.DisableOnHover = DisableOnHover;
advancedMovingFireArmAttachmentInterface.EnableOnHover = EnableOnHover;
}
else
{
base.Attachment.curMount.DisableOnHover = DisableOnHover;
base.Attachment.curMount.EnableOnHover = EnableOnHover;
}
DisableOnHover = null;
EnableOnHover = null;
_origParent = null;
((FVRFireArmAttachmentInterface)this).OnDetach();
}
public override void FVRUpdate()
{
((FVRInteractiveObject)this).FVRUpdate();
if (OverridesDisableOnHoverOfMount && (Object)(object)OverrideDisableOverrideMount != (Object)null)
{
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);
}
}
}
if (Menu.activeSelf)
{
UpdateGizmos();
}
}
private void UpdateGizmos()
{
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_03be: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: 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_0052: 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_0061: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: 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)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: 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_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: 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)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_040d: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
//IL_0459: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0477: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04be: Unknown result type (might be due to invalid IL or missing references)
//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
switch (CurrentMovementMode)
{
case EMovementMode.Linear:
switch (CurrentLimitingAxis)
{
case OpenScripts2_BasePlugin.Axis.X:
Gizmos.Line(((Component)this).transform.position - ((Component)this).transform.parent.right * 0.1f, ((Component)this).transform.position + ((Component)this).transform.parent.right * 0.1f, (Color?)Color.red, false);
break;
case OpenScripts2_BasePlugin.Axis.Y:
Gizmos.Line(((Component)this).transform.position - ((Component)this).transform.parent.up * 0.1f, ((Component)this).transform.position + ((Component)this).transform.parent.up * 0.1f, (Color?)Color.green, false);
break;
case OpenScripts2_BasePlugin.Axis.Z:
Gizmos.Line(((Component)this).transform.position - ((Component)this).transform.parent.forward * 0.1f, ((Component)this).transform.position + ((Component)this).transform.parent.forward * 0.1f, (Color?)Color.blue, false);
break;
}
break;
case EMovementMode.Planar:
switch (CurrentLimitingAxis)
{
case OpenScripts2_BasePlugin.Axis.X:
Gizmos.Cube(((Component)this).transform.position, ((Component)this).transform.parent.rotation * Quaternion.Euler(0f, 90f, 0f), new Vector3(0.1f, 0.1f, 0f), (Color?)Color.red, false);
break;
case OpenScripts2_BasePlugin.Axis.Y:
Gizmos.Cube(((Component)this).transform.position, ((Component)this).transform.parent.rotation * Quaternion.Euler(90f, 0f, 0f), new Vector3(0.1f, 0.1f, 0f), (Color?)Color.green, false);
break;
case OpenScripts2_BasePlugin.Axis.Z:
Gizmos.Cube(((Component)this).transform.position, ((Component)this).transform.parent.rotation * Quaternion.Euler(0f, 0f, 0f), new Vector3(0.1f, 0.1f, 0f), (Color?)Color.blue, false);
break;
}
break;
case EMovementMode.Spacial:
Gizmos.Line(((Component)this).transform.position - ((Component)this).transform.parent.right * 0.1f, ((Component)this).transform.position + ((Component)this).transform.parent.right * 0.1f, (Color?)Color.red, false);
Gizmos.Line(((Component)this).transform.position - ((Component)this).transform.parent.up * 0.1f, ((Component)this).transform.position + ((Component)this).transform.parent.up * 0.1f, (Color?)Color.green, false);
Gizmos.Line(((Component)this).transform.position - ((Component)this).transform.parent.forward * 0.1f, ((Component)this).transform.position + ((Component)this).transform.parent.forward * 0.1f, (Color?)Color.blue, false);
break;
}
switch (CurrentRotationalAxis)
{
case OpenScripts2_BasePlugin.Axis.X:
Gizmos.Circle(((Component)this).transform.position, 0.1f, ((Component)this).transform.parent.rotation * Quaternion.Euler(0f, 90f, 0f), (Color?)Color.red, false, 16);
break;
case OpenScripts2_BasePlugin.Axis.Y:
Gizmos.Circle(((Component)this).transform.position, 0.1f, ((Component)this).transform.parent.rotation * Quaternion.Euler(90f, 0f, 0f), (Color?)Color.green, false, 16);
break;
case OpenScripts2_BasePlugin.Axis.Z:
Gizmos.Circle(((Component)this).transform.position, 0.1f, ((Component)this).transform.parent.rotation * Quaternion.Euler(0f, 0f, 0f), (Color?)Color.blue, false, 16);
break;
}
}
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;
Menu.SetActive(true);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_00b9: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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 (CurrentMovementMode)
{
case EMovementMode.Linear:
OneDegreeOfFreedom(newPosRaw);
break;
case EMovementMode.Planar:
TwoDegreesOfFreedom(newPosRaw);
break;
case EMovementMode.Spacial:
ThreeDegreesOfFreedom(newPosRaw);
break;
}
}
else if (OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.left))
{
RotateLeft();
}
else if (OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.right))
{
RotateRight();
}
_lastPos = ((Component)this).transform.position;
_lastHandPos = hand.Input.FilteredPos;
}
public void TryPin()
{
//IL_0011: 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_0029: Unknown result type (might be due to invalid IL or missing references)
if (!_isPinned)
{
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(PinCheckSource.position, PinCheckSource.forward, ref val, 0.05f, LayerMask.op_Implicit(PinLayerMask), (QueryTriggerInteraction)1))
{
_isPinned = true;
_pinTarget = ((Component)((RaycastHit)(ref val)).collider).transform.parent;
((Component)base.Attachment).transform.parent = _pinTarget;
Menu.GetComponent<AdvancedMovingFireArmAttachmentMenu>().SetPinButtonState(state: true);
}
else
{
_isPinned = false;
((Component)base.Attachment).transform.parent = _origParent;
Menu.GetComponent<AdvancedMovingFireArmAttachmentMenu>().SetPinButtonState(state: false);
}
}
else
{
_isPinned = false;
((Component)base.Attachment).transform.parent = _origParent;
Menu.GetComponent<AdvancedMovingFireArmAttachmentMenu>().SetPinButtonState(state: false);
}
}
public void RotateLeft()
{
RotatePart(forward: true);
}
public void RotateRight()
{
RotatePart(forward: false);
}
public void CloseMenu()
{
Menu.SetActive(false);
}
public void Reset()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
switch (ResetMode)
{
case EResetMode.Axis:
((Component)this).transform.ModifyLocalPositionAxisValue(CurrentLimitingAxis, 0f);
break;
case EResetMode.Rotation:
((Component)this).transform.ModifyLocalRotationAxisValue(CurrentRotationalAxis, 0f);
break;
case EResetMode.All:
((Component)this).transform.localPosition = _startPos;
((Component)this).transform.localRotation = Quaternion.identity;
break;
}
}
private void RotatePart(bool forward)
{
int num = (forward ? 1 : (-1));
switch (CurrentRotationalAxis)
{
case OpenScripts2_BasePlugin.Axis.X:
((Component)this).transform.Rotate((float)num * RotationStep, 0f, 0f);
break;
case OpenScripts2_BasePlugin.Axis.Y:
((Component)this).transform.Rotate(0f, (float)num * RotationStep, 0f);
break;
case OpenScripts2_BasePlugin.Axis.Z:
((Component)this).transform.Rotate(0f, 0f, (float)num * RotationStep);
break;
}
}
public void NextResetMode()
{
ResetMode++;
if (ResetMode > EResetMode.All)
{
ResetMode = EResetMode.Axis;
}
}
public void PreviousResetMode()
{
ResetMode--;
if (ResetMode < EResetMode.Axis)
{
ResetMode = EResetMode.All;
}
}
public void NextDegreeOfFreedom()
{
CurrentMovementMode++;
if (CurrentMovementMode > EMovementMode.Spacial)
{
CurrentMovementMode = EMovementMode.Linear;
}
}
public void PreviousDegreeOfFreedom()
{
CurrentMovementMode--;
if (CurrentMovementMode < EMovementMode.Linear)
{
CurrentMovementMode = EMovementMode.Spacial;
}
}
public void NextLimitingAxis()
{
CurrentLimitingAxis++;
if (CurrentLimitingAxis > OpenScripts2_BasePlugin.Axis.Z)
{
CurrentLimitingAxis = OpenScripts2_BasePlugin.Axis.X;
}
}
public void PreviousLimitingAxis()
{
CurrentLimitingAxis--;
if (CurrentLimitingAxis < OpenScripts2_BasePlugin.Axis.X)
{
CurrentLimitingAxis = OpenScripts2_BasePlugin.Axis.Z;
}
}
public void NextRotationalAxis()
{
CurrentRotationalAxis++;
if (CurrentRotationalAxis > OpenScripts2_BasePlugin.Axis.Z)
{
CurrentRotationalAxis = OpenScripts2_BasePlugin.Axis.X;
}
}
public void PreviousRotationalAxis()
{
CurrentRotationalAxis--;
if (CurrentRotationalAxis < OpenScripts2_BasePlugin.Axis.X)
{
CurrentRotationalAxis = OpenScripts2_BasePlugin.Axis.Z;
}
}
public void NextRotationalStepOption()
{
CurrentRotationalStepOption++;
if (CurrentRotationalStepOption >= RotationStepOptions.Length)
{
CurrentRotationalStepOption = 0;
}
}
public void PreviousRotationalStepOption()
{
CurrentRotationalStepOption--;
if (CurrentRotationalStepOption < 0)
{
CurrentRotationalStepOption = RotationStepOptions.Length - 1;
}
}
private void OneDegreeOfFreedom(Vector3 newPosRaw)
{
//IL_0001: 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_0017: 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_0026: 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_0039: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0050: 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_005d: 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)
Vector3 val = LowerLimit.GetCombinedAxisVector(CurrentLimitingAxis, ((Component)this).transform.localPosition).ApproximateInfiniteComponent(100f);
Vector3 val2 = UpperLimit.GetCombinedAxisVector(CurrentLimitingAxis, ((Component)this).transform.localPosition).ApproximateInfiniteComponent(100f);
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(val, val2, ((Component)this).transform.parent.InverseTransformPoint(newPosRaw));
((Component)this).transform.localPosition = closestValidPoint;
}
private void TwoDegreesOfFreedom(Vector3 newPosRaw)
{
//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)
//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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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)
Vector3 val = newPosRaw.ProjectOnPlaneThroughPoint(((Component)this).transform.position, ((Component)this).transform.parent.GetLocalDirAxis(CurrentLimitingAxis));
Vector3 localPosition = ((Component)this).transform.parent.InverseTransformPoint(val).Clamp(LowerLimit, UpperLimit);
((Component)this).transform.localPosition = localPosition;
}
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);
}
public string GetPinTargetPath()
{
return GetTransformPath(_pinTarget);
}
public void PinToPathTarget(string path)
{
Transform transform = ((Component)base.Attachment.curMount.GetRootMount().MyObject).transform;
Transform pinTarget = ReturnTransfromFromPath(transform, path);
_isPinned = true;
_pinTarget = pinTarget;
((Component)base.Attachment).transform.parent = _pinTarget;
}
private string GetTransformPath(Transform t, string path = "")
{
path = ((!(path == "")) ? (((Object)t).name + "/" + path) : ((Object)t).name);
if ((Object)(object)t != (Object)(object)((Component)base.Attachment.curMount.GetRootMount().MyObject).transform)
{
path = GetTransformPath(t.parent, path);
}
return path;
}
private Transform ReturnTransfromFromPath(Transform root, string path)
{
string[] array = path.Split(new char[1] { '/' });
Transform val = root;
for (int i = 1; i < array.Length; i++)
{
string text = array[i];
val = val.Find(text);
}
return val;
}
[ContextMenu("Copy existing Interface's values")]
public void CopyInterface()
{
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);
}
}
public class AdvancedMovingFireArmAttachmentMenu : OpenScripts2_BasePlugin
{
public AdvancedMovingFireArmAttachmentInterface Interface;
public Text ModeText;
public Text LimitingAxisText;
public Text RotationAxisText;
public Text RotationStepText;
public Text ResetMode;
public OptionsPanel_ButtonSet PinButtonSet;
public BoxCollider OverlapCollider;
public LayerMask HitMask;
private Vector3 _center;
private Vector3 _halfExtends;
private Collider[] _hits;
public void Awake()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
_hits = (Collider[])(object)new Collider[32];
_halfExtends = ((Component)OverlapCollider).transform.lossyScale.MultiplyComponentWise(OverlapCollider.size) / 2f;
_halfExtends.z = 0.005f;
((Component)this).gameObject.SetActive(false);
}
public void Update()
{
if ((Object)(object)Interface != (Object)null)
{
UpdateMenu();
CheckForOverlap();
}
}
private void UpdateMenu()
{
ModeText.text = (int)(Interface.CurrentMovementMode + 1) + "D: " + Interface.CurrentMovementMode;
LimitingAxisText.text = LimitingAxisTextGenerator();
RotationAxisText.text = "Rotation Axis: " + Interface.CurrentRotationalAxis;
RotationStepText.text = "Rotation Step: " + Interface.RotationStepOptions[Interface.CurrentRotationalStepOption] + "°";
Text resetMode = ResetMode;
resetMode.text = Interface.ResetMode switch
{
AdvancedMovingFireArmAttachmentInterface.EResetMode.Axis => "Reset Position Axis",
AdvancedMovingFireArmAttachmentInterface.EResetMode.Rotation => "Reset Rotation Axis",
AdvancedMovingFireArmAttachmentInterface.EResetMode.All => "Reset All",
_ => throw new NotImplementedException(),
};
if (((Component)PinButtonSet).gameObject.activeSelf && (Object)(object)Interface.PinCheckSource == (Object)null)
{
((Component)PinButtonSet).gameObject.SetActive(false);
}
}
private void CheckForOverlap()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_0026: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: 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)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
Vector3 localPosition = Interface.MenuPointProxy.localPosition;
localPosition = Interface.MenuPointProxy.parent.localRotation.Invert() * localPosition;
localPosition = Interface.MenuPointProxy.parent.TransformPoint(localPosition);
if (((Component)this).transform.position.NotEqual(localPosition))
{
((Component)this).transform.position = localPosition;
}
_center = ((Component)OverlapCollider).transform.position;
int num = Physics.OverlapBoxNonAlloc(_center, _halfExtends, _hits, ((Component)OverlapCollider).transform.rotation, LayerMask.op_Implicit(HitMask), (QueryTriggerInteraction)1);
Vector3[] array = (Vector3[])(object)new Vector3[num];
float[] array2 = new float[num];
if (num <= 0)
{
return;
}
float z = OverlapCollider.size.z;
Vector3 size = OverlapCollider.size;
size.z = 2000f;
OverlapCollider.size = size;
Vector3 val2 = default(Vector3);
float num2 = default(float);
for (int i = 0; i < num; i++)
{
Collider val = _hits[i];
Vector3 position = ((Component)val).transform.position;
Quaternion rotation = ((Component)val).transform.rotation;
if (Physics.ComputePenetration((Collider)(object)OverlapCollider, ((Component)OverlapCollider).transform.position, ((Component)OverlapCollider).transform.rotation, val, position, rotation, ref val2, ref num2))
{
array[i] = val2;
array2[i] = num2 * 1.1f;
}
}
size.z = z;
OverlapCollider.size = size;
int num3 = 0;
float num4 = float.MinValue;
for (int j = 0; j < num; j++)
{
if (array2[j] > num4)
{
num4 = array2[j];
num3 = j;
}
}
((Component)this).transform.position = ((Component)this).transform.position + array[num3] * array2[num3];
}
private string LimitingAxisTextGenerator()
{
return Interface.CurrentMovementMode switch
{
AdvancedMovingFireArmAttachmentInterface.EMovementMode.Linear => "Current Axis: " + Interface.CurrentLimitingAxis,
AdvancedMovingFireArmAttachmentInterface.EMovementMode.Planar => Interface.CurrentLimitingAxis switch
{
Axis.X => "Current Plane: YZ",
Axis.Y => "Current Plane: XZ",
Axis.Z => "Current Plane: XY",
_ => string.Empty,
},
AdvancedMovingFireArmAttachmentInterface.EMovementMode.Spacial => "Spacial Mode: Unlimited",
_ => string.Empty,
};
}
public void SetPinButtonState(bool state)
{
PinButtonSet.SetSelectedButton(state);
}
public void NextResetMode()
{
Interface.NextResetMode();
}
public void PreviousResetMode()
{
Interface.PreviousResetMode();
}
public void NextDegreeOfFreedom()
{
Interface.NextDegreeOfFreedom();
}
public void PreviousDegreeOfFreedom()
{
Interface.PreviousDegreeOfFreedom();
}
public void NextLimitingAxis()
{
Interface.NextLimitingAxis();
}
public void PreviousLimitingAxis()
{
Interface.PreviousLimitingAxis();
}
public void NextRotationalAxis()
{
Interface.NextRotationalAxis();
}
public void PreviousRotationalAxis()
{
Interface.PreviousRotationalAxis();
}
public void NextRotationalStepOption()
{
Interface.NextRotationalStepOption();
}
public void PreviousRotationalStepOption()
{
Interface.PreviousRotationalStepOption();
}
public void Reset()
{
Interface.Reset();
}
public void CloseMenu()
{
Interface.CloseMenu();
}
public void RotateLeft()
{
Interface.RotateLeft();
}
public void RotateRight()
{
Interface.RotateRight();
}
public void TryPin()
{
Interface.TryPin();
}
}
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 MovingAttachmentInterfaceLimiterAddon : OpenScripts2_BasePlugin
{
public FVRFireArmAttachment Attachment;
public Vector2 NewXLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public Vector2 NewYLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public Vector2 NewZLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
private Vector2 _oldLowerLimit;
private Vector2 _oldUpperLimit;
private MovingFireArmAttachmentInterface _interface;
public void Update()
{
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: 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 refere