Decompiled source of H3VRUtilities v8.11.1
monomod/H3VRUtilities/Assembly-CSharp.H3VRUtilities.mm.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using FistVR; using H3VRUtils.FVRInteractiveObjects; using H3VRUtils.NewScripts; using UnityEngine; using UnityEngine.Serialization; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace FistVR { public class AR15HandleFlipperSounds : FVRInteractiveObject { public enum Axis { X, Y, Z } private bool m_isLargeAperture = true; public Transform Flipsight; public float m_flipsightStartRotX; public float m_flipsightEndRotX = -90f; private float m_flipsightCurRotX; public Axis RotAxis; private float m_curFlipLerp; private float m_tarFlipLerp; private float m_lastFlipLerp; public AudioEvent AudClipOpen; public AudioEvent AudClipClose; public override void Awake() { ((FVRInteractiveObject)this).Awake(); } public override void SimpleInteraction(FVRViveHand hand) { //IL_0042: 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) ((FVRInteractiveObject)this).SimpleInteraction(hand); m_isLargeAperture = !m_isLargeAperture; try { if (!m_isLargeAperture) { SM.PlayGenericSound(AudClipOpen, ((Component)this).transform.position); } else { SM.PlayGenericSound(AudClipClose, ((Component)this).transform.position); } } catch { Console.WriteLine(((Object)this).name + " failed to play sound!"); } } public override void FVRUpdate() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00ed: 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_008d: Invalid comparison between Unknown and I4 //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 //IL_00a9: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (m_isLargeAperture) { m_tarFlipLerp = 0f; } else { m_tarFlipLerp = 1f; } m_curFlipLerp = Mathf.MoveTowards(m_curFlipLerp, m_tarFlipLerp, Time.deltaTime * 4f); if (Mathf.Abs(m_curFlipLerp - m_lastFlipLerp) > 0.01f) { m_flipsightCurRotX = Mathf.Lerp(m_flipsightStartRotX, m_flipsightEndRotX, m_curFlipLerp); Axis rotAxis = RotAxis; if ((int)rotAxis != 0) { if ((int)rotAxis != 1) { if ((int)rotAxis == 2) { Flipsight.localEulerAngles = new Vector3(0f, 0f, m_flipsightCurRotX); } } else { Flipsight.localEulerAngles = new Vector3(0f, m_flipsightCurRotX, 0f); } } else { Flipsight.localEulerAngles = new Vector3(m_flipsightCurRotX, 0f, 0f); } } m_lastFlipLerp = m_curFlipLerp; } } } namespace H3VRUtils { [BepInPlugin("dll.wfiost.h3vrutilitieslib", "H3VR Utilities Library", "8.11.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("h3vr.exe")] public class BepInExLoader_Lib : BaseUnityPlugin { } public class GetFireArmDeets { public static FVRFireArmChamber[] GetFireArmChamber(FVRFireArm firearm) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown List<FVRFireArmChamber> list = new List<FVRFireArmChamber>(); BreakActionWeapon val = (BreakActionWeapon)(object)((firearm is BreakActionWeapon) ? firearm : null); if (val == null) { Derringer val2 = (Derringer)(object)((firearm is Derringer) ? firearm : null); if (val2 == null) { SingleActionRevolver val3 = (SingleActionRevolver)(object)((firearm is SingleActionRevolver) ? firearm : null); if (val3 == null) { Revolver val4 = (Revolver)(object)((firearm is Revolver) ? firearm : null); if (val4 != null) { return val4.Chambers; } FieldInfo field = ((object)firearm).GetType().GetField("Chamber"); if ((object)field != null) { list.Add((FVRFireArmChamber)field.GetValue(firearm)); return list.ToArray(); } field = ((object)firearm).GetType().GetField("Chambers"); if ((object)field != null) { list = (List<FVRFireArmChamber>)field.GetValue(firearm); return list.ToArray(); } return null; } return val3.Cylinder.Chambers; } foreach (DBarrel barrel in val2.Barrels) { list.Add(barrel.Chamber); } return list.ToArray(); } BreakActionBarrel[] barrels = val.Barrels; foreach (BreakActionBarrel val5 in barrels) { list.Add(val5.Chamber); } return list.ToArray(); } public static FVRFirearmMovingProxyRound[] GetFireArmProxySwitch(FVRFireArm firearm, bool tryReflection = true) { List<FVRFirearmMovingProxyRound> list = new List<FVRFirearmMovingProxyRound>(); Handgun val = (Handgun)(object)((firearm is Handgun) ? firearm : null); if (val == null) { ClosedBoltWeapon val2 = (ClosedBoltWeapon)(object)((firearm is ClosedBoltWeapon) ? firearm : null); if (val2 == null) { OpenBoltReceiver val3 = (OpenBoltReceiver)(object)((firearm is OpenBoltReceiver) ? firearm : null); if (val3 == null) { LeverActionFirearm val4 = (LeverActionFirearm)(object)((firearm is LeverActionFirearm) ? firearm : null); if (val4 == null) { BoltActionRifle val5 = (BoltActionRifle)(object)((firearm is BoltActionRifle) ? firearm : null); if (val5 == null) { TubeFedShotgun val6 = (TubeFedShotgun)(object)((firearm is TubeFedShotgun) ? firearm : null); if (val6 == null) { if (!(firearm is Airgun) && tryReflection) { list = GetFireArmProxyReflection(firearm).ToList(); } } else { list.Add(val6.m_proxy); } } else { list.Add(val5.m_proxy); } } else { list.Add(val4.m_proxy); list.Add(val4.m_proxy2); } } else { list.Add(val3.m_proxy); } } else { list.Add(val2.m_proxy); } } else { list.Add(val.m_proxy); } list.RemoveAll((FVRFirearmMovingProxyRound item) => (Object)(object)item == (Object)null); return list.ToArray(); } public static FVRFirearmMovingProxyRound[] GetFireArmProxyReflection(FVRFireArm firearm) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown if ((Object)(object)firearm == (Object)null) { Debug.Log((object)"GetFirearmDeets.GetFireArmProxy: Firearm is null!"); return null; } List<FVRFirearmMovingProxyRound> list = new List<FVRFirearmMovingProxyRound>(); FieldInfo field = ((object)firearm).GetType().GetField("m_proxy"); FieldInfo field2 = ((object)firearm).GetType().GetField("m_proxy2"); if ((object)field != null) { object value = field.GetValue(firearm); if (value != null) { list.Add((FVRFirearmMovingProxyRound)value); } } if ((object)field2 != null) { object value2 = field2.GetValue(firearm); if (value2 != null) { list.Add((FVRFirearmMovingProxyRound)value2); } } return list.ToArray(); } } internal class attachmentXFoldingStock : FVRFoldingStockXAxis { public FVRFireArmAttachment attachment; private float rotAngle; public void FixedUpdate() { if ((Object)(object)attachment.curMount != (Object)null) { if ((Object)(object)base.FireArm == (Object)null) { FVRFireArm component = ((Component)attachment.curMount.Parent).GetComponent<FVRFireArm>(); base.FireArm = component; Console.WriteLine("attachmentYFoldingStock has connected itself to " + (object)base.FireArm); } } else if ((Object)(object)base.FireArm != (Object)null) { base.FireArm = null; } } public override void UpdateInteraction(FVRViveHand hand) { try { ((FVRFoldingStockXAxis)this).UpdateInteraction(hand); } catch { } } } public class attachmentYFoldingStock : FVRInteractiveObject { public enum UpRightForward { Up, Down, Left, Right, Forward, Backwards } public enum StockPos { Closed, Mid, Open } [Header("Audio - AudioClose/Open only work if UseFirearmHoldingSounds is false!")] public bool UseFirearmFoldingSounds = true; public AudioEvent AudioClose; public AudioEvent AudioOpen; public UpRightForward DirOfRotation; [FormerlySerializedAs("Root")] public Transform root; [FormerlySerializedAs("Stock")] public Transform stock; public float minRot; public float maxRot; [Tooltip("Default 5; this is the angle diff at which point the stock clamps to closed/open. (AKA: if angle is 4, and minRot is 0, the difference is less than 5, so it just clamps to 0.)")] public float clampStrength = 5f; [FormerlySerializedAs("m_curPos")] public StockPos mCurPos; [FormerlySerializedAs("m_lastPos")] public StockPos mLastPos; public bool isMinClosed = true; [FormerlySerializedAs("FireArm")] [Tooltip("Leave as null if attachment.")] public FVRFireArm fireArm; public FVRFireArmAttachment attachment; [Header("Alternate Use Settings")] [Tooltip("If true, it will not affect the stock point.")] public bool isNotAttachment; public bool forBreakOpenFlareGun; public BreakOpenFlareGun flareGun; public float _rotAngle; [HideInInspector] public Vector3 lhs; public override void UpdateInteraction(FVRViveHand hand) { //IL_000d: 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_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_0023: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006b: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Invalid comparison between Unknown and I4 //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Invalid comparison between Unknown and I4 //IL_02e1: 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_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 val = ((Component)hand).transform.position - root.position; Vector3 val2 = Vector3.ProjectOnPlane(val, root.up); val = ((Vector3)(ref val2)).normalized; Vector3 val3 = -((Component)root).transform.forward; _rotAngle = Mathf.Atan2(Vector3.Dot(root.up, Vector3.Cross(val3, val)), Vector3.Dot(val3, val)) * 57.29578f; if (Mathf.Abs(_rotAngle - minRot) < 5f) { _rotAngle = minRot; } if (Mathf.Abs(_rotAngle - maxRot) < 5f) { _rotAngle = maxRot; } if (!(_rotAngle >= minRot) || !(_rotAngle <= maxRot)) { return; } stock.localEulerAngles = new Vector3(0f, _rotAngle, 0f); float num = Mathf.InverseLerp(minRot, maxRot, _rotAngle); if (!((Object)(object)fireArm != (Object)null)) { return; } if (isMinClosed) { if (num < 0.02f) { mCurPos = (StockPos)0; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } else if (num > 0.9f) { mCurPos = (StockPos)2; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = true; } } else { mCurPos = (StockPos)1; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } } else if (num < 0.1f) { mCurPos = (StockPos)2; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = true; } } else if (num > 0.98f) { mCurPos = (StockPos)0; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } else { mCurPos = (StockPos)1; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } if ((int)mCurPos == 2 && (int)mLastPos != 2 && !forBreakOpenFlareGun) { if (UseFirearmFoldingSounds && (Object)(object)fireArm != (Object)null) { fireArm.PlayAudioEvent((FirearmAudioEventType)30, 1f); } if (!UseFirearmFoldingSounds) { SM.PlayGenericSound(AudioOpen, ((Component)this).transform.position); } } if ((int)mCurPos == 0 && (int)mLastPos != 0) { if (UseFirearmFoldingSounds && (Object)(object)fireArm != (Object)null) { fireArm.PlayAudioEvent((FirearmAudioEventType)31, 1f); } if (!UseFirearmFoldingSounds) { SM.PlayGenericSound(AudioClose, ((Component)this).transform.position); } if (forBreakOpenFlareGun) { flareGun.Latch(); } } if ((int)mCurPos != 0 && (int)mLastPos == 0 && forBreakOpenFlareGun) { if (UseFirearmFoldingSounds && (Object)(object)fireArm != (Object)null) { fireArm.PlayAudioEvent((FirearmAudioEventType)30, 1f); } if (!UseFirearmFoldingSounds) { SM.PlayGenericSound(AudioOpen, ((Component)this).transform.position); } if (forBreakOpenFlareGun) { flareGun.Unlatch(); } } mLastPos = mCurPos; } private void OnDrawGizmosSelected() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_003d: 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_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_007f: 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_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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) if (Application.isPlaying) { Gizmos.color = new Color(0.1f, 0.3f, 0.9f); Gizmos.DrawWireCube(((Component)stock).transform.position, Vector3.one * 0.025f); Gizmos.color = new Color(0.1f, 0.3f, 0.9f, 0.5f); Gizmos.DrawCube(((Component)stock).transform.position, Vector3.one * 0.025f); float timeSinceLevelLoad = Time.timeSinceLevelLoad; Gizmos.color = new Color(0.1f, 0.7f, 0.9f, Mathf.Clamp01((0.5f - timeSinceLevelLoad) * 2f)); Gizmos.DrawWireCube(((Component)stock).transform.position, Vector3.one * (0.1f * (timeSinceLevelLoad + 0.5f))); } Vector3 val = ((Component)stock).transform.position + -((Component)stock).transform.forward; Gizmos.color = new Color(0.7f, 0.9f, 0.1f); Gizmos.DrawWireCube(val, Vector3.one * 0.02f); Gizmos.color = new Color(0.7f, 0.9f, 0.1f, 0.5f); Gizmos.DrawCube(val, Vector3.one * 0.02f); Gizmos.color = new Color(0.9f, 0.7f, 0.1f); Vector3 val2 = ((Component)root).transform.up; Vector3 val3 = -((Component)root).transform.forward; switch (DirOfRotation) { case UpRightForward.Down: val2 = -((Component)root).transform.up; val3 = ((Component)root).transform.forward; break; case UpRightForward.Left: val2 = -((Component)root).transform.right; val3 = ((Component)root).transform.up; break; case UpRightForward.Right: val2 = ((Component)root).transform.right; val3 = -((Component)root).transform.up; break; case UpRightForward.Forward: val2 = ((Component)root).transform.forward; val3 = -((Component)root).transform.right; break; case UpRightForward.Backwards: val2 = -((Component)root).transform.forward; val3 = ((Component)root).transform.right; break; } Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(minRot, val2) * val3); Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(0f - maxRot, val2) * val3); } } public class H3VRUtilsMagRelease : FVRInteractiveObject { public enum TouchpadDirType { Up, Down, Left, Right, Trigger, NoDirection } public ClosedBoltWeapon ClosedBoltReceiver; public OpenBoltReceiver OpenBoltWeapon; public Handgun HandgunReceiver; public BoltActionRifle BoltActionWeapon; [HideInInspector] public int WepType; [HideInInspector] public bool DisallowEjection; private FVRFireArmMagazine mag; private Collider col; public bool PressDownToRelease; public TouchpadDirType TouchpadDir; public Vector2 dir; public override void Awake() { ((FVRInteractiveObject)this).Awake(); setWepType(); col = ((Component)this).GetComponent<Collider>(); } public void setWepType() { if ((Object)(object)ClosedBoltReceiver != (Object)null) { WepType = 1; } if ((Object)(object)OpenBoltWeapon != (Object)null) { WepType = 2; } if ((Object)(object)HandgunReceiver != (Object)null) { WepType = 3; } if ((Object)(object)BoltActionWeapon != (Object)null) { WepType = 4; } } public override bool IsInteractable() { if (WepType == 1) { return !((Object)(object)((FVRFireArm)ClosedBoltReceiver).Magazine == (Object)null); } if (WepType == 2) { return !((Object)(object)((FVRFireArm)OpenBoltWeapon).Magazine == (Object)null); } if (WepType == 3) { return !((Object)(object)((FVRFireArm)HandgunReceiver).Magazine == (Object)null); } return !((Object)(object)((FVRFireArm)BoltActionWeapon).Magazine == (Object)null); } public override void FVRFixedUpdate() { //IL_0007: 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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0035: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown ((FVRInteractiveObject)this).FVRFixedUpdate(); dir = Vector2.up; if ((int)UtilsBepInExLoader.paddleMagReleaseDir.Value != 5) { TouchpadDir = (TouchpadDirType)UtilsBepInExLoader.paddleMagReleaseDir.Value; } dir = TouchpadDirTypeToVector2(TouchpadDir); if (dir == Vector2.zero) { base.IsSimpleInteract = true; } else { base.IsSimpleInteract = false; } col.enabled = !DisallowEjection; } public static Vector2 TouchpadDirTypeToVector2(TouchpadDirType TouchpadDir) { //IL_0002: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) Vector2 result = default(Vector2); if (TouchpadDir == TouchpadDirType.Up) { result = Vector2.up; } if (TouchpadDir == TouchpadDirType.Down) { result = Vector2.down; } if (TouchpadDir == TouchpadDirType.Left) { result = Vector2.left; } if (TouchpadDir == TouchpadDirType.Right) { result = Vector2.right; } if (TouchpadDir == TouchpadDirType.Trigger) { result = Vector2.zero; } if (TouchpadDir == TouchpadDirType.NoDirection) { ((Vector2)(ref result))..ctor(999f, 999f); } return result; } public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (TouchpadDir == TouchpadDirType.Trigger) { dropmag(hand); } } public void dropmag(FVRViveHand hand, bool _override = false) { if (!DisallowEjection || _override) { FVRFireArmMagazine magazine = null; if (WepType == 1) { magazine = ((FVRFireArm)ClosedBoltReceiver).Magazine; ClosedBoltReceiver.ReleaseMag(); } if (WepType == 2) { magazine = ((FVRFireArm)OpenBoltWeapon).Magazine; OpenBoltWeapon.ReleaseMag(); } if (WepType == 3) { magazine = ((FVRFireArm)HandgunReceiver).Magazine; HandgunReceiver.ReleaseMag(); } if (WepType == 4) { magazine = ((FVRFireArm)BoltActionWeapon).Magazine; BoltActionWeapon.ReleaseMag(); } movemagtohand(hand, magazine); } } public void movemagtohand(FVRViveHand hand, FVRFireArmMagazine magazine) { if ((Object)(object)hand != (Object)null) { hand.ForceSetInteractable((FVRInteractiveObject)(object)magazine); } ((FVRInteractiveObject)magazine).BeginInteraction(hand); } public override void UpdateInteraction(FVRViveHand hand) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); bool flag = false; FVRFireArmMagazine magazine = null; if ((Object)(object)mag != (Object)null) { flag = true; magazine = mag; } if (WepType == 1) { mag = ((FVRFireArm)ClosedBoltReceiver).Magazine; } if (WepType == 2) { mag = ((FVRFireArm)OpenBoltWeapon).Magazine; } if (WepType == 3) { mag = ((FVRFireArm)HandgunReceiver).Magazine; } if (WepType == 4) { mag = ((FVRFireArm)BoltActionWeapon).Magazine; } if ((Object)(object)mag != (Object)null) { bool flag2 = false; if (Vector2.Angle(hand.Input.TouchpadAxes, dir) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { flag2 = true; } if ((!PressDownToRelease || !UtilsBepInExLoader.paddleMagRelease.Value || (TouchpadDir == TouchpadDirType.NoDirection && !UtilsBepInExLoader.magDropRequiredRelease.Value) || flag2 || (hand.IsInStreamlinedMode && hand.Input.AXButtonPressed)) && (TouchpadDir != TouchpadDirType.NoDirection || !UtilsBepInExLoader.magDropRequiredRelease.Value)) { dropmag(hand); ((FVRInteractiveObject)this).EndInteraction(hand); } } else { if (flag) { movemagtohand(hand, magazine); } ((FVRInteractiveObject)this).EndInteraction(hand); } } } public class H3VRUtilsPhysBoltRelease : FVRInteractiveObject { public ClosedBoltWeapon ClosedBoltReceiver; public bool ButtonPressToRelease; [HideInInspector] public Vector2 dir; public H3VRUtilsMagRelease.TouchpadDirType TouchpadDir; [HideInInspector] public int WepType; public override void Awake() { ((FVRInteractiveObject)this).Awake(); if ((Object)(object)ClosedBoltReceiver != (Object)null) { WepType = 1; } } public override void FVRFixedUpdate() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) ((FVRInteractiveObject)this).FVRFixedUpdate(); if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Up) { dir = Vector2.up; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Down) { dir = Vector2.down; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Left) { dir = Vector2.left; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Right) { dir = Vector2.right; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Trigger) { base.IsSimpleInteract = true; } else { base.IsSimpleInteract = false; } } protected void OnHoverStay(FVRViveHand hand) { if ((TouchpadDir != H3VRUtilsMagRelease.TouchpadDirType.Trigger || hand.IsInStreamlinedMode) && (!hand.IsInStreamlinedMode || hand.Input.AXButtonPressed)) { ReleaseBolt(hand); } } public override void SimpleInteraction(FVRViveHand hand) { if (base.IsSimpleInteract) { ReleaseBolt(hand); } } public void ReleaseBolt(FVRViveHand hand, bool _forceDrop = false) { //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) bool flag = false; if (Vector2.Angle(hand.Input.TouchpadAxes, dir) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { flag = true; } if (flag || (hand.IsInStreamlinedMode && hand.Input.AXButtonPressed)) { ClosedBoltReceiver.Bolt.ReleaseBolt(); } if (!((Object)(object)((FVRInteractiveObject)ClosedBoltReceiver).m_hand == (Object)null)) { _ = (Object)(object)hand != (Object)(object)((FVRInteractiveObject)ClosedBoltReceiver).m_hand; } } } internal class HandgunSecondarySwitch : FVRInteractiveObject { public Handgun Weapon; public int CurModeIndex; public int ModeIndexToSub = 1; public Transform SelctorSwitch; public Axis Axis; public InterpStyle InterpStyle; public FireSelectorMode[] Modes; public void Awake() { UpdateBaseGunSelector(CurModeIndex); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); CycleMode(); } private void CycleMode() { CurModeIndex++; if (CurModeIndex >= Modes.Length) { CurModeIndex = 0; } UpdateBaseGunSelector(CurModeIndex); ((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)15, 1f); } private void UpdateBaseGunSelector(int i) { //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_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) FireSelectorMode val = Modes[i]; ((FVRPhysicalObject)Weapon).SetAnimatedComponent(SelctorSwitch, val.SelectorPosition, InterpStyle, Axis); FireSelectorMode obj = Weapon.FireSelectorModes[ModeIndexToSub]; obj.ModeType = val.ModeType; obj.BurstAmount = val.BurstAmount; Weapon.ResetCamBurst(); } } public class BreakOpenFlareGun : FVRFireArm { [Header("Flaregun Params")] public Renderer[] GunUndamaged; public Renderer[] GunDamaged; public FVRFireArmChamber Chamber; public Axis HingeAxis; public Transform Hinge; public float RotOut = 35f; public bool CanUnlatch = true; public bool IsHighPressureTolerant; private bool m_isHammerCocked; private bool m_isTriggerReset = true; private bool m_isLatched = true; private bool m_isDestroyed; private float TriggerFloat; public Transform Hammer; public bool HasVisibleHammer = true; public bool CanCockHammer = true; public bool CocksOnOpen; private float m_hammerXRot; public Axis HammerAxis; public InterpStyle HammerInterp = (InterpStyle)1; public float HammerMinRot; public float HammerMaxRot = -70f; public Transform Trigger; public Vector2 TriggerForwardBackRots; public Transform Muzzle; public ParticleSystem SmokePSystem; public ParticleSystem DestroyPSystem; public bool DeletesCartridgeOnFire; public override void Awake() { ((FVRFireArm)this).Awake(); if (CanUnlatch) { Chamber.IsAccessible = false; } else { Chamber.IsAccessible = true; } } public override void FVRUpdate() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (HasVisibleHammer) { if (m_isHammerCocked) { m_hammerXRot = Mathf.Lerp(m_hammerXRot, HammerMaxRot, Time.deltaTime * 12f); } else { m_hammerXRot = Mathf.Lerp(m_hammerXRot, 0f, Time.deltaTime * 25f); } Hammer.localEulerAngles = new Vector3(m_hammerXRot, 0f, 0f); } if (!m_isLatched && Vector3.Angle(Vector3.up, ((Component)Chamber).transform.forward) < 70f && Chamber.IsFull && Chamber.IsSpent) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); Chamber.EjectRound(((Component)Chamber).transform.position + ((Component)Chamber).transform.forward * -0.06f, ((Component)Chamber).transform.forward * -0.01f, Vector3.right, false); } } private void ToggleLatchState() { if (m_isLatched) { Unlatch(); } else if (!m_isLatched) { Latch(); } } public override void UpdateInteraction(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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_002b: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); float num = 0f; Axis hingeAxis = HingeAxis; if ((int)hingeAxis != 0) { if ((int)hingeAxis != 1) { if ((int)hingeAxis == 2) { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).z; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).y; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).x; } if (num > 15f && CanUnlatch) { Unlatch(); } else if (num < -15f && CanUnlatch) { Latch(); } bool flag = false; bool flag2 = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && CanUnlatch) { flag2 = true; } if (hand.Input.AXButtonDown) { flag = true; } } else if (hand.Input.TouchpadDown) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) < 45f && CanCockHammer) { CockHammer(); } else if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && (Vector2.Angle(touchpadAxes, Vector2.left) < 45f || Vector2.Angle(touchpadAxes, Vector2.right) < 45f) && CanUnlatch) { ToggleLatchState(); } } } if (flag) { CockHammer(); } if (flag2) { ToggleLatchState(); } if (m_isDestroyed) { return; } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld) { TriggerFloat = hand.Input.TriggerFloat; } else { TriggerFloat = 0f; } float num2 = Mathf.Lerp(TriggerForwardBackRots.x, TriggerForwardBackRots.y, TriggerFloat); Trigger.localEulerAngles = new Vector3(num2, 0f, 0f); if (TriggerFloat > 0.7f) { if (m_isTriggerReset && m_isHammerCocked) { m_isTriggerReset = false; m_isHammerCocked = false; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMinRot, HammerInterp, HammerAxis); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); Fire(); } } else if (TriggerFloat < 0.2f && !m_isTriggerReset) { m_isTriggerReset = true; } } public void Fire() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (m_isLatched && Chamber.Fire()) { ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); if (Chamber.GetRound().IsHighPressure && !IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); Destroy(); } else if (IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); } ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { Chamber.IsSpent = false; Chamber.UpdateProxyDisplay(); } else if (Chamber.GetRound().IsCaseless) { Chamber.SetRound((FVRFireArmRound)null, false); } if (DeletesCartridgeOnFire) { Chamber.SetRound((FVRFireArmRound)null, false); } } } public void Unlatch() { if (m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); m_isLatched = false; Chamber.IsAccessible = true; if (CocksOnOpen) { CockHammer(); } } } public void Latch() { if (!m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); m_isLatched = true; Chamber.IsAccessible = false; } } public void CockHammer() { //IL_0037: 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) if (!m_isHammerCocked) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); m_isHammerCocked = true; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMaxRot, HammerInterp, HammerAxis); } } } private void Destroy() { if (!m_isDestroyed) { m_isDestroyed = true; DestroyPSystem.Emit(25); for (int i = 0; i < GunUndamaged.Length; i++) { GunUndamaged[i].enabled = false; GunDamaged[i].enabled = true; } } } public override List<FireArmRoundClass> GetChamberRoundList() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (Chamber.IsFull && !Chamber.IsSpent) { return new List<FireArmRoundClass> { Chamber.GetRound().RoundClass }; } return null; } public override void SetLoadedChambers(List<FireArmRoundClass> rounds) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } } } public class FieldGun : FVRFireArm { public FieldGunRotatingLever _xRotation; private float _xlerp = 2f; public FieldGunRotatingLever _yRotation; private float _ylerp = 2f; public float maxXrotDeviance; public float maxYrotDeviance; [Header("Flaregun Params")] public Renderer[] GunUndamaged; public Renderer[] GunDamaged; public FVRFireArmChamber Chamber; public Axis HingeAxis; public Transform Hinge; public float RotOut = 35f; public bool CanUnlatch = true; public bool IsHighPressureTolerant; private bool m_isHammerCocked; private bool m_isTriggerReset = true; private bool m_isLatched = true; private bool m_isDestroyed; private float TriggerFloat; public Transform Hammer; public bool HasVisibleHammer = true; public bool CanCockHammer = true; public bool CocksOnOpen; private float m_hammerXRot; public Axis HammerAxis; public InterpStyle HammerInterp = (InterpStyle)1; public float HammerMinRot; public float HammerMaxRot = -70f; public Transform Trigger; public Vector2 TriggerForwardBackRots; public Transform Muzzle; public ParticleSystem SmokePSystem; public ParticleSystem DestroyPSystem; public bool DeletesCartridgeOnFire; public override void Awake() { ((FVRFireArm)this).Awake(); if (CanUnlatch) { Chamber.IsAccessible = false; } else { Chamber.IsAccessible = true; } } public override void FVRUpdate() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (HasVisibleHammer) { if (m_isHammerCocked) { m_hammerXRot = Mathf.Lerp(m_hammerXRot, HammerMaxRot, Time.deltaTime * 12f); } else { m_hammerXRot = Mathf.Lerp(m_hammerXRot, 0f, Time.deltaTime * 25f); } Hammer.localEulerAngles = new Vector3(m_hammerXRot, 0f, 0f); } if (!m_isLatched && Vector3.Angle(Vector3.up, ((Component)Chamber).transform.forward) < 70f && Chamber.IsFull && Chamber.IsSpent) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); Chamber.EjectRound(((Component)Chamber).transform.position + ((Component)Chamber).transform.forward * -0.06f, ((Component)Chamber).transform.forward * -0.01f, Vector3.right, false); } if (_xRotation.lerp != _xlerp) { _xlerp = _xRotation.lerp; SetRotationOfAxis(0, maxXrotDeviance, _xlerp); } if (_yRotation.lerp != _ylerp) { _ylerp = _yRotation.lerp; SetRotationOfAxis(0, maxYrotDeviance, _ylerp); } } private void SetRotationOfAxis(int axis, float maxRotDeviance, float lerpAmt) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) bool num = lerpAmt < 0f; float num2 = Mathf.Lerp(0f, maxRotDeviance, lerpAmt); if (num) { num2 *= -1f; } Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; ((Vector3)(ref localEulerAngles))[axis] = num2; ((Component)this).transform.localEulerAngles = localEulerAngles; } private void ToggleLatchState() { if (m_isLatched) { Unlatch(); } else if (!m_isLatched) { Latch(); } } public override void UpdateInteraction(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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_002b: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); float num = 0f; Axis hingeAxis = HingeAxis; if ((int)hingeAxis != 0) { if ((int)hingeAxis != 1) { if ((int)hingeAxis == 2) { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).z; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).y; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).x; } if (num > 15f && CanUnlatch) { Unlatch(); } else if (num < -15f && CanUnlatch) { Latch(); } bool flag = false; bool flag2 = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && CanUnlatch) { flag2 = true; } if (hand.Input.AXButtonDown) { flag = true; } } else if (hand.Input.TouchpadDown) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) < 45f && CanCockHammer) { CockHammer(); } else if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && (Vector2.Angle(touchpadAxes, Vector2.left) < 45f || Vector2.Angle(touchpadAxes, Vector2.right) < 45f) && CanUnlatch) { ToggleLatchState(); } } } if (flag) { CockHammer(); } if (flag2) { ToggleLatchState(); } if (m_isDestroyed) { return; } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld) { TriggerFloat = hand.Input.TriggerFloat; } else { TriggerFloat = 0f; } float num2 = Mathf.Lerp(TriggerForwardBackRots.x, TriggerForwardBackRots.y, TriggerFloat); Trigger.localEulerAngles = new Vector3(num2, 0f, 0f); if (TriggerFloat > 0.7f) { if (m_isTriggerReset && m_isHammerCocked) { m_isTriggerReset = false; m_isHammerCocked = false; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMinRot, HammerInterp, HammerAxis); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); Fire(); } } else if (TriggerFloat < 0.2f && !m_isTriggerReset) { m_isTriggerReset = true; } } public void Fire() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (m_isLatched && Chamber.Fire()) { ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); if (Chamber.GetRound().IsHighPressure && !IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); Destroy(); } else if (IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); } ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { Chamber.IsSpent = false; Chamber.UpdateProxyDisplay(); } else if (Chamber.GetRound().IsCaseless) { Chamber.SetRound((FVRFireArmRound)null, false); } if (DeletesCartridgeOnFire) { Chamber.SetRound((FVRFireArmRound)null, false); } } } public void Unlatch() { if (m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); m_isLatched = false; Chamber.IsAccessible = true; if (CocksOnOpen) { CockHammer(); } } } public void Latch() { if (!m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); m_isLatched = true; Chamber.IsAccessible = false; } } public void CockHammer() { //IL_0037: 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) if (!m_isHammerCocked) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); m_isHammerCocked = true; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMaxRot, HammerInterp, HammerAxis); } } } private void Destroy() { if (!m_isDestroyed) { m_isDestroyed = true; DestroyPSystem.Emit(25); for (int i = 0; i < GunUndamaged.Length; i++) { GunUndamaged[i].enabled = false; GunDamaged[i].enabled = true; } } } public override List<FireArmRoundClass> GetChamberRoundList() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (Chamber.IsFull && !Chamber.IsSpent) { return new List<FireArmRoundClass> { Chamber.GetRound().RoundClass }; } return null; } public override void SetLoadedChambers(List<FireArmRoundClass> rounds) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } } } internal class ActivateSeveralFVRInteractiveAtOnce : FVRInteractiveObject { public List<FVRInteractiveObject> InteractiveObjects; public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.BeginInteraction(hand); } } public override void EndInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).EndInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.EndInteraction(hand); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.SimpleInteraction(hand); } } public override void UpdateInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).UpdateInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.UpdateInteraction(hand); } } } internal class AttachmentModifyFirearm : MonoBehaviour { public enum actionType { attach, detach } public enum CapType { AddTo, SetTo } private FVRFireArmAttachment attachment; private FVRFireArm weapon; [Header("Recoil Modifier")] public bool ChangesRecoil; private FVRFireArmRecoilProfile originalRecoil; public FVRFireArmRecoilProfile modifiedRecoil; [Header("Magazine Modifer")] public bool ChangesMagCapacity; private int prevCapacity; public CapType CapacityModifierType; [Tooltip("Keep it off unless you're sure it should apply to non-internal mags.")] public bool applyToNonInternalMags; public int setCapacityTo; [Header("Bolt Speed Modifier")] public bool ChangesBoltSpeed; public bool ChangesBoltSpeedForward; public bool ChangesBoltSpeedRearward; public bool ChangesBoltSpeedStiffness; public CapType BoltSpeedModifierType; public float BoltSpeedForward; private float prevBoltSpeedForward; public float BoltSpeedBackwards; private float prevBoltSpeedBackwards; public float BoltSpringStiffness; private float prevBoltSpringStiffness; [HideInInspector] public bool ChangesSpread; [HideInInspector] public float spreadmult; [Header("GrabPos Modifier")] public bool ChangesGrabPos; public Transform NewPoseOverride; private Vector3 oldPoseOverridePos; private Quaternion oldPoseOverrideRot; public Transform NewPoseOverrideTouch; private Vector3 oldPoseOverrideTouchPos; private Quaternion oldPoseOverrideTouchRot; public void Start() { attachment = ((Component)this).GetComponent<FVRFireArmAttachment>(); } private void FixedUpdate() { if ((Object)(object)attachment.curMount != (Object)null) { if ((Object)(object)weapon == (Object)null) { OnAttach(); } } else if ((Object)(object)weapon != (Object)null) { OnDetach(); } if (ChangesSpread) { ChangeSpread(); } } private void Update() { } public void OnAttach() { weapon = ((Component)attachment.curMount.Parent).GetComponent<FVRFireArm>(); if (ChangesRecoil) { RecoilModifier(actionType.attach); } if (ChangesMagCapacity) { MagSizeModifier(actionType.attach); } if (ChangesBoltSpeed) { BoltSpeedModifier(actionType.attach); } if (ChangesGrabPos) { ChangeGrabPos(actionType.attach); } } public void OnDetach() { if (ChangesRecoil) { RecoilModifier(actionType.detach); } if (ChangesMagCapacity) { MagSizeModifier(actionType.detach); } if (ChangesBoltSpeed) { BoltSpeedModifier(actionType.detach); } if (ChangesGrabPos) { ChangeGrabPos(actionType.detach); } weapon = null; } public void ChangeGrabPos(actionType ActType) { //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_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (ActType == actionType.attach) { oldPoseOverridePos = ((FVRInteractiveObject)weapon).PoseOverride.localPosition; oldPoseOverrideRot = ((FVRInteractiveObject)weapon).PoseOverride.localRotation; ((FVRInteractiveObject)weapon).PoseOverride.position = NewPoseOverride.position; ((FVRInteractiveObject)weapon).PoseOverride.rotation = NewPoseOverride.rotation; oldPoseOverrideTouchPos = ((FVRInteractiveObject)weapon).PoseOverride_Touch.localPosition; oldPoseOverrideTouchRot = ((FVRInteractiveObject)weapon).PoseOverride_Touch.localRotation; ((FVRInteractiveObject)weapon).PoseOverride_Touch.position = NewPoseOverrideTouch.position; ((FVRInteractiveObject)weapon).PoseOverride_Touch.rotation = NewPoseOverrideTouch.rotation; } if (ActType == actionType.detach) { ((FVRInteractiveObject)weapon).PoseOverride.localPosition = oldPoseOverridePos; ((FVRInteractiveObject)weapon).PoseOverride.localRotation = oldPoseOverrideRot; ((FVRInteractiveObject)weapon).PoseOverride_Touch.localPosition = oldPoseOverrideTouchPos; ((FVRInteractiveObject)weapon).PoseOverride_Touch.localRotation = oldPoseOverrideTouchRot; } } public void ChangeSpread() { FVRFireArmRound val = null; if (weapon is OpenBoltReceiver) { FVRFireArm obj = weapon; val = ((OpenBoltReceiver)((obj is OpenBoltReceiver) ? obj : null)).Chamber.GetRound(); } else if (weapon is ClosedBoltWeapon) { FVRFireArm obj2 = weapon; val = ((ClosedBoltWeapon)((obj2 is ClosedBoltWeapon) ? obj2 : null)).Chamber.GetRound(); } else if (weapon is Handgun) { FVRFireArm obj3 = weapon; val = ((Handgun)((obj3 is Handgun) ? obj3 : null)).Chamber.GetRound(); } else if (weapon is TubeFedShotgun) { FVRFireArm obj4 = weapon; val = ((TubeFedShotgun)((obj4 is TubeFedShotgun) ? obj4 : null)).Chamber.GetRound(); } if (!((Object)(object)val == (Object)null) && (double)((FVRPhysicalObject)val).ThrowAngMultiplier != 1.1) { ((FVRPhysicalObject)val).ThrowAngMultiplier = 1.1f; FVRFireArmRound obj5 = val; obj5.ProjectileSpread *= spreadmult; } } public void RecoilModifier(actionType ActType) { if (ActType == actionType.attach) { originalRecoil = weapon.RecoilProfile; weapon.RecoilProfile = modifiedRecoil; } if (ActType == actionType.detach) { weapon.RecoilProfile = originalRecoil; } } public void MagSizeModifier(actionType ActType) { if ((Object)(object)weapon.Magazine == (Object)null) { return; } if (ActType == actionType.attach && (weapon.Magazine.IsIntegrated || applyToNonInternalMags)) { prevCapacity = weapon.Magazine.m_capacity; if (CapacityModifierType == CapType.AddTo) { FVRFireArmMagazine magazine = weapon.Magazine; magazine.m_capacity += setCapacityTo; } if (CapacityModifierType == CapType.SetTo) { weapon.Magazine.m_capacity = setCapacityTo; } Array.Resize(ref weapon.Magazine.LoadedRounds, weapon.Magazine.m_capacity); } if (ActType == actionType.detach && (weapon.Magazine.IsIntegrated || applyToNonInternalMags)) { weapon.Magazine.m_capacity = prevCapacity; } } public void BoltSpeedModifier(actionType ActType) { int num = 0; OpenBoltReceiver val = null; ClosedBoltWeapon val2 = null; Handgun val3 = null; if (weapon is OpenBoltReceiver) { FVRFireArm obj = weapon; val = (OpenBoltReceiver)(object)((obj is OpenBoltReceiver) ? obj : null); num = 1; } else if (weapon is ClosedBoltWeapon) { FVRFireArm obj2 = weapon; val2 = (ClosedBoltWeapon)(object)((obj2 is ClosedBoltWeapon) ? obj2 : null); num = 2; } else if (weapon is Handgun) { FVRFireArm obj3 = weapon; val3 = (Handgun)(object)((obj3 is Handgun) ? obj3 : null); num = 3; } else if (weapon is TubeFedShotgun) { _ = weapon; num = 4; } float num2 = 0f; float num3 = 0f; float num4 = 0f; switch (num) { case 1: num2 = val.Bolt.BoltSpeed_Rearward; num3 = val.Bolt.BoltSpeed_Forward; num4 = val.Bolt.BoltSpringStiffness; break; case 2: num2 = val2.Bolt.Speed_Rearward; num3 = val2.Bolt.Speed_Forward; num4 = val2.Bolt.SpringStiffness; break; case 3: num2 = val3.Slide.Speed_Forward; num3 = val3.Slide.Speed_Rearward; num4 = val3.Slide.SpringStiffness; break; } if (ActType == actionType.attach) { prevBoltSpeedBackwards = num2; prevBoltSpeedForward = num3; prevBoltSpringStiffness = num4; if (BoltSpeedModifierType == CapType.SetTo) { num2 = BoltSpeedBackwards; num3 = BoltSpeedForward; num4 = BoltSpringStiffness; } if (BoltSpeedModifierType == CapType.AddTo) { num2 += BoltSpeedBackwards; num3 += BoltSpeedForward; num4 += BoltSpringStiffness; } } if (ActType == actionType.detach) { num2 = prevBoltSpeedBackwards; num3 = prevBoltSpeedForward; num4 = prevBoltSpringStiffness; } if (ChangesBoltSpeedRearward) { switch (num) { case 1: val.Bolt.BoltSpeed_Rearward = num2; break; case 2: val2.Bolt.Speed_Rearward = num2; break; case 3: val3.Slide.Speed_Forward = num2; break; } } if (ChangesBoltSpeedForward) { switch (num) { case 1: val.Bolt.BoltSpeed_Forward = num3; break; case 2: val2.Bolt.Speed_Forward = num3; break; case 3: val3.Slide.Speed_Rearward = num3; break; } } if (ChangesBoltSpeedStiffness) { switch (num) { case 1: val.Bolt.BoltSpringStiffness = num4; break; case 2: val2.Bolt.SpringStiffness = num4; break; case 3: val3.Slide.SpringStiffness = num4; break; } } } } internal class DisplayOnAttached : MonoBehaviour { public GameObject displayOnAttach; public FVRFireArmAttachmentMount AttachmentMount; public void FixedUpdate() { if (AttachmentMount.HasAttachmentsOnIt()) { displayOnAttach.SetActive(true); } else { displayOnAttach.SetActive(false); } } } internal class BetterMagReleaseLatch : MonoBehaviour { [FormerlySerializedAs("FireArm")] public FVRFireArm fireArm; [FormerlySerializedAs("Joint")] public HingeJoint joint; private float _timeSinceLastCollision = 6f; [Tooltip("Greatly reduce what you think it may be. I recommend 2 for Sensitivity.")] public float jointReleaseSensitivity = 2f; [HideInInspector] public float jointAngle; [FormerlySerializedAs("_jointReleaseSensitivityAbove")] [HideInInspector] public float jointReleaseSensitivityAbove; [FormerlySerializedAs("_jointReleaseSensitivityBelow")] [HideInInspector] public float jointReleaseSensitivityBelow; private bool _isMagazineNotNull; [HideInInspector] public float basex; private void Start() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) _isMagazineNotNull = (Object)(object)fireArm.Magazine != (Object)null; basex = ((Component)this).transform.rotation.x; jointReleaseSensitivityAbove = basex + jointReleaseSensitivity; jointReleaseSensitivityBelow = basex - jointReleaseSensitivity; } private void FixedUpdate() { //IL_006a: 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_0045: Unknown result type (might be due to invalid IL or missing references) if (_timeSinceLastCollision < 5f) { _timeSinceLastCollision += Time.deltaTime; } if (_isMagazineNotNull && (((Component)this).transform.rotation.x >= jointReleaseSensitivityAbove || ((Component)this).transform.rotation.x <= jointReleaseSensitivityBelow)) { fireArm.EjectMag(false); } jointAngle = ((Component)this).transform.rotation.x; } private void OnCollisionEnter(Collision col) { if ((Object)(object)col.collider.attachedRigidbody != (Object)null && (Object)(object)col.collider.attachedRigidbody != (Object)(object)((FVRPhysicalObject)fireArm).RootRigidbody && (Object)(object)((Component)col.collider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>() != (Object)null && ((FVRInteractiveObject)((Component)col.collider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>()).IsHeld) { _timeSinceLastCollision = 0f; } } } internal class OpenBoltBurstFire : MonoBehaviour { public OpenBoltReceiver Receiver; [Tooltip("Selector setting position that will be burst. Remember, selectors go pos: 0, 1 ,2, not 1, 2, 3")] public int SelectorSetting; [Tooltip("Amount of shots per burst.")] public int BurstAmt = 3; private int BurstSoFar; private bool wasLoaded; public void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2; } public void Update() { if ((Object)(object)((FVRInteractiveObject)Receiver).m_hand == (Object)null) { return; } if (Receiver.m_fireSelectorMode != SelectorSetting) { BurstSoFar = 0; return; } if (wasLoaded && !Receiver.Chamber.IsFull) { BurstSoFar++; } wasLoaded = Receiver.Chamber.IsFull; if (BurstSoFar >= BurstAmt) { lockUp(); if (((FVRInteractiveObject)Receiver).m_hand.Input.TriggerFloat < Receiver.TriggerFiringThreshold) { unLock(); } } if (((FVRInteractiveObject)Receiver).m_hand.Input.TriggerFloat < Receiver.TriggerFiringThreshold) { BurstSoFar = 0; } } public void lockUp() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)0; } public void unLock() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) BurstSoFar = 0; Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2; } } internal class InvisibleMagOnLoad : MonoBehaviour { public FVRFireArmMagazine magazine; public void Update() { if ((Object)(object)magazine.FireArm != (Object)null) { ((Component)magazine.Viz).gameObject.SetActive(false); } else { ((Component)magazine.Viz).gameObject.SetActive(true); } } } public class SimpleControls_ClosedBolt : MonoBehaviour { [HideInInspector] public ClosedBoltWeapon cbw; public void Start() { cbw = ((Component)this).GetComponent<ClosedBoltWeapon>(); if ((Object)(object)cbw == (Object)null) { Debug.Log((object)"SimpleControls_ClosedBolt_BoltRelease can't find the closed bolt weapon!"); Object.Destroy((Object)(object)this); } } } public class SimpleControls_ClosedBolt_BoltRelease : SimpleControls_ClosedBolt { public void FixedUpdate() { cbw.HasBoltReleaseButton = UtilsBepInExLoader.SimpleControls.Value; } } public class SimpleControls_ClosedBolt_SelectorSwitch : SimpleControls_ClosedBolt { public void FixedUpdate() { cbw.HasFireSelectorButton = UtilsBepInExLoader.SimpleControls.Value; } } internal class lockToHead : MonoBehaviour { public Vector3 posOffset; public void Update() { //IL_0015: 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_0031: 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) ((Component)this).transform.position = ((Component)GM.CurrentPlayerBody.Head).transform.position; Transform transform = ((Component)this).transform; transform.localPosition += posOffset; ((Component)this).transform.rotation = ((Component)GM.CurrentPlayerBody.Head).transform.rotation; } } internal class compressingSpring : MonoBehaviour { public enum dirType { x, y, z } public GameObject compressor; public GameObject spring; public dirType directionOfCompression = dirType.z; public dirType directionOfCompressor = dirType.z; [Tooltip("The directionOfCompression position where the scale will be 1.")] public float fullextend; [Tooltip("The directionOfCompression position where the scale will be 0.")] public float fullcompress; private void Update() { //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_001a: 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_002c: 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_008f: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = spring.transform.localScale; float[] array = new float[3] { localScale.x, localScale.y, localScale.z }; dirType num = directionOfCompression; Vector3 localPosition = compressor.transform.localPosition; array[(int)num] = (((Vector3)(ref localPosition))[(int)directionOfCompressor] - fullcompress) * (1f / (fullextend - fullcompress)); ((Vector3)(ref localScale))..ctor(array[0], array[1], array[2]); spring.transform.localScale = localScale; } } public class cullOnZLoc : MonoBehaviour { public enum cutOffType { above, below } public enum dirType { x, y, z } public cutOffType cutoff; public double loc; public GameObject objTarget; public dirType dir; private MeshRenderer objMeshRenderer; private void Start() { objMeshRenderer = ((Component)this).gameObject.GetComponent<MeshRenderer>(); } private void Update() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 localPosition; switch (cutoff) { case cutOffType.below: { MeshRenderer obj2 = objMeshRenderer; localPosition = objTarget.transform.localPosition; ((Renderer)obj2).enabled = (double)((Vector3)(ref localPosition))[(int)dir] > loc; break; } case cutOffType.above: { MeshRenderer obj = objMeshRenderer; localPosition = objTarget.transform.localPosition; ((Renderer)obj).enabled = (double)((Vector3)(ref localPosition))[(int)dir] < loc; break; } } } } public class followDir : MonoBehaviour { public GameObject leader; public GameObject follower; public cullOnZLoc.dirType FollowDirection; public Vector3 followerpos; public Vector3 leaderpos; public Vector3 resultpos; private void Update() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) follower.transform.position = leader.transform.position; } } public class MagFollower : MonoBehaviour { [Header("Only fill out one of the ones below.")] public FVRFireArmMagazine magazine; public FVRFireArmClip clip; public GameObject follower; [Header("Translation Mag Follower")] public bool UsesOneRoundPos; [Tooltip("The round count where the follower starts moving (e.g 20)")] public int StartAtRoundCount; [Tooltip("The round count where the follower stops moving (e.g 0)")] public int StopAtRoundCount; [Tooltip("The position where the follower should be when the magazine is full.")] public GameObject StartPos; [Tooltip("The position where the follower should be when the magazine has one round left.")] public GameObject OneRoundPos; [Tooltip("The position where the follower should be when the magazine is empty.")] public GameObject StopPos; [Header("Individual Point Mag Follower")] public bool UsesIndivdualPointMagFollower; [Tooltip("Top-to-bottom order, where the 0th position is when the magazine is empty. ")] public List<GameObject> Positions; [Header("Individual Mesh Replacement")] public bool UsesIndividualMeshReplacement; [Tooltip("Top-to-bottom order, where the 0th position is when the magazine is empty. ")] public List<Mesh> Meshes; private int magrounds; private MeshFilter followerFilter; public bool isClip; public void Update() { int num = 0; num = ((!isClip) ? magazine.m_numRounds : clip.m_numRounds); if (num != magrounds) { magrounds = num; UpdateDisp(); } } public void Start() { if ((Object)(object)clip != (Object)null) { if ((Object)(object)magazine != (Object)null) { Debug.LogError((object)"H3VR Utilities Follower has both a clip and mag inserted! What?"); } isClip = true; } followerFilter = follower.GetComponent<MeshFilter>(); if (StopAtRoundCount > StartAtRoundCount) { int stopAtRoundCount = StopAtRoundCount; StopAtRoundCount = StartAtRoundCount; StartAtRoundCount = stopAtRoundCount; } } public void UpdateDisp() { //IL_0168: 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_0188: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (UsesIndivdualPointMagFollower) { if (Positions.Count >= magazine.m_numRounds && !((Object)(object)Positions[magazine.m_numRounds] == (Object)null)) { follower.transform.position = Positions[magazine.m_numRounds].transform.position; follower.transform.rotation = Positions[magazine.m_numRounds].transform.rotation; } return; } if (UsesIndividualMeshReplacement) { if (Meshes.Count >= magazine.m_numRounds && !((Object)(object)Meshes[magazine.m_numRounds] == (Object)null)) { followerFilter.mesh = Meshes[magazine.m_numRounds]; followerFilter.mesh = Meshes[magazine.m_numRounds]; } return; } Transform transform = StopPos.transform; int num = StopAtRoundCount; if (UsesOneRoundPos) { transform = OneRoundPos.transform; num++; } follower.transform.position = Vector3.Lerp(StartPos.transform.position, transform.position, Mathf.InverseLerp((float)StartAtRoundCount, (float)num, (float)magrounds)); if (magrounds == 0) { follower.transform.position = StopPos.transform.position; } } } } namespace H3VRUtils.UniqueCode { internal class AssignMagIfNull : MonoBehaviour { public FVRFireArm firearm; public FVRFireArmMagazine magazine; public void FixedUpdate() { if ((Object)(object)firearm.Magazine == (Object)null) { firearm.Magazine = magazine; } } } public class BOMO : MonoBehaviour { [Tooltip("If there are no objects in the BOMO, it will act like a regular harnessed object (grab, move it about, let go and it returns to the slot.) If enabled, it will simply force you to let it go, and not let you unharness the object.")] public bool isStatic; [Tooltip("For usage as a static object. Puts itself into quickbelt and harnesses.")] public FVRQuickBeltSlot qbSlotForStatic; [Tooltip("Physical object the BOMO is connected to.")] public FVRPhysicalObject physobj; [Tooltip("List of all the items in the BOMO.")] public List<GameObject> itemsInTheBag; [Tooltip("Text that displays the amount of items in the bag. Not necessary.")] public Text itemsInTheBagText; [Tooltip("Maximum amount of items that can be stored in the BOMO.")] public int maxItems = 5; [Tooltip("If true, will just nuke any item put into it.")] public bool thevoid; public AudioEvent dropInToSound; public AudioEvent takeOutOfSound; private bool _isitemsInTheBagTextNotNull; private int deniedObjectTime; public List<GameObject> notPhysObjects = new List<GameObject>(); private void Start() { _isitemsInTheBagTextNotNull = (Object)(object)itemsInTheBagText != (Object)null; if (isStatic) { HarnessBOMO(); } } public void HarnessBOMO() { physobj.SetQuickBeltSlot(qbSlotForStatic); physobj.Harnessable = false; physobj.m_isHardnessed = true; } private void OnTriggerStay(Collider other) { //IL_0180: Unknown result type (might be due to invalid IL or missing references) deniedObjectTime++; if (((Component)other).gameObject.layer != ((Component)this).gameObject.layer || deniedObjectTime < 3 || notPhysObjects.Contains(((Component)other).gameObject)) { return; } FVRPhysicalObject component = ((Component)other).gameObject.GetComponent<FVRPhysicalObject>(); if ((Object)(object)component == (Object)null) { notPhysObjects.Add(((Component)other).gameObject); return; } deniedObjectTime = 0; bool flag = true; if ((Object)(object)((FVRInteractiveObject)component).m_hand == (Object)null) { if (component is FVRFireArmMagazine) { if ((Object)(object)((FVRFireArmMagazine)((component is FVRFireArmMagazine) ? component : null)).FireArm == (Object)null) { flag = false; } } else if (component is Speedloader) { flag = false; } else if (component is FVRFireArmClip && (Object)(object)((FVRFireArmClip)((component is FVRFireArmClip) ? component : null)).FireArm == (Object)null) { flag = false; } } if (component.m_isSpawnLock || flag || itemsInTheBag.Count >= maxItems) { return; } if (thevoid) { if ((Object)(object)((FVRInteractiveObject)component).m_hand != (Object)null) { ((FVRInteractiveObject)component).m_hand.ForceSetInteractable((FVRInteractiveObject)null); } Object.Destroy((Object)(object)((Component)other).gameObject); } else { itemsInTheBag.Add(((Component)other).gameObject); if ((Object)(object)((FVRInteractiveObject)component).m_hand != (Object)null) { ((FVRInteractiveObject)component).m_hand.ForceSetInteractable((FVRInteractiveObject)null); } ((Component)other).gameObject.SetActive(false); } SetText(); if (dropInToSound.Clips.Count != 0) { SM.PlayGenericSound(dropInToSound, ((Component)this).transform.position); } } private void SetText() { if (_isitemsInTheBagTextNotNull) { itemsInTheBagText.text = itemsInTheBag.Count.ToString(); } } private void Update() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if (physobj.m_isHardnessed) { if (!((Object)(object)((FVRInteractiveObject)physobj).m_hand != (Object)null)) { return; } if (itemsInTheBag.Count != 0) { int index = Random.Range(0, itemsInTheBag.Count); FVRInteractiveObject component = itemsInTheBag[index].GetComponent<FVRInteractiveObject>(); ((Component)component).gameObject.SetActive(true); ((Component)component).transform.position = ((Component)((FVRInteractiveObject)physobj).m_hand).transform.position; ((FVRInteractiveObject)physobj).m_hand.ForceSetInteractable(component); itemsInTheBag.Remove(itemsInTheBag[index]); SetText(); deniedObjectTime = 0; if (takeOutOfSound.Clips.Count != 0) { SM.PlayGenericSound(takeOutOfSound, ((Component)this).transform.position); } } else if (isStatic) { ((FVRInteractiveObject)physobj).m_hand.ForceSetInteractable((FVRInteractiveObject)null); } } else if (isStatic) { HarnessBOMO(); } } private void FixedUpdate() { deniedObjectTime++; } } public class DumpInternalMag : MonoBehaviour { public Handgun handgun; public H3VRUtilsMagRelease.TouchpadDirType presstoejectbutton; public void FixedUpdate() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 if (!((FVRInteractiveObject)handgun).IsHeld) { return; } FVRViveHand hand = ((FVRInteractiveObject)handgun).m_hand; Vector2 val = H3VRUtilsMagRelease.TouchpadDirTypeToVector2(presstoejectbutton); if (Vector2.Angle(hand.Input.TouchpadAxes, val) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && ((int)handgun.Slide.CurPos == 3 || (int)handgun.Slide.CurPos == 4)) { if (handgun.Chamber.IsFull) { handgun.EjectExtractedRound(); } else if (handgun.m_proxy.IsFull) { handgun.ChamberRound(); } else if (((FVRFireArm)handgun).Magazine.HasARound()) { GameObject fromPrefabReference = ((FVRFireArm)handgun).Magazine.RemoveRound(false); ((FVRFireArm)handgun).PlayAudioEvent((FirearmAudioEventType)29, 1f); handgun.m_proxy.SetFromPrefabReference(fromPrefabReference); } } } } internal class LebelCutoff : FVRInteractiveObject { public FVRFireArmMagazine TubeMagazine; public FVRFireArm Firearm; public Transform CutoffSwitchFalse; public Transform CutoffSwitchTrue; public GameObject CutoffSwitch; public Transform CutoffFlagFalse; public Transform CutoffFlagTrue; public GameObject CutoffFlag; public bool isCutoff; public override void SimpleInteraction(FVRViveHand hand) { //IL_00b3: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0070: 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) Firearm.PlayAudioEvent((FirearmAudioEventType)14, 1f); isCutoff = !isCutoff; if (isCutoff) { CutoffSwitch.transform.position = CutoffSwitchTrue.position; CutoffSwitch.transform.rotation = CutoffSwitchTrue.rotation; CutoffFlag.transform.position = CutoffFlagTrue.position; CutoffFlag.transform.rotation = CutoffFlagTrue.rotation; Firearm.Magazine = null; } else { CutoffSwitch.transform.position = CutoffSwitchFalse.position; CutoffSwitch.transform.rotation = CutoffSwitchFalse.rotation; CutoffFlag.transform.position = CutoffFlagFalse.position; CutoffFlag.transform.rotation = CutoffFlagFalse.rotation; Firearm.Magazine = TubeMagazine; } } } internal class OpenBoltLockOnSafe : MonoBehaviour { public Collider Bolt; public GameObject SafetySwitch; public cullOnZLoc.dirType SafetyRotDir; public float AngleWhenSafe; public void FixedUpdate() { //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) Vector3 localEulerAngles = SafetySwitch.transform.localEulerAngles; if (((Vector3)(ref localEulerAngles))[(int)SafetyRotDir] == AngleWhenSafe) { Bolt.enabled = false; } else { Bolt.enabled = true; } } } internal class RevolverChargingHandle : FVRInteractiveObject { public SingleActionRevolver wep; public Transform frontMostPoint; public Transform rearMostPoint; public float forwardspeed; private bool pulled; public override void UpdateInteraction(FVRViveHand hand) { //IL_000e: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(frontMostPoint.position, rearMostPoint.position, ((HandInput)(ref base.m_hand.Input)).Pos); ((Component)this).transform.position = closestValidPoint; _ = ((Component)this).transform.localPosition; Mathf.InverseLerp(frontMostPoint.localPosition.z, rearMostPoint.localPosition.z, ((Component)this).transform.localPosition.z); } public override void FVRUpdate() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_012c: 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_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) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00ff: Expected O, but got Unknown ((FVRInteractiveObject)this).FVRUpdate(); if (!((FVRInteractiveObject)this).IsHeld && Mathf.Abs(((Component)this).transform.localPosition.z - frontMostPoint.localPosition.z) > 0.001f) { ((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, Mathf.MoveTowards(((Component)this).transform.localPosition.z, frontMostPoint.localPosition.z, Time.deltaTime * forwardspeed)); } else if (Mathf.Abs(((Component)this).transform.localPosition.z - rearMostPoint.localPosition.z) < 0.01f) { try { ((FVRFireArm)wep).PlayAudioEvent((FirearmAudioEventType)10, 1f); } catch { Console.WriteLine("Forgot to assign FireArmAudioEventType.HandleBack!"); } if (!pulled) { FVRViveHand val = new FVRViveHand(); val.IsInStreamlinedMode = true; val.Input.AXButtonDown = true; ((FVRInteractiveObject)wep).UpdateInteraction(val); pulled = true; } } else if (Mathf.Abs(((Component)this).transform.localPosition.z - frontMostPoint.localPosition.z) < 0.01f) { try { ((FVRFireArm)wep).PlayAudioEvent((FirearmAudioEventType)11, 1f); } catch { Console.WriteLine("Forgot to assign FireArmAudioEventType.HandleForward!"); } pulled = false; } } } internal class SelbstladerUnlockSystem : FVRInteractiveObject { public enum ChangePositionType { Swap, Unlock, Lock } public enum locktype { MagLocking, BoltLocking } public GameObject lockingpiece; public Transform lockingpieceunlocked; public Transform lockingpiecelocked; public ClosedBoltWeapon wep; public H3VRUtilsMagRelease magrelease; public FVRFireArmReloadTriggerWell magreloadtrigger; private float velocity; private bool unlocked; private Collider col; private Collider mrtcol; public locktype locker; public override void Awake() { ((FVRInteractiveObject)this).Awake(); base.IsSimpleInteract = true; col = ((Component)wep.Bolt).GetComponent<Collider>(); ChangePosition(ChangePositionType.Lock); velocity = wep.Chamber.ChamberVelocityMultiplier; if (locker == locktype.MagLocking) { mrtcol = ((Component)magreloadtrigger).GetComponent<Collider>(); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); ChangePosition(ChangePositionType.Swap); try { ((FVRFireArm)wep).PlayAudioEvent((FirearmAudioEventType)17, 1f); } catch { Console.WriteLine("SelbstladerUnlockSystem.cs failed to play the BreachOpen sound!"); } } public override void FVRUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 ((FVRInteractiveObject)this).FVRUpdate(); if (locker == locktype.BoltLocking) { if ((int)wep.Bolt.CurPos == 1) { ChangePosition(ChangePositionType.Lock); } if ((int)wep.Bolt.CurPos == 2) { ChangePosition(ChangePositionType.Unlock); } if (unlocked) { wep.Chamber.ChamberVelocityMultiplier = 0.1f; } else { wep.Chamber.ChamberVelocityMultiplier = velocity; } } if (locker == locktype.MagLocking && (int)wep.Bolt.CurPos == 1 && unlocked) { magrelease.dropmag(null, _override: true); } } public void ChangePosition(ChangePositionType ct) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) if (ct == ChangePositionType.Swap) { unlocked = !unlocked; } if (ct == ChangePositionType.Unlock) { unlocked = true; } if (ct == ChangePositionType.Lock) { unlocked = false; } if (unlocked) { lockingpiece.transform.localPosition = lockingpieceunlocked.localPosition; lockingpiece.transform.localRotation = lockingpieceunlocked.localRotation; } else { lockingpiece.transform.localPosition = lockingpiecelocked.localPosition; lockingpiece.transform.localRotation = lockingpiecelocked.localRotation; } if (locker == locktype.BoltLocking) { col.enabled = unlocked; } if (locker == locktype.MagLocking) { magrelease.DisallowEjection = !unlocked; mrtcol.enabled = unlocked; } } } } namespace H3VRUtils.ObjectModifiers { public class Stick : MonoBehaviour { public FVRPhysicalObject physObj; [Tooltip("Point Z to direction to check. If an layer object is within 0.05m from the raycastdir, it will lock.")] public Transform raycastDir; [Tooltip("If velocity is below this, it will allow it to lock.")] public float minVel; public LayerMask layer; private bool isLocked; public void FixedUpdate() { //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_0026: 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_003e: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = physObj.RootRigidbody.velocity; RaycastHit val = default(RaycastHit); if (((Vector3)(ref velocity)).magnitude <= minVel && Physics.Raycast(raycastDir.position, raycastDir.forward, ref val, 2f, LayerMask.op_Implicit(layer))) { isLocked = true; physObj.SetIsKinematicLocked(true); } if (isLocked && ((FVRInteractiveObject)physObj).IsHeld) { isLocked = false; physObj.SetIsKinematicLocked(false); } } } } namespace H3VRUtils.QOL { public class SouthpawSupporter : MonoBehaviour { [Tooltip("If true, automatically generates LeftHand and LeftHand_Touch.m")] public bool AutoSwapRot = true; public Transform LeftHand; public Transform LeftHand_Touch; private Transform RightHand; private Transform RightHand_Touch; private FVRPhysicalObject _physicalObject; public void Start() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL
monomod/H3VRUtilities/Assembly-CSharp.H3VRUtilitiesVehicles.mm.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using FistVR; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("H3VRUtilitiesVehicles")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("H3VRUtilitiesVehicles")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("D3911CEF-9C19-474C-8ED3-271399D2B892")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] public enum ControlMode { simple = 1, touch } public class VehicleControl : MonoBehaviour { [Serializable] public class CarWheels { public ConnectWheel wheels; } [Serializable] public class ConnectWheel { public bool frontWheelDrive = true; public Transform frontRight; public Transform frontLeft; public WheelSetting frontSetting; public bool backWheelDrive = true; public Transform backRight; public Transform backLeft; public WheelSetting rearSetting; } [Serializable] public class WheelSetting { public float Radius = 0.4f; public float Weight = 1000f; public float Distance = 0.2f; } [Serializable] public class CarLights { public Light[] brakeLights; public Light[] reverseLights; } [Serializable] public class CarSounds { public AudioSource IdleEngine; public AudioSource LowEngine; public AudioSource HighEngine; public float minPitch = 1f; public float maxPitch = 10f; public AudioSource nitro; public AudioSource switchGear; } [Serializable] public class CarParticles { public GameObject brakeParticlePerfab; public ParticleSystem shiftParticle1; public ParticleSystem shiftParticle2; private GameObject[] wheelParticle = (GameObject[])(object)new GameObject[4]; } [Serializable] public class CarSetting { public bool showNormalGizmos; public Transform carSteer; public HitGround[] hitGround; public List<Transform> cameraSwitchView; public float springs = 25000f; public float dampers = 1500f; public float carPower = 120f; public float shiftPower = 150f; public float brakePower = 8000f; public Vector3 shiftCentre = new Vector3(0f, -0.8f, 0f); public float maxSteerAngle = 25f; public float shiftDownRPM = 1500f; public float shiftUpRPM = 2500f; public float idleRPM = 500f; public float stiffness = 2f; public bool automaticGear = true; public float[] gears = new float[6] { -10f, 9f, 6f, 4.5f, 3f, 2.5f }; public float LimitBackwardSpeed = 60f; public float LimitForwardSpeed = 220f; } [Serializable] public class HitGround { public string tag = "street"; public bool grounded; public AudioClip brakeSound; public AudioClip groundSound; public Color brakeColor; } private class WheelComponent { public Transform wheel; public WheelCollider collider; public Vector3 startPos; public float rotation; public float rotation2; public float maxSteer; public bool drive; public float pos_y; public WheelSetting settings; } public ControlMode controlMode = ControlMode.simple; public bool activeControl; public CarWheels carWheels; public CarLights carLights; public CarSounds carSounds; public CarParticles carParticles; public CarSetting carSetting; [HideInInspector] public float steer; [HideInInspector] public float accel; [HideInInspector] public bool brake; private bool shifmotor; [HideInInspector] public float curTorque = 100f; [HideInInspector] public float powerShift = 100f; [HideInInspector] public bool shift; private float torque = 100f; [HideInInspector] public float speed; private float lastSpeed = -10f; private bool shifting; private float[] efficiencyTable = new float[22] { 0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1f, 0.95f, 0.8f, 0.7f, 0.6f, 0.5f, 0.45f, 0.4f, 0.36f, 0.33f, 0.3f, 0.2f, 0.1f, 0.05f }; private float efficiencyTableStep = 250f; private float Pitch; private float PitchDelay; private float shiftTime; private float shiftDelay; [HideInInspector] public int currentGear; [HideInInspector] public bool NeutralGear = true; [HideInInspector] public float motorRPM; [HideInInspector] public bool Backward; [HideInInspector] public float accelFwd; [HideInInspector] public float accelBack; [HideInInspector] public float steerAmount; private float wantedRPM; private float w_rotate; private float slip; private float slip2; private GameObject[] Particle = (GameObject[])(object)new GameObject[4]; private Vector3 steerCurAngle; private Rigidbody myRigidbody; private WheelComponent[] wheels; public bool isOn = true; public bool isForciblyOff; public Rigidbody GetRigidbody() { return myRigidbody; } private WheelComponent SetWheelComponent(Transform wheel, float maxSteer, bool drive, float pos_y, WheelSetting setting) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0033: 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_0059: 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_00ab: 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) WheelComponent wheelComponent = new WheelComponent(); GameObject val = new GameObject(((Object)wheel).name + "WheelCollider"); val.transform.parent = ((Component)this).transform; val.transform.position = wheel.position; val.transform.eulerAngles = ((Component)this).transform.eulerAngles; pos_y = val.transform.localPosition.y; _ = (WheelCollider)val.AddComponent(typeof(WheelCollider)); wheelComponent.wheel = wheel; wheelComponent.collider = val.GetComponent<WheelCollider>(); wheelComponent.drive = drive; wheelComponent.pos_y = pos_y; wheelComponent.maxSteer = maxSteer; wheelComponent.startPos = val.transform.localPosition; wheelComponent.settings = setting; return wheelComponent; } private void Awake() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) if (carSetting.automaticGear) { NeutralGear = false; } myRigidbody = ((Component)((Component)this).transform).GetComponent<Rigidbody>(); wheels = new WheelComponent[4]; wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y, carWheels.wheels.frontSetting); wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y, carWheels.wheels.frontSetting); wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y, carWheels.wheels.rearSetting); wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y, carWheels.wheels.rearSetting); if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { steerCurAngle = carSetting.carSteer.localEulerAngles; } WheelComponent[] array = wheels; foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; collider.suspensionDistance = wheelComponent.settings.Distance; JointSpring suspensionSpring = collider.suspensionSpring; suspensionSpring.spring = carSetting.springs; suspensionSpring.damper = carSetting.dampers; collider.suspensionSpring = suspensionSpring; collider.radius = wheelComponent.settings.Radius; collider.mass = wheelComponent.settings.Weight; WheelFrictionCurve val = collider.forwardFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.forwardFriction = val; val = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 7500f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 2f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.sidewaysFriction = val; } } public void TurnOnEngine(bool forcibly) { if (!isForciblyOff) { isOn = true; } else if (forcibly) { isForciblyOff = false; isOn = true; } } public void TurnOffEngine(bool forcibly) { isForciblyOff = forcibly; isOn = false; } public void ShiftTo(int newGear) { ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); currentGear = newGear; if (currentGear == 0) { NeutralGear = true; } else { NeutralGear = false; } if (currentGear == -1) { currentGear = 0; } } public void ShiftUp(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || currentGear >= carSetting.gears.Length - 1) { return; } ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); if (!carSetting.automaticGear) { if (currentGear == 0) { if (NeutralGear) { currentGear++; NeutralGear = false; } else { NeutralGear = true; } } else { currentGear++; } } else { currentGear++; } shiftDelay = timeSinceLevelLoad + 1f; shiftTime = 1.5f; } public void ShiftDown(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || (currentGear <= 0 && !NeutralGear)) { return; } ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); if (!carSetting.automaticGear) { if (currentGear == 1) { if (!NeutralGear) { currentGear--; NeutralGear = true; } } else if (currentGear == 0) { NeutralGear = false; } else { currentGear--; } } else { currentGear--; } shiftDelay = timeSinceLevelLoad + 0.1f; shiftTime = 2f; } private void OnCollisionEnter(Collision collision) { //IL_002b: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>())) { VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>(); Vector3 relativeVelocity = collision.relativeVelocity; component.slip2 = Mathf.Clamp(((Vector3)(ref relativeVelocity)).magnitude, 0f, 10f); myRigidbody.angularVelocity = new Vector3((0f - myRigidbody.angularVelocity.x) * 0.5f, myRigidbody.angularVelocity.y * 0.5f, (0f - myRigidbody.angularVelocity.z) * 0.5f); myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, myRigidbody.velocity.y * 0.5f, myRigidbody.velocity.z); } } private void OnCollisionStay(Collision collision) { if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>())) { ((Component)collision.transform.root).GetComponent<VehicleControl>().slip2 = 5f; } } private void Update() { } private void FixedUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09d0: Unknown result type (might be due to invalid IL or missing references) //IL_0e40: Unknown result type (might be due to invalid IL or missing references) //IL_0e4a: Unknown result type (might be due to invalid IL or missing references) //IL_0d79: Unknown result type (might be due to invalid IL or missing references) //IL_0d80: Unknown result type (might be due to invalid IL or missing references) //IL_0d85: Unknown result type (might be due to invalid IL or missing references) //IL_0d9f: Unknown result type (might be due to invalid IL or missing references) //IL_0daa: Unknown result type (might be due to invalid IL or missing references) //IL_0db4: Unknown result type (might be due to invalid IL or missing references) //IL_0dca: Unknown result type (might be due to invalid IL or missing references) //IL_0e5f: Unknown result type (might be due to invalid IL or missing references) //IL_0a21: Unknown result type (might be due to invalid IL or missing references) //IL_0a26: Unknown result type (might be due to invalid IL or missing references) //IL_0be3: Unknown result type (might be due to invalid IL or missing references) if (!isOn) { accel = 0f; } Vector3 velocity = myRigidbody.velocity; speed = ((Vector3)(ref velocity)).magnitude * 2.7f; if (speed < lastSpeed - 10f && slip < 10f) { slip = lastSpeed / 15f; } lastSpeed = speed; if (slip2 != 0f) { slip2 = Mathf.MoveTowards(slip2, 0f, 0.1f); } myRigidbody.centerOfMass = carSetting.shiftCentre; if (!carWheels.wheels.frontWheelDrive && !carWheels.wheels.backWheelDrive) { accel = 0f; } if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { carSetting.carSteer.localEulerAngles = new Vector3(steerCurAngle.x, steerCurAngle.y, steerCurAngle.z + steer * -120f); } if (carSetting.automaticGear && currentGear == 1 && accel < 0f) { if (speed < 5f) { ShiftDown(ignoreDelay: false); } } else if (carSetting.automaticGear && currentGear == 0 && accel > 0f) { if (speed < 5f) { ShiftUp(ignoreDelay: false); } } else if (carSetting.automaticGear && motorRPM > carSetting.shiftUpRPM && accel > 0f && speed > 10f && !brake) { ShiftUp(ignoreDelay: false); } else if (carSetting.automaticGear && motorRPM < carSetting.shiftDownRPM && currentGear > 1) { ShiftDown(ignoreDelay: false); } if (speed < 1f) { Backward = true; } if (currentGear != 0 || !Backward) { Backward = false; } Light[] brakeLights = carLights.brakeLights; foreach (Light val in brakeLights) { if (brake || accel < 0f || speed < 1f) { val.intensity = Mathf.MoveTowards(val.intensity, 8f, 0.5f); } else { val.intensity = Mathf.MoveTowards(val.intensity, 0f, 0.5f); } ((Behaviour)val).enabled = val.intensity != 0f; } brakeLights = carLights.reverseLights; foreach (Light val2 in brakeLights) { if (speed > 2f && currentGear == 0) { val2.intensity = Mathf.MoveTowards(val2.intensity, 8f, 0.5f); } else { val2.intensity = Mathf.MoveTowards(val2.intensity, 0f, 0.5f); } ((Behaviour)val2).enabled = val2.intensity != 0f; } wantedRPM = 5500f * accel * 0.1f + wantedRPM * 0.9f; float num = 0f; int num2 = 0; bool flag = false; int num3 = 0; WheelComponent[] array = wheels; WheelHit val4 = default(WheelHit); foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; if (wheelComponent.drive) { num = ((!NeutralGear && brake && currentGear < 2) ? (num + accel * carSetting.idleRPM) : (NeutralGear ? (num + carSetting.idleRPM * accel) : (num + collider.rpm))); num2++; } if (brake || accel < 0f) { if (accel < 0f || (brake && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (brake && accel > 0f) { slip = Mathf.Lerp(slip, 5f, accel * 0.01f); } else if (speed > 1f) { slip = Mathf.Lerp(slip, 1f, 0.002f); } else { slip = Mathf.Lerp(slip, 1f, 0.02f); } wantedRPM = 0f; collider.brakeTorque = carSetting.brakePower; wheelComponent.rotation = w_rotate; } } else { float brakeTorque; if (accel != 0f && !NeutralGear) { float num5 = (collider.brakeTorque = 0f); brakeTorque = num5; } else { float num5 = (collider.brakeTorque = 1000f); brakeTorque = num5; } collider.brakeTorque = brakeTorque; slip = ((!(speed > 0f)) ? (slip = Mathf.Lerp(slip, 0.01f, 0.02f)) : ((speed > 100f) ? (slip = Mathf.Lerp(slip, 1f + Mathf.Abs(steer), 0.02f)) : (slip = Mathf.Lerp(slip, 1.5f, 0.02f)))); w_rotate = wheelComponent.rotation; } WheelFrictionCurve val3 = collider.forwardFriction; ((WheelFrictionCurve)(ref val3)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val3)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val3)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); collider.forwardFriction = val3; val3 = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); ((WheelFrictionCurve)(ref val3)).extremumSlip = 0.2f + Mathf.Abs(steer); collider.sidewaysFriction = val3; if (shift && currentGear > 1 && speed > 50f && shifmotor && Mathf.Abs(steer) < 0.2f) { if (powerShift == 0f) { shifmotor = false; } powerShift = Mathf.MoveTowards(powerShift, 0f, Time.deltaTime * 10f); carSounds.nitro.volume = Mathf.Lerp(carSounds.nitro.volume, 1f, Time.deltaTime * 10f); if (!carSounds.nitro.isPlaying) { ((Component)carSounds.nitro).GetComponent<AudioSource>().Play(); } curTorque = ((powerShift > 0f) ? carSetting.shiftPower : carSetting.carPower); carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); } else { if (powerShift > 20f) { shifmotor = true; } carSounds.nitro.volume = Mathf.MoveTowards(carSounds.nitro.volume, 0f, Time.deltaTime * 2f); if (carSounds.nitro.volume == 0f) { carSounds.nitro.Stop(); } powerShift = Mathf.MoveTowards(powerShift, 100f, Time.deltaTime * 5f); curTorque = carSetting.carPower; carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, 0f, Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, 0f, Time.deltaTime * 10f); } wheelComponent.rotation = Mathf.Repeat(wheelComponent.rotation + Time.deltaTime * collider.rpm * 360f / 60f, 360f); wheelComponent.rotation2 = Mathf.Lerp(wheelComponent.rotation2, collider.steerAngle, 0.1f); wheelComponent.wheel.localRotation = Quaternion.Euler(wheelComponent.rotation, wheelComponent.rotation2, 0f); Vector3 localPosition = wheelComponent.wheel.localPosition; if (collider.GetGroundHit(ref val4)) { if (Object.op_Implicit((Object)(object)carParticles.brakeParticlePerfab)) { if ((Object)(object)Particle[num3] == (Object)null) { Particle[num3] = Object.Instantiate<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity); ((Object)Particle[num3]).name = "WheelParticle"; Particle[num3].transform.parent = ((Component)this).transform; Particle[num3].AddComponent<AudioSource>(); Particle[num3].GetComponent<AudioSource>().maxDistance = 50f; Particle[num3].GetComponent<AudioSource>().spatialBlend = 1f; Particle[num3].GetComponent<AudioSource>().dopplerLevel = 5f; Particle[num3].GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)2; } ParticleSystem component = Particle[num3].GetComponent<ParticleSystem>(); bool flag2 = false; for (int j = 0; j < carSetting.hitGround.Length; j++) { if (((Component)((WheelHit)(ref val4)).collider).CompareTag(carSetting.hitGround[j].tag)) { flag2 = carSetting.hitGround[j].grounded; if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.5f) && speed > 1f) { Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[j].brakeSound; } else if ((Object)(object)Particle[num3].GetComponent<AudioSource>().clip != (Object)(object)carSetting.hitGround[j].groundSound && !Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[j].groundSound; } Particle[num3].GetComponent<ParticleSystem>().startColor = carSetting.hitGround[j].brakeColor; } } if (flag2 && speed > 5f && !brake) { component.enableEmission = true; Particle[num3].GetComponent<AudioSource>().volume = 0.5f; if (!Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().Play(); } } else if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && speed > 1f) { if (accel < 0f || ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (!Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().Play(); } component.enableEmission = true; Particle[num3].GetComponent<AudioSource>().volume = 10f; } } else { component.enableEmission = false; Particle[num3].GetComponent<AudioSource>().volume = Mathf.Lerp(Particle[num3].GetComponent<AudioSource>().volume, 0f, Time.deltaTime * 10f); } } localPosition.y -= Vector3.Dot(wheelComponent.wheel.position - ((WheelHit)(ref val4)).point, ((Component)this).transform.TransformDirection(0f, 1f, 0f) / ((Component)this).transform.lossyScale.x) - collider.radius; localPosition.y = Mathf.Clamp(localPosition.y, -10f, wheelComponent.pos_y); flag = flag || wheelComponent.drive; } else { if ((Object)(object)Particle[num3] != (Object)null) { Particle[num3].GetComponent<ParticleSystem>().enableEmission = false; } localPosition.y = wheelComponent.startPos.y - wheelComponent.settings.Distance; myRigidbody.AddForce(Vector3.down * 5000f); } num3++; wheelComponent.wheel.localPosition = localPosition; } if (num2 > 1) { num /= (float)num2; } motorRPM = 0.95f * motorRPM + 0.05f * Mathf.Abs(num * carSetting.gears[currentGear]); if (motorRPM > 5500f) { motorRPM = 5200f; } int num7 = (int)(motorRPM / efficiencyTableStep); if (num7 >= efficiencyTable.Length) { num7 = efficiencyTable.Length - 1; } if (num7 < 0) { num7 = 0; } float num8 = curTorque * carSetting.gears[currentGear] * efficiencyTable[num7]; array = wheels; foreach (WheelComponent wheelComponent2 in array) { WheelCollider collider2 = wheelComponent2.collider; if (wheelComponent2.drive) { if (Mathf.Abs(collider2.rpm) > Mathf.Abs(wantedRPM)) { collider2.motorTorque = 0f; } else { float motorTorque = collider2.motorTorque; if (!brake && accel != 0f && !NeutralGear) { if ((speed < carSetting.LimitForwardSpeed && currentGear > 0) || (speed < carSetting.LimitBackwardSpeed && currentGear == 0)) { collider2.motorTorque = motorTorque * 0.9f + num8 * 1f; } else { collider2.motorTorque = 0f; collider2.brakeTorque = 2000f; } } else { collider2.motorTorque = 0f; } } } if (brake || slip2 > 2f) { collider2.steerAngle = Mathf.Lerp(collider2.steerAngle, steer * wheelComponent2.maxSteer, 0.02f); continue; } float num9 = Mathf.Clamp(speed / carSetting.maxSteerAngle, 1f, carSetting.maxSteerAngle); collider2.steerAngle = steer * (wheelComponent2.maxSteer / num9); } Pitch = Mathf.Clamp(1.2f + (motorRPM - carSetting.idleRPM) / (carSetting.shiftUpRPM - carSetting.idleRPM), carSounds.minPitch, carSounds.maxPitch); shiftTime = Mathf.MoveTowards(shiftTime, 0f, 0.1f); if (Pitch == 1f) { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1f, 0.1f); carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.1f); } else { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1.8f - Pitch, 0.1f); if ((Pitch > PitchDelay || accel > 0f) && shiftTime == 0f) { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0f, 0.2f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 1f, 0.1f); } else { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.2f); } carSounds.HighEngine.pitch = Pitch; carSounds.LowEngine.pitch = Pitch; PitchDelay = Pitch; } if (!isOn) { carSounds.IdleEngine.volume = 0f; carSounds.LowEngine.volume = 0f; carSounds.HighEngine.volume = 0f; } } private void OnDrawGizmos() { //IL_001b: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) if (carSetting.showNormalGizmos && !Application.isPlaying) { Gizmos.matrix = Matrix4x4.TRS(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.lossyScale); Gizmos.color = new Color(1f, 0f, 0f, 0.5f); Gizmos.DrawCube(Vector3.up / 1.5f, new Vector3(2.5f, 2f, 6f)); Gizmos.DrawSphere(carSetting.shiftCentre / ((Component)this).transform.lossyScale.x, 0.2f); } } } namespace H3VRUtils { [BepInPlugin("dll.wfiost.h3vrutilitieslib.vehicles", "H3VR Utilities Vehicles Library", "8.11.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("h3vr.exe")] public class BepInExLoader_VehiclesLib : BaseUnityPlugin { } } namespace H3VRUtils.Vehicles { internal class EngineDamagable : VehicleDamagable { public GameObject particleSystemCentre; public GameObject explosionCentre; public float SmokeParticleHPThreshold; public GameObject particleSmokePrefab; public GameObject particleFirePrefab; public GameObject explosionPrefab; public GameObject fixedMesh; public GameObject damagedMesh; public GameObject destroyedMesh; public float explosionStrength = 200f; private ParticleSystem particleSmoke; private ParticleSystem particleFire; private bool dontChangeMesh; public void Start() { if ((Object)(object)fixedMesh == (Object)null || (Object)(object)damagedMesh == (Object)null || (Object)(object)destroyedMesh == (Object)null) { dontChangeMesh = true; } GameObject val = Object.Instantiate<GameObject>(particleSmokePrefab, particleSystemCentre.transform); particleSmoke = val.GetComponent<ParticleSystem>(); particleSmoke.Stop(); GameObject val2 = Object.Instantiate<GameObject>(particleFirePrefab, particleSystemCentre.transform); particleFire = val2.GetComponent<ParticleSystem>(); particleFire.Stop(); } public override void onHealthChange() { if (HPLessThanPercent(SmokeParticleHPThreshold)) { if (!particleSmoke.IsAlive()) { particleSmoke.Play(); } } else { particleSmoke.Stop(); } if (!dontChangeMesh) { if (health < 0f) { fixedMesh.SetActive(false); damagedMesh.SetActive(false); destroyedMesh.SetActive(true); } else if (HPLessThanPercent(SmokeParticleHPThreshold)) { fixedMesh.SetActive(false); damagedMesh.SetActive(true); destroyedMesh.SetActive(false); } else { fixedMesh.SetActive(true); damagedMesh.SetActive(false); destroyedMesh.SetActive(false); } } } public override void onDeath() { //IL_002a: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) particleFire.Play(); if ((Object)(object)explosionPrefab != (Object)null) { Object.Instantiate<GameObject>(explosionPrefab, explosionCentre.transform.position, explosionCentre.transform.rotation); vehicle.GetRigidbody().AddForceAtPosition(new Vector3(0f, explosionStrength, 0f), ((Component)this).transform.position); } vehicle.TurnOffEngine(forcibly: true); } public override void whileDead() { vehicle.isForciblyOff = true; } public override void whileUndead() { } public override void Heal(float heal) { base.Heal(heal); } public override void HealPercent(float percentHeal) { base.HealPercent(percentHeal); } public override void onUndeath() { particleFire.Stop(); vehicle.isForciblyOff = false; } public override void Damage(Damage dmg) { float damage = getDamage(dmg); health -= damage; } } public class FuelTank : VehicleDamagable { public float currentFuel; public float maxFuel; public float fuelUsagePer1000Rpm = 0.01f; public float leakMult; public GameObject explosionEffect; public bool BlowsOnDeath; public AudioSource leakSound; private new void FixedUpdate() { base.FixedUpdate(); float num = vehicle.motorRPM / 1000f * (fuelUsagePer1000Rpm / 3000f); currentFuel -= num; float num2 = Mathf.InverseLerp(maxHealth * 0.5f, 0f, health); currentFuel -= num2 * leakMult / 50f; if ((Object)(object)leakSound != (Object)null) { leakSound.volume = num2; } if (currentFuel < 0f) { currentFuel = 0f; } if (currentFuel == 0f) { vehicle.TurnOffEngine(forcibly: false); } } public override void whileDead() { base.whileDead(); } public override void onDeath() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) base.onDeath(); if (BlowsOnDeath) { Object.Instantiate<GameObject>(explosionEffect, ((Component)this).transform.position, ((Component)this).transform.rotation); currentFuel = 0f; } } public float AddFuel(float fuelAdded) { currentFuel += fuelAdded; float num = maxFuel - currentFuel; if (num <= 0f) { return 0f; } return num; } } [Serializable] public class VehicleDamagableMult { public float projectileMult = 1f; public float meleeMult = 1f; public float explosionMult = 1f; public float piercingMult = 1f; public float cuttingMult = 1f; public float thermalMult = 1f; public float bluntMult = 1f; public float totalKineticMult = 1f; } public class VehicleDamagable : MonoBehaviour, IFVRDamageable { public float health; public float maxHealth; public float minHealth; public VehicleDamagableMult dmgMult; public VehicleControl vehicle; public bool dead; private float prevhealth; public virtual void FixedUpdate() { if (health < 0f) { if (!dead) { onDeath(); dead = true; } whileDead(); } else { if (dead) { onUndeath(); dead = false; } whileUndead(); } if (health < minHealth) { health = minHealth; } if (health != prevhealth) { onHealthChange(); } prevhealth = health; } public virtual void onHealthChange() { } public bool HPLessThan(float num) { if (health < num) { return true; } return false; } public bool HPLessThanPercent(float num) { if (health < num * maxHealth) { return true; } return false; } public virtual void onDeath() { } public virtual void whileDead() { } public virtual void whileUndead() { } public virtual void onUndeath() { } public virtual void HealPercent(float percentHeal) { Heal(percentHeal * maxHealth); Debug.Log((object)("percenthealing for " + percentHeal)); } public virtual void Heal(float heal) { health += heal; Debug.Log((object)("Healed for " + heal)); } public virtual void Damage(Damage dmg) { health -= getDamage(dmg); } public float getDamage(Damage dmg) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Invalid comparison between Unknown and I4 float num = Vector3.Angle(dmg.strikeDir, -dmg.hitNormal); float num2 = Mathf.Clamp((1f - num / 90f) * 1.5f, 0.4f, 1.5f); dmg.Dam_Blunt *= num2; dmg.Dam_Cutting *= num2; dmg.Dam_Piercing *= num2; dmg.Dam_TotalKinetic *= num2; if ((int)dmg.Class == 1) { dmg.Dam_Blunt *= dmgMult.projectileMult; dmg.Dam_Cutting *= dmgMult.projectileMult; dmg.Dam_Piercing *= dmgMult.projectileMult; dmg.Dam_TotalKinetic *= dmgMult.projectileMult; } else if ((int)dmg.Class == 3) { dmg.Dam_Blunt *= dmgMult.meleeMult; dmg.Dam_Cutting *= dmgMult.meleeMult; dmg.Dam_Piercing *= dmgMult.meleeMult; dmg.Dam_TotalKinetic *= dmgMult.meleeMult; } else if ((int)dmg.Class == 2) { dmg.Dam_Blunt *= dmgMult.explosionMult; dmg.Dam_Cutting *= dmgMult.explosionMult; dmg.Dam_Piercing *= dmgMult.explosionMult; dmg.Dam_TotalKinetic *= dmgMult.explosionMult; } dmg.Dam_Blunt *= dmgMult.bluntMult; dmg.Dam_Cutting *= dmgMult.cuttingMult; dmg.Dam_TotalKinetic *= dmgMult.totalKineticMult; dmg.Dam_Piercing *= dmgMult.piercingMult; dmg.Dam_Thermal *= dmgMult.thermalMult; float num3 = 0f; num3 += dmg.Dam_Blunt; num3 += dmg.Dam_Cutting; num3 += dmg.Dam_Piercing; num3 += dmg.Dam_Piercing; num3 += dmg.Dam_Thermal; Debug.Log((object)("Damage taken: " + num3)); return num3; } } internal class EnterVehicle : FVRInteractiveObject { public VehicleSeat vehicleSeat; public override void SimpleInteraction(FVRViveHand hand) { //IL_007a: 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_00e8: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); if (hand.IsThisTheRightHand) { hand = hand.OtherHand; } if ((Object)(object)vehicleSeat.hand == (Object)null) { if (VehicleSeat.currentSeat.ContainsKey(hand)) { VehicleSeat.currentSeat[hand].RemoveHand(); } VehicleSeat.currentSeat.Add(hand, vehicleSeat); vehicleSeat.hand = hand; hand.MovementManager.TeleportToPoint(vehicleSeat.SitPos.transform.position, false, vehicleSeat.SitPos.transform.localEulerAngles); } else if ((Object)(object)hand == (Object)(object)vehicleSeat.hand) { vehicleSeat.RemoveHand(); if ((Object)(object)vehicleSeat.EjectPos != (Object)null) { ((Component)hand.MovementManager).transform.position = vehicleSeat.EjectPos.transform.position; } } } } public class ButtonIgnition : FVRInteractiveObject { public VehicleControl vehicle; public VehicleAudioSet audioSet; public float ignitionTime; private float m_it; public float failChance; public Random rand; public void Start() { rand = new Random(); } public override void BeginInteraction(FVRViveHand hand) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) m_it = ignitionTime; if (vehicle.isOn) { SM.PlayGenericSound(audioSet.VehicleStop, ((Component)this).transform.position); m_it = 999999f; vehicle.TurnOffEngine(forcibly: false); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); m_it -= Time.fixedDeltaTime; if (m_it <= 0f) { vehicle.TurnOnEngine(forcibly: false); SM.PlayGenericSound(audioSet.VehicleStart, ((Component)this).transform.position); m_it = 999999f; } } } [Serializable] public class DriveShiftNode { public Vector3 localposition; public Vector3 rotation; public int left = -1; public int up = -1; public int right = -1; public int down = -1; public int gear; } public class DriveShift : FVRInteractiveObject { public VehicleControl vehicle; public Text gearText; public int currentNode; public List<DriveShiftNode> driveShiftNodes; public VehicleAudioSet audioSet; public void Update() { if (vehicle.carSetting.automaticGear) { if (vehicle.currentGear > 0 && vehicle.speed > 1f) { gearText.text = vehicle.currentGear.ToString(); } else if (vehicle.speed > 1f) { gearText.text = "R"; } else { gearText.text = "N"; } } else if (vehicle.NeutralGear) { gearText.text = "N"; } else if (vehicle.currentGear != 0) { gearText.text = vehicle.currentGear.ToString(); } else { gearText.text = "R"; } } private void Start() { //IL_0038: 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) vehicle.ShiftTo(driveShiftNodes[currentNode].gear); ((Component)this).transform.localPosition = driveShiftNodes[currentNode].localposition; ((Component)this).transform.localEulerAngles = driveShiftNodes[currentNode].rotation; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0008: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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) bool flag = false; if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].left != -1) { flag = true; currentNode = driveShiftNodes[currentNode].left; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].up != -1) { flag = true; currentNode = driveShiftNodes[currentNode].up; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].right != -1) { flag = true; currentNode = driveShiftNodes[currentNode].right; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].down != -1) { flag = true; currentNode = driveShiftNodes[currentNode].down; } if (flag) { vehicle.ShiftTo(driveShiftNodes[currentNode].gear); ((Component)this).transform.localPosition = driveShiftNodes[currentNode].localposition; ((Component)this).transform.localEulerAngles = driveShiftNodes[currentNode].rotation; } } } public class ParkingBrakeClick : FVRInteractiveObject { public VehicleControl vehicle; public Vector3 positionOff; public Vector3 positionOn; public Vector3 rotationOff; public Vector3 rotationOn; public bool isOn; public VehicleAudioSet audioSet; public override void SimpleInteraction(FVRViveHand hand) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0040: 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) ((FVRInteractiveObject)this).SimpleInteraction(hand); isOn = !isOn; if (isOn) { SM.PlayGenericSound(audioSet.HandbrakeUp, ((Component)this).transform.position); ((Component)this).transform.localPosition = positionOn; ((Component)this).transform.localEulerAngles = rotationOn; vehicle.brake = true; } else { SM.PlayGenericSound(audioSet.HandbrakeDown, ((Component)this).transform.position); ((Component)this).transform.localPosition = positionOff; ((Component)this).transform.localEulerAngles = rotationOff; vehicle.brake = false; } } } internal class SteeringWheel : FVRInteractiveObject { public VehicleControl vehicle; public float resetLerpSpeed; public float maxRot; public bool reverseRot; [Header("Debug Values")] public Text rotText; public float rot; public float rh; public float lr; public float inlerp; public float lerp; public float rotAmt; public VehicleAudioSet audioSet; public override void BeginInteraction(FVRViveHand hand) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0053: 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) ((FVRInteractiveObject)this).BeginInteraction(hand); Transform child = ((Component)this).transform.GetChild(0); child.parent = null; Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; ((Component)this).transform.LookAt(((Component)hand).transform); ((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, ((Component)this).transform.localEulerAngles.y, localEulerAngles.z); child.parent = ((Component)this).transform; } public override void EndInteraction(FVRViveHand hand) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).EndInteraction(hand); Transform child = ((Component)this).transform.GetChild(0); child.parent = null; ((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, 0f, ((Component)this).transform.localEulerAngles.z); child.parent = ((Component)this).transform; } public override void UpdateInteraction(FVRViveHand hand) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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_0031: 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_0088: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00dd: 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) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; ((Component)this).transform.LookAt(((Component)hand).transform); Vector3 localEulerAngles2 = ((Component)this).transform.localEulerAngles; rot = Mathf.DeltaAngle((float)Math.Round(localEulerAngles2.y), (float)Math.Round(localEulerAngles.y)); rotAmt += rot; if (rotAmt >= maxRot) { rotAmt = maxRot; ((Component)this).transform.localEulerAngles = localEulerAngles; } else if (rotAmt <= 0f - maxRot) { rotAmt = 0f - maxRot; ((Component)this).transform.localEulerAngles = localEulerAngles; } else { ((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles2.y, localEulerAngles.z); } rh = localEulerAngles2.y; lr = localEulerAngles.y; SetRot(); bool flag = false; if (hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.25f) { flag = true; } if (flag) { vehicle.accel = 0f - (float)Math.Pow(((Vector2)(ref hand.Input.TouchpadAxes)).magnitude, 2.0); vehicle.brake = true; } else { vehicle.accel = (float)Math.Pow(hand.Input.TriggerFloat, 2.0); vehicle.brake = false; } } private void FixedUpdate() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) if ((Object)(object)base.m_hand == (Object)null) { float num = resetLerpSpeed; if (rotAmt > 0f) { num = 0f - num; } if (rotAmt > num || rotAmt < 0f - num) { rotAmt += num; ((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, ((Component)this).transform.localEulerAngles.y - num, ((Component)this).transform.localEulerAngles.z); vehicle.accel = 0f; SetRot(); } } } private void SetRot() { bool num = rotAmt <= 0f; lerp = Mathf.Abs(rotAmt) / maxRot; lerp *= -1f; if (num) { lerp *= -1f; } if (reverseRot) { lerp = 0f - lerp; } if ((Object)(object)rotText != (Object)null) { rotText.text = lerp.ToString(); } vehicle.steer = lerp; } } [CreateAssetMenu(fileName = "New Vehicle Audio Set", menuName = "Vehicles/AudioSet", order = 0)] public class VehicleAudioSet : ScriptableObject { private static AudioEvent defaultAE = new AudioEvent { PitchRange = new Vector2(0.98f, 1.04f), VolumeRange = new Vector2(0.98f, 1.04f), ClipLengthRange = new Vector2(1f, 1f) }; public AudioEvent VehicleStart; public AudioEvent VehicleIdle; public AudioEvent VehicleStop; public AudioEvent HandbrakeUp; public AudioEvent HandbrakeDown; public AudioEvent ShiftDownGear; public AudioEvent RevLoop; public AudioEvent ShiftUpGear; public AudioEvent Brake; public AudioEvent BrakeLong; public AudioEvent PedalSwitchSound; } internal class VehicleSeat : MonoBehaviour { public static Dictionary<FVRViveHand, VehicleSeat> currentSeat = new Dictionary<FVRViveHand, VehicleSeat>(); public FVRViveHand hand; public GameObject SitPos; public GameObject EjectPos; public void Update() { //IL_0021: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_0127: 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_0158: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hand != (Object)null) { if (Vector3.Distance(((Component)hand.MovementManager).transform.position, ((Component)this).transform.position) > 25f) { RemoveHand(); } ((Component)hand.MovementManager).transform.position = SitPos.transform.position; Vector3 eulerAngles = ((Component)hand.MovementManager).transform.eulerAngles; if (UtilsBepInExLoader.VehicleLockXRot.Value) { eulerAngles.x = SitPos.transform.rotation.x; } if (UtilsBepInExLoader.VehicleLockYRot.Value) { eulerAngles.y = SitPos.transform.rotation.y; } if (UtilsBepInExLoader.VehicleLockZRot.Value) { eulerAngles.z = SitPos.transform.rotation.z; } ((Component)hand.MovementManager).transform.eulerAngles = Vector3.Lerp(((Component)hand.MovementManager).transform.eulerAngles, eulerAngles, 0.2f * Time.deltaTime); if (GM.CurrentPlayerBody.GetPlayerHealth() <= 0f) { RemoveHand(); } if (((Component)hand.MovementManager).transform.position.y < GM.CurrentSceneSettings.CatchHeight) { RemoveHand(); } } } public void RemoveHand() { if (currentSeat.ContainsKey(hand)) { currentSeat.Remove(hand); } hand = null; } } public class FuelNeedle : MonoBehaviour { public FuelTank tank; public GameObject needle; public Vector3 needleNoFuel; public Vector3 needleMaxFuel; public void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float currentFuel = tank.currentFuel; float num = Mathf.InverseLerp(0f, tank.maxFuel, currentFuel); needle.transform.localEulerAngles = Vector3.Lerp(needleNoFuel, needleMaxFuel, num); } } public class SpedometerNeedle : MonoBehaviour { public VehicleControl vehicle; public GameObject needle; public bool isImperial; public float maxSpeed; public Vector3 needleNoSpeed; public Vector3 needleMaxSpeed; public void Update() { //IL_003f: 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_004b: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(vehicle.speed); if (isImperial) { num *= 0.6213712f; } float num2 = Mathf.InverseLerp(0f, maxSpeed, num); needle.transform.localEulerAngles = Vector3.Lerp(needleNoSpeed, needleMaxSpeed, num2); } } internal class ForkliftLift : FVRInteractiveObject { public Vector3 rotUpwards; public Vector3 rotRegular; public Vector3 rotDownwards; public GameObject lift; public float liftSpeed; public float minLiftY; public float maxLiftY; public override void UpdateInteraction(FVRViveHand hand) { //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_001f: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00f9: 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_0087: 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_00ef: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 position = lift.transform.position; ((Component)this).transform.localEulerAngles = rotRegular; if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { position.y += liftSpeed / 50f; ((Component)this).transform.localEulerAngles = rotUpwards; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { position.y -= liftSpeed / 50f; ((Component)this).transform.localEulerAngles = rotDownwards; } if (position.y > maxLiftY) { position.y = maxLiftY; } else if (position.y < minLiftY) { position.y = minLiftY; } lift.transform.position = position; } } } namespace H3VRUtils.Vehicles.Core { public class DamagingArea : MonoBehaviour { public VehicleControl vehicle; public float damageMult = 15f; public float sharpyness = 50f; private void OnCollisionEnter(Collision other) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002d: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) if (!(vehicle.speed < 12f)) { IFVRDamageable component = other.gameObject.GetComponent<IFVRDamageable>(); if (component != null) { Damage val = new Damage(); val.Class = (DamageClass)4; val.Dam_Piercing = sharpyness; val.Dam_Blunt = vehicle.speed * damageMult; val.Dam_TotalKinetic = val.Dam_Blunt + val.Dam_Piercing; val.point = ((ContactPoint)(ref other.contacts[0])).point; val.hitNormal = ((ContactPoint)(ref other.contacts[0])).normal; val.strikeDir = ((Component)this).transform.forward; component.Damage(val); } } } } }
plugins/H3VRUtilities.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using FistVR; using H3VRUtils.FVRInteractiveObjects; using H3VRUtils.NewScripts; using UnityEngine; using UnityEngine.Serialization; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace FistVR { public class AR15HandleFlipperSounds : FVRInteractiveObject { public enum Axis { X, Y, Z } private bool m_isLargeAperture = true; public Transform Flipsight; public float m_flipsightStartRotX; public float m_flipsightEndRotX = -90f; private float m_flipsightCurRotX; public Axis RotAxis; private float m_curFlipLerp; private float m_tarFlipLerp; private float m_lastFlipLerp; public AudioEvent AudClipOpen; public AudioEvent AudClipClose; public override void Awake() { ((FVRInteractiveObject)this).Awake(); } public override void SimpleInteraction(FVRViveHand hand) { //IL_0042: 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) ((FVRInteractiveObject)this).SimpleInteraction(hand); m_isLargeAperture = !m_isLargeAperture; try { if (!m_isLargeAperture) { SM.PlayGenericSound(AudClipOpen, ((Component)this).transform.position); } else { SM.PlayGenericSound(AudClipClose, ((Component)this).transform.position); } } catch { Console.WriteLine(((Object)this).name + " failed to play sound!"); } } public override void FVRUpdate() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00ed: 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_008d: Invalid comparison between Unknown and I4 //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 //IL_00a9: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (m_isLargeAperture) { m_tarFlipLerp = 0f; } else { m_tarFlipLerp = 1f; } m_curFlipLerp = Mathf.MoveTowards(m_curFlipLerp, m_tarFlipLerp, Time.deltaTime * 4f); if (Mathf.Abs(m_curFlipLerp - m_lastFlipLerp) > 0.01f) { m_flipsightCurRotX = Mathf.Lerp(m_flipsightStartRotX, m_flipsightEndRotX, m_curFlipLerp); Axis rotAxis = RotAxis; if ((int)rotAxis != 0) { if ((int)rotAxis != 1) { if ((int)rotAxis == 2) { Flipsight.localEulerAngles = new Vector3(0f, 0f, m_flipsightCurRotX); } } else { Flipsight.localEulerAngles = new Vector3(0f, m_flipsightCurRotX, 0f); } } else { Flipsight.localEulerAngles = new Vector3(m_flipsightCurRotX, 0f, 0f); } } m_lastFlipLerp = m_curFlipLerp; } } } namespace H3VRUtils { [BepInPlugin("dll.wfiost.h3vrutilitieslib", "H3VR Utilities Library", "8.11.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("h3vr.exe")] public class BepInExLoader_Lib : BaseUnityPlugin { } public class GetFireArmDeets { public static FVRFireArmChamber[] GetFireArmChamber(FVRFireArm firearm) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown List<FVRFireArmChamber> list = new List<FVRFireArmChamber>(); BreakActionWeapon val = (BreakActionWeapon)(object)((firearm is BreakActionWeapon) ? firearm : null); if (val == null) { Derringer val2 = (Derringer)(object)((firearm is Derringer) ? firearm : null); if (val2 == null) { SingleActionRevolver val3 = (SingleActionRevolver)(object)((firearm is SingleActionRevolver) ? firearm : null); if (val3 == null) { Revolver val4 = (Revolver)(object)((firearm is Revolver) ? firearm : null); if (val4 != null) { return val4.Chambers; } FieldInfo field = ((object)firearm).GetType().GetField("Chamber"); if ((object)field != null) { list.Add((FVRFireArmChamber)field.GetValue(firearm)); return list.ToArray(); } field = ((object)firearm).GetType().GetField("Chambers"); if ((object)field != null) { list = (List<FVRFireArmChamber>)field.GetValue(firearm); return list.ToArray(); } return null; } return val3.Cylinder.Chambers; } foreach (DBarrel barrel in val2.Barrels) { list.Add(barrel.Chamber); } return list.ToArray(); } BreakActionBarrel[] barrels = val.Barrels; foreach (BreakActionBarrel val5 in barrels) { list.Add(val5.Chamber); } return list.ToArray(); } public static FVRFirearmMovingProxyRound[] GetFireArmProxySwitch(FVRFireArm firearm, bool tryReflection = true) { List<FVRFirearmMovingProxyRound> list = new List<FVRFirearmMovingProxyRound>(); Handgun val = (Handgun)(object)((firearm is Handgun) ? firearm : null); if (val == null) { ClosedBoltWeapon val2 = (ClosedBoltWeapon)(object)((firearm is ClosedBoltWeapon) ? firearm : null); if (val2 == null) { OpenBoltReceiver val3 = (OpenBoltReceiver)(object)((firearm is OpenBoltReceiver) ? firearm : null); if (val3 == null) { LeverActionFirearm val4 = (LeverActionFirearm)(object)((firearm is LeverActionFirearm) ? firearm : null); if (val4 == null) { BoltActionRifle val5 = (BoltActionRifle)(object)((firearm is BoltActionRifle) ? firearm : null); if (val5 == null) { TubeFedShotgun val6 = (TubeFedShotgun)(object)((firearm is TubeFedShotgun) ? firearm : null); if (val6 == null) { if (!(firearm is Airgun) && tryReflection) { list = GetFireArmProxyReflection(firearm).ToList(); } } else { list.Add(val6.m_proxy); } } else { list.Add(val5.m_proxy); } } else { list.Add(val4.m_proxy); list.Add(val4.m_proxy2); } } else { list.Add(val3.m_proxy); } } else { list.Add(val2.m_proxy); } } else { list.Add(val.m_proxy); } list.RemoveAll((FVRFirearmMovingProxyRound item) => (Object)(object)item == (Object)null); return list.ToArray(); } public static FVRFirearmMovingProxyRound[] GetFireArmProxyReflection(FVRFireArm firearm) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown if ((Object)(object)firearm == (Object)null) { Debug.Log((object)"GetFirearmDeets.GetFireArmProxy: Firearm is null!"); return null; } List<FVRFirearmMovingProxyRound> list = new List<FVRFirearmMovingProxyRound>(); FieldInfo field = ((object)firearm).GetType().GetField("m_proxy"); FieldInfo field2 = ((object)firearm).GetType().GetField("m_proxy2"); if ((object)field != null) { object value = field.GetValue(firearm); if (value != null) { list.Add((FVRFirearmMovingProxyRound)value); } } if ((object)field2 != null) { object value2 = field2.GetValue(firearm); if (value2 != null) { list.Add((FVRFirearmMovingProxyRound)value2); } } return list.ToArray(); } } internal class attachmentXFoldingStock : FVRFoldingStockXAxis { public FVRFireArmAttachment attachment; private float rotAngle; public void FixedUpdate() { if ((Object)(object)attachment.curMount != (Object)null) { if ((Object)(object)base.FireArm == (Object)null) { FVRFireArm component = ((Component)attachment.curMount.Parent).GetComponent<FVRFireArm>(); base.FireArm = component; Console.WriteLine("attachmentYFoldingStock has connected itself to " + (object)base.FireArm); } } else if ((Object)(object)base.FireArm != (Object)null) { base.FireArm = null; } } public override void UpdateInteraction(FVRViveHand hand) { try { ((FVRFoldingStockXAxis)this).UpdateInteraction(hand); } catch { } } } public class attachmentYFoldingStock : FVRInteractiveObject { public enum UpRightForward { Up, Down, Left, Right, Forward, Backwards } public enum StockPos { Closed, Mid, Open } [Header("Audio - AudioClose/Open only work if UseFirearmHoldingSounds is false!")] public bool UseFirearmFoldingSounds = true; public AudioEvent AudioClose; public AudioEvent AudioOpen; public UpRightForward DirOfRotation; [FormerlySerializedAs("Root")] public Transform root; [FormerlySerializedAs("Stock")] public Transform stock; public float minRot; public float maxRot; [Tooltip("Default 5; this is the angle diff at which point the stock clamps to closed/open. (AKA: if angle is 4, and minRot is 0, the difference is less than 5, so it just clamps to 0.)")] public float clampStrength = 5f; [FormerlySerializedAs("m_curPos")] public StockPos mCurPos; [FormerlySerializedAs("m_lastPos")] public StockPos mLastPos; public bool isMinClosed = true; [FormerlySerializedAs("FireArm")] [Tooltip("Leave as null if attachment.")] public FVRFireArm fireArm; public FVRFireArmAttachment attachment; [Header("Alternate Use Settings")] [Tooltip("If true, it will not affect the stock point.")] public bool isNotAttachment; public bool forBreakOpenFlareGun; public BreakOpenFlareGun flareGun; public float _rotAngle; [HideInInspector] public Vector3 lhs; public override void UpdateInteraction(FVRViveHand hand) { //IL_000d: 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_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_0023: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006b: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Invalid comparison between Unknown and I4 //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Invalid comparison between Unknown and I4 //IL_02e1: 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_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 val = ((Component)hand).transform.position - root.position; Vector3 val2 = Vector3.ProjectOnPlane(val, root.up); val = ((Vector3)(ref val2)).normalized; Vector3 val3 = -((Component)root).transform.forward; _rotAngle = Mathf.Atan2(Vector3.Dot(root.up, Vector3.Cross(val3, val)), Vector3.Dot(val3, val)) * 57.29578f; if (Mathf.Abs(_rotAngle - minRot) < 5f) { _rotAngle = minRot; } if (Mathf.Abs(_rotAngle - maxRot) < 5f) { _rotAngle = maxRot; } if (!(_rotAngle >= minRot) || !(_rotAngle <= maxRot)) { return; } stock.localEulerAngles = new Vector3(0f, _rotAngle, 0f); float num = Mathf.InverseLerp(minRot, maxRot, _rotAngle); if (!((Object)(object)fireArm != (Object)null)) { return; } if (isMinClosed) { if (num < 0.02f) { mCurPos = (StockPos)0; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } else if (num > 0.9f) { mCurPos = (StockPos)2; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = true; } } else { mCurPos = (StockPos)1; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } } else if (num < 0.1f) { mCurPos = (StockPos)2; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = true; } } else if (num > 0.98f) { mCurPos = (StockPos)0; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } else { mCurPos = (StockPos)1; if (!isNotAttachment) { fireArm.HasActiveShoulderStock = false; } } if ((int)mCurPos == 2 && (int)mLastPos != 2 && !forBreakOpenFlareGun) { if (UseFirearmFoldingSounds && (Object)(object)fireArm != (Object)null) { fireArm.PlayAudioEvent((FirearmAudioEventType)30, 1f); } if (!UseFirearmFoldingSounds) { SM.PlayGenericSound(AudioOpen, ((Component)this).transform.position); } } if ((int)mCurPos == 0 && (int)mLastPos != 0) { if (UseFirearmFoldingSounds && (Object)(object)fireArm != (Object)null) { fireArm.PlayAudioEvent((FirearmAudioEventType)31, 1f); } if (!UseFirearmFoldingSounds) { SM.PlayGenericSound(AudioClose, ((Component)this).transform.position); } if (forBreakOpenFlareGun) { flareGun.Latch(); } } if ((int)mCurPos != 0 && (int)mLastPos == 0 && forBreakOpenFlareGun) { if (UseFirearmFoldingSounds && (Object)(object)fireArm != (Object)null) { fireArm.PlayAudioEvent((FirearmAudioEventType)30, 1f); } if (!UseFirearmFoldingSounds) { SM.PlayGenericSound(AudioOpen, ((Component)this).transform.position); } if (forBreakOpenFlareGun) { flareGun.Unlatch(); } } mLastPos = mCurPos; } private void OnDrawGizmosSelected() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_003d: 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_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_007f: 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_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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) if (Application.isPlaying) { Gizmos.color = new Color(0.1f, 0.3f, 0.9f); Gizmos.DrawWireCube(((Component)stock).transform.position, Vector3.one * 0.025f); Gizmos.color = new Color(0.1f, 0.3f, 0.9f, 0.5f); Gizmos.DrawCube(((Component)stock).transform.position, Vector3.one * 0.025f); float timeSinceLevelLoad = Time.timeSinceLevelLoad; Gizmos.color = new Color(0.1f, 0.7f, 0.9f, Mathf.Clamp01((0.5f - timeSinceLevelLoad) * 2f)); Gizmos.DrawWireCube(((Component)stock).transform.position, Vector3.one * (0.1f * (timeSinceLevelLoad + 0.5f))); } Vector3 val = ((Component)stock).transform.position + -((Component)stock).transform.forward; Gizmos.color = new Color(0.7f, 0.9f, 0.1f); Gizmos.DrawWireCube(val, Vector3.one * 0.02f); Gizmos.color = new Color(0.7f, 0.9f, 0.1f, 0.5f); Gizmos.DrawCube(val, Vector3.one * 0.02f); Gizmos.color = new Color(0.9f, 0.7f, 0.1f); Vector3 val2 = ((Component)root).transform.up; Vector3 val3 = -((Component)root).transform.forward; switch (DirOfRotation) { case UpRightForward.Down: val2 = -((Component)root).transform.up; val3 = ((Component)root).transform.forward; break; case UpRightForward.Left: val2 = -((Component)root).transform.right; val3 = ((Component)root).transform.up; break; case UpRightForward.Right: val2 = ((Component)root).transform.right; val3 = -((Component)root).transform.up; break; case UpRightForward.Forward: val2 = ((Component)root).transform.forward; val3 = -((Component)root).transform.right; break; case UpRightForward.Backwards: val2 = -((Component)root).transform.forward; val3 = ((Component)root).transform.right; break; } Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(minRot, val2) * val3); Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(0f - maxRot, val2) * val3); } } public class H3VRUtilsMagRelease : FVRInteractiveObject { public enum TouchpadDirType { Up, Down, Left, Right, Trigger, NoDirection } public ClosedBoltWeapon ClosedBoltReceiver; public OpenBoltReceiver OpenBoltWeapon; public Handgun HandgunReceiver; public BoltActionRifle BoltActionWeapon; [HideInInspector] public int WepType; [HideInInspector] public bool DisallowEjection; private FVRFireArmMagazine mag; private Collider col; public bool PressDownToRelease; public TouchpadDirType TouchpadDir; public Vector2 dir; public override void Awake() { ((FVRInteractiveObject)this).Awake(); setWepType(); col = ((Component)this).GetComponent<Collider>(); } public void setWepType() { if ((Object)(object)ClosedBoltReceiver != (Object)null) { WepType = 1; } if ((Object)(object)OpenBoltWeapon != (Object)null) { WepType = 2; } if ((Object)(object)HandgunReceiver != (Object)null) { WepType = 3; } if ((Object)(object)BoltActionWeapon != (Object)null) { WepType = 4; } } public override bool IsInteractable() { if (WepType == 1) { return !((Object)(object)((FVRFireArm)ClosedBoltReceiver).Magazine == (Object)null); } if (WepType == 2) { return !((Object)(object)((FVRFireArm)OpenBoltWeapon).Magazine == (Object)null); } if (WepType == 3) { return !((Object)(object)((FVRFireArm)HandgunReceiver).Magazine == (Object)null); } return !((Object)(object)((FVRFireArm)BoltActionWeapon).Magazine == (Object)null); } public override void FVRFixedUpdate() { //IL_0007: 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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0035: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown ((FVRInteractiveObject)this).FVRFixedUpdate(); dir = Vector2.up; if ((int)UtilsBepInExLoader.paddleMagReleaseDir.Value != 5) { TouchpadDir = (TouchpadDirType)UtilsBepInExLoader.paddleMagReleaseDir.Value; } dir = TouchpadDirTypeToVector2(TouchpadDir); if (dir == Vector2.zero) { base.IsSimpleInteract = true; } else { base.IsSimpleInteract = false; } col.enabled = !DisallowEjection; } public static Vector2 TouchpadDirTypeToVector2(TouchpadDirType TouchpadDir) { //IL_0002: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) Vector2 result = default(Vector2); if (TouchpadDir == TouchpadDirType.Up) { result = Vector2.up; } if (TouchpadDir == TouchpadDirType.Down) { result = Vector2.down; } if (TouchpadDir == TouchpadDirType.Left) { result = Vector2.left; } if (TouchpadDir == TouchpadDirType.Right) { result = Vector2.right; } if (TouchpadDir == TouchpadDirType.Trigger) { result = Vector2.zero; } if (TouchpadDir == TouchpadDirType.NoDirection) { ((Vector2)(ref result))..ctor(999f, 999f); } return result; } public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (TouchpadDir == TouchpadDirType.Trigger) { dropmag(hand); } } public void dropmag(FVRViveHand hand, bool _override = false) { if (!DisallowEjection || _override) { FVRFireArmMagazine magazine = null; if (WepType == 1) { magazine = ((FVRFireArm)ClosedBoltReceiver).Magazine; ClosedBoltReceiver.ReleaseMag(); } if (WepType == 2) { magazine = ((FVRFireArm)OpenBoltWeapon).Magazine; OpenBoltWeapon.ReleaseMag(); } if (WepType == 3) { magazine = ((FVRFireArm)HandgunReceiver).Magazine; HandgunReceiver.ReleaseMag(); } if (WepType == 4) { magazine = ((FVRFireArm)BoltActionWeapon).Magazine; BoltActionWeapon.ReleaseMag(); } movemagtohand(hand, magazine); } } public void movemagtohand(FVRViveHand hand, FVRFireArmMagazine magazine) { if ((Object)(object)hand != (Object)null) { hand.ForceSetInteractable((FVRInteractiveObject)(object)magazine); } ((FVRInteractiveObject)magazine).BeginInteraction(hand); } public override void UpdateInteraction(FVRViveHand hand) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); bool flag = false; FVRFireArmMagazine magazine = null; if ((Object)(object)mag != (Object)null) { flag = true; magazine = mag; } if (WepType == 1) { mag = ((FVRFireArm)ClosedBoltReceiver).Magazine; } if (WepType == 2) { mag = ((FVRFireArm)OpenBoltWeapon).Magazine; } if (WepType == 3) { mag = ((FVRFireArm)HandgunReceiver).Magazine; } if (WepType == 4) { mag = ((FVRFireArm)BoltActionWeapon).Magazine; } if ((Object)(object)mag != (Object)null) { bool flag2 = false; if (Vector2.Angle(hand.Input.TouchpadAxes, dir) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { flag2 = true; } if ((!PressDownToRelease || !UtilsBepInExLoader.paddleMagRelease.Value || (TouchpadDir == TouchpadDirType.NoDirection && !UtilsBepInExLoader.magDropRequiredRelease.Value) || flag2 || (hand.IsInStreamlinedMode && hand.Input.AXButtonPressed)) && (TouchpadDir != TouchpadDirType.NoDirection || !UtilsBepInExLoader.magDropRequiredRelease.Value)) { dropmag(hand); ((FVRInteractiveObject)this).EndInteraction(hand); } } else { if (flag) { movemagtohand(hand, magazine); } ((FVRInteractiveObject)this).EndInteraction(hand); } } } public class H3VRUtilsPhysBoltRelease : FVRInteractiveObject { public ClosedBoltWeapon ClosedBoltReceiver; public bool ButtonPressToRelease; [HideInInspector] public Vector2 dir; public H3VRUtilsMagRelease.TouchpadDirType TouchpadDir; [HideInInspector] public int WepType; public override void Awake() { ((FVRInteractiveObject)this).Awake(); if ((Object)(object)ClosedBoltReceiver != (Object)null) { WepType = 1; } } public override void FVRFixedUpdate() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) ((FVRInteractiveObject)this).FVRFixedUpdate(); if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Up) { dir = Vector2.up; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Down) { dir = Vector2.down; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Left) { dir = Vector2.left; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Right) { dir = Vector2.right; } if (TouchpadDir == H3VRUtilsMagRelease.TouchpadDirType.Trigger) { base.IsSimpleInteract = true; } else { base.IsSimpleInteract = false; } } protected void OnHoverStay(FVRViveHand hand) { if ((TouchpadDir != H3VRUtilsMagRelease.TouchpadDirType.Trigger || hand.IsInStreamlinedMode) && (!hand.IsInStreamlinedMode || hand.Input.AXButtonPressed)) { ReleaseBolt(hand); } } public override void SimpleInteraction(FVRViveHand hand) { if (base.IsSimpleInteract) { ReleaseBolt(hand); } } public void ReleaseBolt(FVRViveHand hand, bool _forceDrop = false) { //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) bool flag = false; if (Vector2.Angle(hand.Input.TouchpadAxes, dir) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { flag = true; } if (flag || (hand.IsInStreamlinedMode && hand.Input.AXButtonPressed)) { ClosedBoltReceiver.Bolt.ReleaseBolt(); } if (!((Object)(object)((FVRInteractiveObject)ClosedBoltReceiver).m_hand == (Object)null)) { _ = (Object)(object)hand != (Object)(object)((FVRInteractiveObject)ClosedBoltReceiver).m_hand; } } } internal class HandgunSecondarySwitch : FVRInteractiveObject { public Handgun Weapon; public int CurModeIndex; public int ModeIndexToSub = 1; public Transform SelctorSwitch; public Axis Axis; public InterpStyle InterpStyle; public FireSelectorMode[] Modes; public void Awake() { UpdateBaseGunSelector(CurModeIndex); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); CycleMode(); } private void CycleMode() { CurModeIndex++; if (CurModeIndex >= Modes.Length) { CurModeIndex = 0; } UpdateBaseGunSelector(CurModeIndex); ((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)15, 1f); } private void UpdateBaseGunSelector(int i) { //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_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) FireSelectorMode val = Modes[i]; ((FVRPhysicalObject)Weapon).SetAnimatedComponent(SelctorSwitch, val.SelectorPosition, InterpStyle, Axis); FireSelectorMode obj = Weapon.FireSelectorModes[ModeIndexToSub]; obj.ModeType = val.ModeType; obj.BurstAmount = val.BurstAmount; Weapon.ResetCamBurst(); } } public class BreakOpenFlareGun : FVRFireArm { [Header("Flaregun Params")] public Renderer[] GunUndamaged; public Renderer[] GunDamaged; public FVRFireArmChamber Chamber; public Axis HingeAxis; public Transform Hinge; public float RotOut = 35f; public bool CanUnlatch = true; public bool IsHighPressureTolerant; private bool m_isHammerCocked; private bool m_isTriggerReset = true; private bool m_isLatched = true; private bool m_isDestroyed; private float TriggerFloat; public Transform Hammer; public bool HasVisibleHammer = true; public bool CanCockHammer = true; public bool CocksOnOpen; private float m_hammerXRot; public Axis HammerAxis; public InterpStyle HammerInterp = (InterpStyle)1; public float HammerMinRot; public float HammerMaxRot = -70f; public Transform Trigger; public Vector2 TriggerForwardBackRots; public Transform Muzzle; public ParticleSystem SmokePSystem; public ParticleSystem DestroyPSystem; public bool DeletesCartridgeOnFire; public override void Awake() { ((FVRFireArm)this).Awake(); if (CanUnlatch) { Chamber.IsAccessible = false; } else { Chamber.IsAccessible = true; } } public override void FVRUpdate() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (HasVisibleHammer) { if (m_isHammerCocked) { m_hammerXRot = Mathf.Lerp(m_hammerXRot, HammerMaxRot, Time.deltaTime * 12f); } else { m_hammerXRot = Mathf.Lerp(m_hammerXRot, 0f, Time.deltaTime * 25f); } Hammer.localEulerAngles = new Vector3(m_hammerXRot, 0f, 0f); } if (!m_isLatched && Vector3.Angle(Vector3.up, ((Component)Chamber).transform.forward) < 70f && Chamber.IsFull && Chamber.IsSpent) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); Chamber.EjectRound(((Component)Chamber).transform.position + ((Component)Chamber).transform.forward * -0.06f, ((Component)Chamber).transform.forward * -0.01f, Vector3.right, false); } } private void ToggleLatchState() { if (m_isLatched) { Unlatch(); } else if (!m_isLatched) { Latch(); } } public override void UpdateInteraction(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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_002b: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); float num = 0f; Axis hingeAxis = HingeAxis; if ((int)hingeAxis != 0) { if ((int)hingeAxis != 1) { if ((int)hingeAxis == 2) { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).z; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).y; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).x; } if (num > 15f && CanUnlatch) { Unlatch(); } else if (num < -15f && CanUnlatch) { Latch(); } bool flag = false; bool flag2 = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && CanUnlatch) { flag2 = true; } if (hand.Input.AXButtonDown) { flag = true; } } else if (hand.Input.TouchpadDown) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) < 45f && CanCockHammer) { CockHammer(); } else if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && (Vector2.Angle(touchpadAxes, Vector2.left) < 45f || Vector2.Angle(touchpadAxes, Vector2.right) < 45f) && CanUnlatch) { ToggleLatchState(); } } } if (flag) { CockHammer(); } if (flag2) { ToggleLatchState(); } if (m_isDestroyed) { return; } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld) { TriggerFloat = hand.Input.TriggerFloat; } else { TriggerFloat = 0f; } float num2 = Mathf.Lerp(TriggerForwardBackRots.x, TriggerForwardBackRots.y, TriggerFloat); Trigger.localEulerAngles = new Vector3(num2, 0f, 0f); if (TriggerFloat > 0.7f) { if (m_isTriggerReset && m_isHammerCocked) { m_isTriggerReset = false; m_isHammerCocked = false; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMinRot, HammerInterp, HammerAxis); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); Fire(); } } else if (TriggerFloat < 0.2f && !m_isTriggerReset) { m_isTriggerReset = true; } } public void Fire() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (m_isLatched && Chamber.Fire()) { ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); if (Chamber.GetRound().IsHighPressure && !IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); Destroy(); } else if (IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); } ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { Chamber.IsSpent = false; Chamber.UpdateProxyDisplay(); } else if (Chamber.GetRound().IsCaseless) { Chamber.SetRound((FVRFireArmRound)null, false); } if (DeletesCartridgeOnFire) { Chamber.SetRound((FVRFireArmRound)null, false); } } } public void Unlatch() { if (m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); m_isLatched = false; Chamber.IsAccessible = true; if (CocksOnOpen) { CockHammer(); } } } public void Latch() { if (!m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); m_isLatched = true; Chamber.IsAccessible = false; } } public void CockHammer() { //IL_0037: 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) if (!m_isHammerCocked) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); m_isHammerCocked = true; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMaxRot, HammerInterp, HammerAxis); } } } private void Destroy() { if (!m_isDestroyed) { m_isDestroyed = true; DestroyPSystem.Emit(25); for (int i = 0; i < GunUndamaged.Length; i++) { GunUndamaged[i].enabled = false; GunDamaged[i].enabled = true; } } } public override List<FireArmRoundClass> GetChamberRoundList() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (Chamber.IsFull && !Chamber.IsSpent) { return new List<FireArmRoundClass> { Chamber.GetRound().RoundClass }; } return null; } public override void SetLoadedChambers(List<FireArmRoundClass> rounds) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } } } public class FieldGun : FVRFireArm { public FieldGunRotatingLever _xRotation; private float _xlerp = 2f; public FieldGunRotatingLever _yRotation; private float _ylerp = 2f; public float maxXrotDeviance; public float maxYrotDeviance; [Header("Flaregun Params")] public Renderer[] GunUndamaged; public Renderer[] GunDamaged; public FVRFireArmChamber Chamber; public Axis HingeAxis; public Transform Hinge; public float RotOut = 35f; public bool CanUnlatch = true; public bool IsHighPressureTolerant; private bool m_isHammerCocked; private bool m_isTriggerReset = true; private bool m_isLatched = true; private bool m_isDestroyed; private float TriggerFloat; public Transform Hammer; public bool HasVisibleHammer = true; public bool CanCockHammer = true; public bool CocksOnOpen; private float m_hammerXRot; public Axis HammerAxis; public InterpStyle HammerInterp = (InterpStyle)1; public float HammerMinRot; public float HammerMaxRot = -70f; public Transform Trigger; public Vector2 TriggerForwardBackRots; public Transform Muzzle; public ParticleSystem SmokePSystem; public ParticleSystem DestroyPSystem; public bool DeletesCartridgeOnFire; public override void Awake() { ((FVRFireArm)this).Awake(); if (CanUnlatch) { Chamber.IsAccessible = false; } else { Chamber.IsAccessible = true; } } public override void FVRUpdate() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (HasVisibleHammer) { if (m_isHammerCocked) { m_hammerXRot = Mathf.Lerp(m_hammerXRot, HammerMaxRot, Time.deltaTime * 12f); } else { m_hammerXRot = Mathf.Lerp(m_hammerXRot, 0f, Time.deltaTime * 25f); } Hammer.localEulerAngles = new Vector3(m_hammerXRot, 0f, 0f); } if (!m_isLatched && Vector3.Angle(Vector3.up, ((Component)Chamber).transform.forward) < 70f && Chamber.IsFull && Chamber.IsSpent) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); Chamber.EjectRound(((Component)Chamber).transform.position + ((Component)Chamber).transform.forward * -0.06f, ((Component)Chamber).transform.forward * -0.01f, Vector3.right, false); } if (_xRotation.lerp != _xlerp) { _xlerp = _xRotation.lerp; SetRotationOfAxis(0, maxXrotDeviance, _xlerp); } if (_yRotation.lerp != _ylerp) { _ylerp = _yRotation.lerp; SetRotationOfAxis(0, maxYrotDeviance, _ylerp); } } private void SetRotationOfAxis(int axis, float maxRotDeviance, float lerpAmt) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) bool num = lerpAmt < 0f; float num2 = Mathf.Lerp(0f, maxRotDeviance, lerpAmt); if (num) { num2 *= -1f; } Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; ((Vector3)(ref localEulerAngles))[axis] = num2; ((Component)this).transform.localEulerAngles = localEulerAngles; } private void ToggleLatchState() { if (m_isLatched) { Unlatch(); } else if (!m_isLatched) { Latch(); } } public override void UpdateInteraction(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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_002b: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); float num = 0f; Axis hingeAxis = HingeAxis; if ((int)hingeAxis != 0) { if ((int)hingeAxis != 1) { if ((int)hingeAxis == 2) { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).z; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).y; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).x; } if (num > 15f && CanUnlatch) { Unlatch(); } else if (num < -15f && CanUnlatch) { Latch(); } bool flag = false; bool flag2 = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && CanUnlatch) { flag2 = true; } if (hand.Input.AXButtonDown) { flag = true; } } else if (hand.Input.TouchpadDown) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) < 45f && CanCockHammer) { CockHammer(); } else if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && (Vector2.Angle(touchpadAxes, Vector2.left) < 45f || Vector2.Angle(touchpadAxes, Vector2.right) < 45f) && CanUnlatch) { ToggleLatchState(); } } } if (flag) { CockHammer(); } if (flag2) { ToggleLatchState(); } if (m_isDestroyed) { return; } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld) { TriggerFloat = hand.Input.TriggerFloat; } else { TriggerFloat = 0f; } float num2 = Mathf.Lerp(TriggerForwardBackRots.x, TriggerForwardBackRots.y, TriggerFloat); Trigger.localEulerAngles = new Vector3(num2, 0f, 0f); if (TriggerFloat > 0.7f) { if (m_isTriggerReset && m_isHammerCocked) { m_isTriggerReset = false; m_isHammerCocked = false; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMinRot, HammerInterp, HammerAxis); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); Fire(); } } else if (TriggerFloat < 0.2f && !m_isTriggerReset) { m_isTriggerReset = true; } } public void Fire() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (m_isLatched && Chamber.Fire()) { ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); if (Chamber.GetRound().IsHighPressure && !IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); Destroy(); } else if (IsHighPressureTolerant) { ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); } ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { Chamber.IsSpent = false; Chamber.UpdateProxyDisplay(); } else if (Chamber.GetRound().IsCaseless) { Chamber.SetRound((FVRFireArmRound)null, false); } if (DeletesCartridgeOnFire) { Chamber.SetRound((FVRFireArmRound)null, false); } } } public void Unlatch() { if (m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); m_isLatched = false; Chamber.IsAccessible = true; if (CocksOnOpen) { CockHammer(); } } } public void Latch() { if (!m_isLatched) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); m_isLatched = true; Chamber.IsAccessible = false; } } public void CockHammer() { //IL_0037: 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) if (!m_isHammerCocked) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); m_isHammerCocked = true; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMaxRot, HammerInterp, HammerAxis); } } } private void Destroy() { if (!m_isDestroyed) { m_isDestroyed = true; DestroyPSystem.Emit(25); for (int i = 0; i < GunUndamaged.Length; i++) { GunUndamaged[i].enabled = false; GunDamaged[i].enabled = true; } } } public override List<FireArmRoundClass> GetChamberRoundList() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (Chamber.IsFull && !Chamber.IsSpent) { return new List<FireArmRoundClass> { Chamber.GetRound().RoundClass }; } return null; } public override void SetLoadedChambers(List<FireArmRoundClass> rounds) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } } } internal class ActivateSeveralFVRInteractiveAtOnce : FVRInteractiveObject { public List<FVRInteractiveObject> InteractiveObjects; public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.BeginInteraction(hand); } } public override void EndInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).EndInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.EndInteraction(hand); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.SimpleInteraction(hand); } } public override void UpdateInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).UpdateInteraction(hand); foreach (FVRInteractiveObject interactiveObject in InteractiveObjects) { interactiveObject.UpdateInteraction(hand); } } } internal class AttachmentModifyFirearm : MonoBehaviour { public enum actionType { attach, detach } public enum CapType { AddTo, SetTo } private FVRFireArmAttachment attachment; private FVRFireArm weapon; [Header("Recoil Modifier")] public bool ChangesRecoil; private FVRFireArmRecoilProfile originalRecoil; public FVRFireArmRecoilProfile modifiedRecoil; [Header("Magazine Modifer")] public bool ChangesMagCapacity; private int prevCapacity; public CapType CapacityModifierType; [Tooltip("Keep it off unless you're sure it should apply to non-internal mags.")] public bool applyToNonInternalMags; public int setCapacityTo; [Header("Bolt Speed Modifier")] public bool ChangesBoltSpeed; public bool ChangesBoltSpeedForward; public bool ChangesBoltSpeedRearward; public bool ChangesBoltSpeedStiffness; public CapType BoltSpeedModifierType; public float BoltSpeedForward; private float prevBoltSpeedForward; public float BoltSpeedBackwards; private float prevBoltSpeedBackwards; public float BoltSpringStiffness; private float prevBoltSpringStiffness; [HideInInspector] public bool ChangesSpread; [HideInInspector] public float spreadmult; [Header("GrabPos Modifier")] public bool ChangesGrabPos; public Transform NewPoseOverride; private Vector3 oldPoseOverridePos; private Quaternion oldPoseOverrideRot; public Transform NewPoseOverrideTouch; private Vector3 oldPoseOverrideTouchPos; private Quaternion oldPoseOverrideTouchRot; public void Start() { attachment = ((Component)this).GetComponent<FVRFireArmAttachment>(); } private void FixedUpdate() { if ((Object)(object)attachment.curMount != (Object)null) { if ((Object)(object)weapon == (Object)null) { OnAttach(); } } else if ((Object)(object)weapon != (Object)null) { OnDetach(); } if (ChangesSpread) { ChangeSpread(); } } private void Update() { } public void OnAttach() { weapon = ((Component)attachment.curMount.Parent).GetComponent<FVRFireArm>(); if (ChangesRecoil) { RecoilModifier(actionType.attach); } if (ChangesMagCapacity) { MagSizeModifier(actionType.attach); } if (ChangesBoltSpeed) { BoltSpeedModifier(actionType.attach); } if (ChangesGrabPos) { ChangeGrabPos(actionType.attach); } } public void OnDetach() { if (ChangesRecoil) { RecoilModifier(actionType.detach); } if (ChangesMagCapacity) { MagSizeModifier(actionType.detach); } if (ChangesBoltSpeed) { BoltSpeedModifier(actionType.detach); } if (ChangesGrabPos) { ChangeGrabPos(actionType.detach); } weapon = null; } public void ChangeGrabPos(actionType ActType) { //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_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (ActType == actionType.attach) { oldPoseOverridePos = ((FVRInteractiveObject)weapon).PoseOverride.localPosition; oldPoseOverrideRot = ((FVRInteractiveObject)weapon).PoseOverride.localRotation; ((FVRInteractiveObject)weapon).PoseOverride.position = NewPoseOverride.position; ((FVRInteractiveObject)weapon).PoseOverride.rotation = NewPoseOverride.rotation; oldPoseOverrideTouchPos = ((FVRInteractiveObject)weapon).PoseOverride_Touch.localPosition; oldPoseOverrideTouchRot = ((FVRInteractiveObject)weapon).PoseOverride_Touch.localRotation; ((FVRInteractiveObject)weapon).PoseOverride_Touch.position = NewPoseOverrideTouch.position; ((FVRInteractiveObject)weapon).PoseOverride_Touch.rotation = NewPoseOverrideTouch.rotation; } if (ActType == actionType.detach) { ((FVRInteractiveObject)weapon).PoseOverride.localPosition = oldPoseOverridePos; ((FVRInteractiveObject)weapon).PoseOverride.localRotation = oldPoseOverrideRot; ((FVRInteractiveObject)weapon).PoseOverride_Touch.localPosition = oldPoseOverrideTouchPos; ((FVRInteractiveObject)weapon).PoseOverride_Touch.localRotation = oldPoseOverrideTouchRot; } } public void ChangeSpread() { FVRFireArmRound val = null; if (weapon is OpenBoltReceiver) { FVRFireArm obj = weapon; val = ((OpenBoltReceiver)((obj is OpenBoltReceiver) ? obj : null)).Chamber.GetRound(); } else if (weapon is ClosedBoltWeapon) { FVRFireArm obj2 = weapon; val = ((ClosedBoltWeapon)((obj2 is ClosedBoltWeapon) ? obj2 : null)).Chamber.GetRound(); } else if (weapon is Handgun) { FVRFireArm obj3 = weapon; val = ((Handgun)((obj3 is Handgun) ? obj3 : null)).Chamber.GetRound(); } else if (weapon is TubeFedShotgun) { FVRFireArm obj4 = weapon; val = ((TubeFedShotgun)((obj4 is TubeFedShotgun) ? obj4 : null)).Chamber.GetRound(); } if (!((Object)(object)val == (Object)null) && (double)((FVRPhysicalObject)val).ThrowAngMultiplier != 1.1) { ((FVRPhysicalObject)val).ThrowAngMultiplier = 1.1f; FVRFireArmRound obj5 = val; obj5.ProjectileSpread *= spreadmult; } } public void RecoilModifier(actionType ActType) { if (ActType == actionType.attach) { originalRecoil = weapon.RecoilProfile; weapon.RecoilProfile = modifiedRecoil; } if (ActType == actionType.detach) { weapon.RecoilProfile = originalRecoil; } } public void MagSizeModifier(actionType ActType) { if ((Object)(object)weapon.Magazine == (Object)null) { return; } if (ActType == actionType.attach && (weapon.Magazine.IsIntegrated || applyToNonInternalMags)) { prevCapacity = weapon.Magazine.m_capacity; if (CapacityModifierType == CapType.AddTo) { FVRFireArmMagazine magazine = weapon.Magazine; magazine.m_capacity += setCapacityTo; } if (CapacityModifierType == CapType.SetTo) { weapon.Magazine.m_capacity = setCapacityTo; } Array.Resize(ref weapon.Magazine.LoadedRounds, weapon.Magazine.m_capacity); } if (ActType == actionType.detach && (weapon.Magazine.IsIntegrated || applyToNonInternalMags)) { weapon.Magazine.m_capacity = prevCapacity; } } public void BoltSpeedModifier(actionType ActType) { int num = 0; OpenBoltReceiver val = null; ClosedBoltWeapon val2 = null; Handgun val3 = null; if (weapon is OpenBoltReceiver) { FVRFireArm obj = weapon; val = (OpenBoltReceiver)(object)((obj is OpenBoltReceiver) ? obj : null); num = 1; } else if (weapon is ClosedBoltWeapon) { FVRFireArm obj2 = weapon; val2 = (ClosedBoltWeapon)(object)((obj2 is ClosedBoltWeapon) ? obj2 : null); num = 2; } else if (weapon is Handgun) { FVRFireArm obj3 = weapon; val3 = (Handgun)(object)((obj3 is Handgun) ? obj3 : null); num = 3; } else if (weapon is TubeFedShotgun) { _ = weapon; num = 4; } float num2 = 0f; float num3 = 0f; float num4 = 0f; switch (num) { case 1: num2 = val.Bolt.BoltSpeed_Rearward; num3 = val.Bolt.BoltSpeed_Forward; num4 = val.Bolt.BoltSpringStiffness; break; case 2: num2 = val2.Bolt.Speed_Rearward; num3 = val2.Bolt.Speed_Forward; num4 = val2.Bolt.SpringStiffness; break; case 3: num2 = val3.Slide.Speed_Forward; num3 = val3.Slide.Speed_Rearward; num4 = val3.Slide.SpringStiffness; break; } if (ActType == actionType.attach) { prevBoltSpeedBackwards = num2; prevBoltSpeedForward = num3; prevBoltSpringStiffness = num4; if (BoltSpeedModifierType == CapType.SetTo) { num2 = BoltSpeedBackwards; num3 = BoltSpeedForward; num4 = BoltSpringStiffness; } if (BoltSpeedModifierType == CapType.AddTo) { num2 += BoltSpeedBackwards; num3 += BoltSpeedForward; num4 += BoltSpringStiffness; } } if (ActType == actionType.detach) { num2 = prevBoltSpeedBackwards; num3 = prevBoltSpeedForward; num4 = prevBoltSpringStiffness; } if (ChangesBoltSpeedRearward) { switch (num) { case 1: val.Bolt.BoltSpeed_Rearward = num2; break; case 2: val2.Bolt.Speed_Rearward = num2; break; case 3: val3.Slide.Speed_Forward = num2; break; } } if (ChangesBoltSpeedForward) { switch (num) { case 1: val.Bolt.BoltSpeed_Forward = num3; break; case 2: val2.Bolt.Speed_Forward = num3; break; case 3: val3.Slide.Speed_Rearward = num3; break; } } if (ChangesBoltSpeedStiffness) { switch (num) { case 1: val.Bolt.BoltSpringStiffness = num4; break; case 2: val2.Bolt.SpringStiffness = num4; break; case 3: val3.Slide.SpringStiffness = num4; break; } } } } internal class DisplayOnAttached : MonoBehaviour { public GameObject displayOnAttach; public FVRFireArmAttachmentMount AttachmentMount; public void FixedUpdate() { if (AttachmentMount.HasAttachmentsOnIt()) { displayOnAttach.SetActive(true); } else { displayOnAttach.SetActive(false); } } } internal class BetterMagReleaseLatch : MonoBehaviour { [FormerlySerializedAs("FireArm")] public FVRFireArm fireArm; [FormerlySerializedAs("Joint")] public HingeJoint joint; private float _timeSinceLastCollision = 6f; [Tooltip("Greatly reduce what you think it may be. I recommend 2 for Sensitivity.")] public float jointReleaseSensitivity = 2f; [HideInInspector] public float jointAngle; [FormerlySerializedAs("_jointReleaseSensitivityAbove")] [HideInInspector] public float jointReleaseSensitivityAbove; [FormerlySerializedAs("_jointReleaseSensitivityBelow")] [HideInInspector] public float jointReleaseSensitivityBelow; private bool _isMagazineNotNull; [HideInInspector] public float basex; private void Start() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) _isMagazineNotNull = (Object)(object)fireArm.Magazine != (Object)null; basex = ((Component)this).transform.rotation.x; jointReleaseSensitivityAbove = basex + jointReleaseSensitivity; jointReleaseSensitivityBelow = basex - jointReleaseSensitivity; } private void FixedUpdate() { //IL_006a: 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_0045: Unknown result type (might be due to invalid IL or missing references) if (_timeSinceLastCollision < 5f) { _timeSinceLastCollision += Time.deltaTime; } if (_isMagazineNotNull && (((Component)this).transform.rotation.x >= jointReleaseSensitivityAbove || ((Component)this).transform.rotation.x <= jointReleaseSensitivityBelow)) { fireArm.EjectMag(false); } jointAngle = ((Component)this).transform.rotation.x; } private void OnCollisionEnter(Collision col) { if ((Object)(object)col.collider.attachedRigidbody != (Object)null && (Object)(object)col.collider.attachedRigidbody != (Object)(object)((FVRPhysicalObject)fireArm).RootRigidbody && (Object)(object)((Component)col.collider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>() != (Object)null && ((FVRInteractiveObject)((Component)col.collider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>()).IsHeld) { _timeSinceLastCollision = 0f; } } } internal class OpenBoltBurstFire : MonoBehaviour { public OpenBoltReceiver Receiver; [Tooltip("Selector setting position that will be burst. Remember, selectors go pos: 0, 1 ,2, not 1, 2, 3")] public int SelectorSetting; [Tooltip("Amount of shots per burst.")] public int BurstAmt = 3; private int BurstSoFar; private bool wasLoaded; public void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2; } public void Update() { if ((Object)(object)((FVRInteractiveObject)Receiver).m_hand == (Object)null) { return; } if (Receiver.m_fireSelectorMode != SelectorSetting) { BurstSoFar = 0; return; } if (wasLoaded && !Receiver.Chamber.IsFull) { BurstSoFar++; } wasLoaded = Receiver.Chamber.IsFull; if (BurstSoFar >= BurstAmt) { lockUp(); if (((FVRInteractiveObject)Receiver).m_hand.Input.TriggerFloat < Receiver.TriggerFiringThreshold) { unLock(); } } if (((FVRInteractiveObject)Receiver).m_hand.Input.TriggerFloat < Receiver.TriggerFiringThreshold) { BurstSoFar = 0; } } public void lockUp() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)0; } public void unLock() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) BurstSoFar = 0; Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2; } } internal class InvisibleMagOnLoad : MonoBehaviour { public FVRFireArmMagazine magazine; public void Update() { if ((Object)(object)magazine.FireArm != (Object)null) { ((Component)magazine.Viz).gameObject.SetActive(false); } else { ((Component)magazine.Viz).gameObject.SetActive(true); } } } public class SimpleControls_ClosedBolt : MonoBehaviour { [HideInInspector] public ClosedBoltWeapon cbw; public void Start() { cbw = ((Component)this).GetComponent<ClosedBoltWeapon>(); if ((Object)(object)cbw == (Object)null) { Debug.Log((object)"SimpleControls_ClosedBolt_BoltRelease can't find the closed bolt weapon!"); Object.Destroy((Object)(object)this); } } } public class SimpleControls_ClosedBolt_BoltRelease : SimpleControls_ClosedBolt { public void FixedUpdate() { cbw.HasBoltReleaseButton = UtilsBepInExLoader.SimpleControls.Value; } } public class SimpleControls_ClosedBolt_SelectorSwitch : SimpleControls_ClosedBolt { public void FixedUpdate() { cbw.HasFireSelectorButton = UtilsBepInExLoader.SimpleControls.Value; } } internal class lockToHead : MonoBehaviour { public Vector3 posOffset; public void Update() { //IL_0015: 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_0031: 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) ((Component)this).transform.position = ((Component)GM.CurrentPlayerBody.Head).transform.position; Transform transform = ((Component)this).transform; transform.localPosition += posOffset; ((Component)this).transform.rotation = ((Component)GM.CurrentPlayerBody.Head).transform.rotation; } } internal class compressingSpring : MonoBehaviour { public enum dirType { x, y, z } public GameObject compressor; public GameObject spring; public dirType directionOfCompression = dirType.z; public dirType directionOfCompressor = dirType.z; [Tooltip("The directionOfCompression position where the scale will be 1.")] public float fullextend; [Tooltip("The directionOfCompression position where the scale will be 0.")] public float fullcompress; private void Update() { //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_001a: 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_002c: 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_008f: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = spring.transform.localScale; float[] array = new float[3] { localScale.x, localScale.y, localScale.z }; dirType num = directionOfCompression; Vector3 localPosition = compressor.transform.localPosition; array[(int)num] = (((Vector3)(ref localPosition))[(int)directionOfCompressor] - fullcompress) * (1f / (fullextend - fullcompress)); ((Vector3)(ref localScale))..ctor(array[0], array[1], array[2]); spring.transform.localScale = localScale; } } public class cullOnZLoc : MonoBehaviour { public enum cutOffType { above, below } public enum dirType { x, y, z } public cutOffType cutoff; public double loc; public GameObject objTarget; public dirType dir; private MeshRenderer objMeshRenderer; private void Start() { objMeshRenderer = ((Component)this).gameObject.GetComponent<MeshRenderer>(); } private void Update() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 localPosition; switch (cutoff) { case cutOffType.below: { MeshRenderer obj2 = objMeshRenderer; localPosition = objTarget.transform.localPosition; ((Renderer)obj2).enabled = (double)((Vector3)(ref localPosition))[(int)dir] > loc; break; } case cutOffType.above: { MeshRenderer obj = objMeshRenderer; localPosition = objTarget.transform.localPosition; ((Renderer)obj).enabled = (double)((Vector3)(ref localPosition))[(int)dir] < loc; break; } } } } public class followDir : MonoBehaviour { public GameObject leader; public GameObject follower; public cullOnZLoc.dirType FollowDirection; public Vector3 followerpos; public Vector3 leaderpos; public Vector3 resultpos; private void Update() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) follower.transform.position = leader.transform.position; } } public class MagFollower : MonoBehaviour { [Header("Only fill out one of the ones below.")] public FVRFireArmMagazine magazine; public FVRFireArmClip clip; public GameObject follower; [Header("Translation Mag Follower")] public bool UsesOneRoundPos; [Tooltip("The round count where the follower starts moving (e.g 20)")] public int StartAtRoundCount; [Tooltip("The round count where the follower stops moving (e.g 0)")] public int StopAtRoundCount; [Tooltip("The position where the follower should be when the magazine is full.")] public GameObject StartPos; [Tooltip("The position where the follower should be when the magazine has one round left.")] public GameObject OneRoundPos; [Tooltip("The position where the follower should be when the magazine is empty.")] public GameObject StopPos; [Header("Individual Point Mag Follower")] public bool UsesIndivdualPointMagFollower; [Tooltip("Top-to-bottom order, where the 0th position is when the magazine is empty. ")] public List<GameObject> Positions; [Header("Individual Mesh Replacement")] public bool UsesIndividualMeshReplacement; [Tooltip("Top-to-bottom order, where the 0th position is when the magazine is empty. ")] public List<Mesh> Meshes; private int magrounds; private MeshFilter followerFilter; public bool isClip; public void Update() { int num = 0; num = ((!isClip) ? magazine.m_numRounds : clip.m_numRounds); if (num != magrounds) { magrounds = num; UpdateDisp(); } } public void Start() { if ((Object)(object)clip != (Object)null) { if ((Object)(object)magazine != (Object)null) { Debug.LogError((object)"H3VR Utilities Follower has both a clip and mag inserted! What?"); } isClip = true; } followerFilter = follower.GetComponent<MeshFilter>(); if (StopAtRoundCount > StartAtRoundCount) { int stopAtRoundCount = StopAtRoundCount; StopAtRoundCount = StartAtRoundCount; StartAtRoundCount = stopAtRoundCount; } } public void UpdateDisp() { //IL_0168: 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_0188: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (UsesIndivdualPointMagFollower) { if (Positions.Count >= magazine.m_numRounds && !((Object)(object)Positions[magazine.m_numRounds] == (Object)null)) { follower.transform.position = Positions[magazine.m_numRounds].transform.position; follower.transform.rotation = Positions[magazine.m_numRounds].transform.rotation; } return; } if (UsesIndividualMeshReplacement) { if (Meshes.Count >= magazine.m_numRounds && !((Object)(object)Meshes[magazine.m_numRounds] == (Object)null)) { followerFilter.mesh = Meshes[magazine.m_numRounds]; followerFilter.mesh = Meshes[magazine.m_numRounds]; } return; } Transform transform = StopPos.transform; int num = StopAtRoundCount; if (UsesOneRoundPos) { transform = OneRoundPos.transform; num++; } follower.transform.position = Vector3.Lerp(StartPos.transform.position, transform.position, Mathf.InverseLerp((float)StartAtRoundCount, (float)num, (float)magrounds)); if (magrounds == 0) { follower.transform.position = StopPos.transform.position; } } } } namespace H3VRUtils.UniqueCode { internal class AssignMagIfNull : MonoBehaviour { public FVRFireArm firearm; public FVRFireArmMagazine magazine; public void FixedUpdate() { if ((Object)(object)firearm.Magazine == (Object)null) { firearm.Magazine = magazine; } } } public class BOMO : MonoBehaviour { [Tooltip("If there are no objects in the BOMO, it will act like a regular harnessed object (grab, move it about, let go and it returns to the slot.) If enabled, it will simply force you to let it go, and not let you unharness the object.")] public bool isStatic; [Tooltip("For usage as a static object. Puts itself into quickbelt and harnesses.")] public FVRQuickBeltSlot qbSlotForStatic; [Tooltip("Physical object the BOMO is connected to.")] public FVRPhysicalObject physobj; [Tooltip("List of all the items in the BOMO.")] public List<GameObject> itemsInTheBag; [Tooltip("Text that displays the amount of items in the bag. Not necessary.")] public Text itemsInTheBagText; [Tooltip("Maximum amount of items that can be stored in the BOMO.")] public int maxItems = 5; [Tooltip("If true, will just nuke any item put into it.")] public bool thevoid; public AudioEvent dropInToSound; public AudioEvent takeOutOfSound; private bool _isitemsInTheBagTextNotNull; private int deniedObjectTime; public List<GameObject> notPhysObjects = new List<GameObject>(); private void Start() { _isitemsInTheBagTextNotNull = (Object)(object)itemsInTheBagText != (Object)null; if (isStatic) { HarnessBOMO(); } } public void HarnessBOMO() { physobj.SetQuickBeltSlot(qbSlotForStatic); physobj.Harnessable = false; physobj.m_isHardnessed = true; } private void OnTriggerStay(Collider other) { //IL_0180: Unknown result type (might be due to invalid IL or missing references) deniedObjectTime++; if (((Component)other).gameObject.layer != ((Component)this).gameObject.layer || deniedObjectTime < 3 || notPhysObjects.Contains(((Component)other).gameObject)) { return; } FVRPhysicalObject component = ((Component)other).gameObject.GetComponent<FVRPhysicalObject>(); if ((Object)(object)component == (Object)null) { notPhysObjects.Add(((Component)other).gameObject); return; } deniedObjectTime = 0; bool flag = true; if ((Object)(object)((FVRInteractiveObject)component).m_hand == (Object)null) { if (component is FVRFireArmMagazine) { if ((Object)(object)((FVRFireArmMagazine)((component is FVRFireArmMagazine) ? component : null)).FireArm == (Object)null) { flag = false; } } else if (component is Speedloader) { flag = false; } else if (component is FVRFireArmClip && (Object)(object)((FVRFireArmClip)((component is FVRFireArmClip) ? component : null)).FireArm == (Object)null) { flag = false; } } if (component.m_isSpawnLock || flag || itemsInTheBag.Count >= maxItems) { return; } if (thevoid) { if ((Object)(object)((FVRInteractiveObject)component).m_hand != (Object)null) { ((FVRInteractiveObject)component).m_hand.ForceSetInteractable((FVRInteractiveObject)null); } Object.Destroy((Object)(object)((Component)other).gameObject); } else { itemsInTheBag.Add(((Component)other).gameObject); if ((Object)(object)((FVRInteractiveObject)component).m_hand != (Object)null) { ((FVRInteractiveObject)component).m_hand.ForceSetInteractable((FVRInteractiveObject)null); } ((Component)other).gameObject.SetActive(false); } SetText(); if (dropInToSound.Clips.Count != 0) { SM.PlayGenericSound(dropInToSound, ((Component)this).transform.position); } } private void SetText() { if (_isitemsInTheBagTextNotNull) { itemsInTheBagText.text = itemsInTheBag.Count.ToString(); } } private void Update() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if (physobj.m_isHardnessed) { if (!((Object)(object)((FVRInteractiveObject)physobj).m_hand != (Object)null)) { return; } if (itemsInTheBag.Count != 0) { int index = Random.Range(0, itemsInTheBag.Count); FVRInteractiveObject component = itemsInTheBag[index].GetComponent<FVRInteractiveObject>(); ((Component)component).gameObject.SetActive(true); ((Component)component).transform.position = ((Component)((FVRInteractiveObject)physobj).m_hand).transform.position; ((FVRInteractiveObject)physobj).m_hand.ForceSetInteractable(component); itemsInTheBag.Remove(itemsInTheBag[index]); SetText(); deniedObjectTime = 0; if (takeOutOfSound.Clips.Count != 0) { SM.PlayGenericSound(takeOutOfSound, ((Component)this).transform.position); } } else if (isStatic) { ((FVRInteractiveObject)physobj).m_hand.ForceSetInteractable((FVRInteractiveObject)null); } } else if (isStatic) { HarnessBOMO(); } } private void FixedUpdate() { deniedObjectTime++; } } public class DumpInternalMag : MonoBehaviour { public Handgun handgun; public H3VRUtilsMagRelease.TouchpadDirType presstoejectbutton; public void FixedUpdate() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 if (!((FVRInteractiveObject)handgun).IsHeld) { return; } FVRViveHand hand = ((FVRInteractiveObject)handgun).m_hand; Vector2 val = H3VRUtilsMagRelease.TouchpadDirTypeToVector2(presstoejectbutton); if (Vector2.Angle(hand.Input.TouchpadAxes, val) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && ((int)handgun.Slide.CurPos == 3 || (int)handgun.Slide.CurPos == 4)) { if (handgun.Chamber.IsFull) { handgun.EjectExtractedRound(); } else if (handgun.m_proxy.IsFull) { handgun.ChamberRound(); } else if (((FVRFireArm)handgun).Magazine.HasARound()) { GameObject fromPrefabReference = ((FVRFireArm)handgun).Magazine.RemoveRound(false); ((FVRFireArm)handgun).PlayAudioEvent((FirearmAudioEventType)29, 1f); handgun.m_proxy.SetFromPrefabReference(fromPrefabReference); } } } } internal class LebelCutoff : FVRInteractiveObject { public FVRFireArmMagazine TubeMagazine; public FVRFireArm Firearm; public Transform CutoffSwitchFalse; public Transform CutoffSwitchTrue; public GameObject CutoffSwitch; public Transform CutoffFlagFalse; public Transform CutoffFlagTrue; public GameObject CutoffFlag; public bool isCutoff; public override void SimpleInteraction(FVRViveHand hand) { //IL_00b3: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0070: 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) Firearm.PlayAudioEvent((FirearmAudioEventType)14, 1f); isCutoff = !isCutoff; if (isCutoff) { CutoffSwitch.transform.position = CutoffSwitchTrue.position; CutoffSwitch.transform.rotation = CutoffSwitchTrue.rotation; CutoffFlag.transform.position = CutoffFlagTrue.position; CutoffFlag.transform.rotation = CutoffFlagTrue.rotation; Firearm.Magazine = null; } else { CutoffSwitch.transform.position = CutoffSwitchFalse.position; CutoffSwitch.transform.rotation = CutoffSwitchFalse.rotation; CutoffFlag.transform.position = CutoffFlagFalse.position; CutoffFlag.transform.rotation = CutoffFlagFalse.rotation; Firearm.Magazine = TubeMagazine; } } } internal class OpenBoltLockOnSafe : MonoBehaviour { public Collider Bolt; public GameObject SafetySwitch; public cullOnZLoc.dirType SafetyRotDir; public float AngleWhenSafe; public void FixedUpdate() { //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) Vector3 localEulerAngles = SafetySwitch.transform.localEulerAngles; if (((Vector3)(ref localEulerAngles))[(int)SafetyRotDir] == AngleWhenSafe) { Bolt.enabled = false; } else { Bolt.enabled = true; } } } internal class RevolverChargingHandle : FVRInteractiveObject { public SingleActionRevolver wep; public Transform frontMostPoint; public Transform rearMostPoint; public float forwardspeed; private bool pulled; public override void UpdateInteraction(FVRViveHand hand) { //IL_000e: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(frontMostPoint.position, rearMostPoint.position, ((HandInput)(ref base.m_hand.Input)).Pos); ((Component)this).transform.position = closestValidPoint; _ = ((Component)this).transform.localPosition; Mathf.InverseLerp(frontMostPoint.localPosition.z, rearMostPoint.localPosition.z, ((Component)this).transform.localPosition.z); } public override void FVRUpdate() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_012c: 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_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) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00ff: Expected O, but got Unknown ((FVRInteractiveObject)this).FVRUpdate(); if (!((FVRInteractiveObject)this).IsHeld && Mathf.Abs(((Component)this).transform.localPosition.z - frontMostPoint.localPosition.z) > 0.001f) { ((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, Mathf.MoveTowards(((Component)this).transform.localPosition.z, frontMostPoint.localPosition.z, Time.deltaTime * forwardspeed)); } else if (Mathf.Abs(((Component)this).transform.localPosition.z - rearMostPoint.localPosition.z) < 0.01f) { try { ((FVRFireArm)wep).PlayAudioEvent((FirearmAudioEventType)10, 1f); } catch { Console.WriteLine("Forgot to assign FireArmAudioEventType.HandleBack!"); } if (!pulled) { FVRViveHand val = new FVRViveHand(); val.IsInStreamlinedMode = true; val.Input.AXButtonDown = true; ((FVRInteractiveObject)wep).UpdateInteraction(val); pulled = true; } } else if (Mathf.Abs(((Component)this).transform.localPosition.z - frontMostPoint.localPosition.z) < 0.01f) { try { ((FVRFireArm)wep).PlayAudioEvent((FirearmAudioEventType)11, 1f); } catch { Console.WriteLine("Forgot to assign FireArmAudioEventType.HandleForward!"); } pulled = false; } } } internal class SelbstladerUnlockSystem : FVRInteractiveObject { public enum ChangePositionType { Swap, Unlock, Lock } public enum locktype { MagLocking, BoltLocking } public GameObject lockingpiece; public Transform lockingpieceunlocked; public Transform lockingpiecelocked; public ClosedBoltWeapon wep; public H3VRUtilsMagRelease magrelease; public FVRFireArmReloadTriggerWell magreloadtrigger; private float velocity; private bool unlocked; private Collider col; private Collider mrtcol; public locktype locker; public override void Awake() { ((FVRInteractiveObject)this).Awake(); base.IsSimpleInteract = true; col = ((Component)wep.Bolt).GetComponent<Collider>(); ChangePosition(ChangePositionType.Lock); velocity = wep.Chamber.ChamberVelocityMultiplier; if (locker == locktype.MagLocking) { mrtcol = ((Component)magreloadtrigger).GetComponent<Collider>(); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); ChangePosition(ChangePositionType.Swap); try { ((FVRFireArm)wep).PlayAudioEvent((FirearmAudioEventType)17, 1f); } catch { Console.WriteLine("SelbstladerUnlockSystem.cs failed to play the BreachOpen sound!"); } } public override void FVRUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 ((FVRInteractiveObject)this).FVRUpdate(); if (locker == locktype.BoltLocking) { if ((int)wep.Bolt.CurPos == 1) { ChangePosition(ChangePositionType.Lock); } if ((int)wep.Bolt.CurPos == 2) { ChangePosition(ChangePositionType.Unlock); } if (unlocked) { wep.Chamber.ChamberVelocityMultiplier = 0.1f; } else { wep.Chamber.ChamberVelocityMultiplier = velocity; } } if (locker == locktype.MagLocking && (int)wep.Bolt.CurPos == 1 && unlocked) { magrelease.dropmag(null, _override: true); } } public void ChangePosition(ChangePositionType ct) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) if (ct == ChangePositionType.Swap) { unlocked = !unlocked; } if (ct == ChangePositionType.Unlock) { unlocked = true; } if (ct == ChangePositionType.Lock) { unlocked = false; } if (unlocked) { lockingpiece.transform.localPosition = lockingpieceunlocked.localPosition; lockingpiece.transform.localRotation = lockingpieceunlocked.localRotation; } else { lockingpiece.transform.localPosition = lockingpiecelocked.localPosition; lockingpiece.transform.localRotation = lockingpiecelocked.localRotation; } if (locker == locktype.BoltLocking) { col.enabled = unlocked; } if (locker == locktype.MagLocking) { magrelease.DisallowEjection = !unlocked; mrtcol.enabled = unlocked; } } } } namespace H3VRUtils.ObjectModifiers { public class Stick : MonoBehaviour { public FVRPhysicalObject physObj; [Tooltip("Point Z to direction to check. If an layer object is within 0.05m from the raycastdir, it will lock.")] public Transform raycastDir; [Tooltip("If velocity is below this, it will allow it to lock.")] public float minVel; public LayerMask layer; private bool isLocked; public void FixedUpdate() { //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_0026: 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_003e: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = physObj.RootRigidbody.velocity; RaycastHit val = default(RaycastHit); if (((Vector3)(ref velocity)).magnitude <= minVel && Physics.Raycast(raycastDir.position, raycastDir.forward, ref val, 2f, LayerMask.op_Implicit(layer))) { isLocked = true; physObj.SetIsKinematicLocked(true); } if (isLocked && ((FVRInteractiveObject)physObj).IsHeld) { isLocked = false; physObj.SetIsKinematicLocked(false); } } } } namespace H3VRUtils.QOL { public class SouthpawSupporter : MonoBehaviour { [Tooltip("If true, automatically generates LeftHand and LeftHand_Touch.m")] public bool AutoSwapRot = true; public Transform LeftHand; public Transform LeftHand_Touch; private Transform RightHand; private Transform RightHand_Touch; private FVRPhysicalObject _physicalObject; public void Start() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL
plugins/H3VRUtilitiesVehicles.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using FistVR; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("H3VRUtilitiesVehicles")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("H3VRUtilitiesVehicles")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("D3911CEF-9C19-474C-8ED3-271399D2B892")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] public enum ControlMode { simple = 1, touch } public class VehicleControl : MonoBehaviour { [Serializable] public class CarWheels { public ConnectWheel wheels; } [Serializable] public class ConnectWheel { public bool frontWheelDrive = true; public Transform frontRight; public Transform frontLeft; public WheelSetting frontSetting; public bool backWheelDrive = true; public Transform backRight; public Transform backLeft; public WheelSetting rearSetting; } [Serializable] public class WheelSetting { public float Radius = 0.4f; public float Weight = 1000f; public float Distance = 0.2f; } [Serializable] public class CarLights { public Light[] brakeLights; public Light[] reverseLights; } [Serializable] public class CarSounds { public AudioSource IdleEngine; public AudioSource LowEngine; public AudioSource HighEngine; public float minPitch = 1f; public float maxPitch = 10f; public AudioSource nitro; public AudioSource switchGear; } [Serializable] public class CarParticles { public GameObject brakeParticlePerfab; public ParticleSystem shiftParticle1; public ParticleSystem shiftParticle2; private GameObject[] wheelParticle = (GameObject[])(object)new GameObject[4]; } [Serializable] public class CarSetting { public bool showNormalGizmos; public Transform carSteer; public HitGround[] hitGround; public List<Transform> cameraSwitchView; public float springs = 25000f; public float dampers = 1500f; public float carPower = 120f; public float shiftPower = 150f; public float brakePower = 8000f; public Vector3 shiftCentre = new Vector3(0f, -0.8f, 0f); public float maxSteerAngle = 25f; public float shiftDownRPM = 1500f; public float shiftUpRPM = 2500f; public float idleRPM = 500f; public float stiffness = 2f; public bool automaticGear = true; public float[] gears = new float[6] { -10f, 9f, 6f, 4.5f, 3f, 2.5f }; public float LimitBackwardSpeed = 60f; public float LimitForwardSpeed = 220f; } [Serializable] public class HitGround { public string tag = "street"; public bool grounded; public AudioClip brakeSound; public AudioClip groundSound; public Color brakeColor; } private class WheelComponent { public Transform wheel; public WheelCollider collider; public Vector3 startPos; public float rotation; public float rotation2; public float maxSteer; public bool drive; public float pos_y; public WheelSetting settings; } public ControlMode controlMode = ControlMode.simple; public bool activeControl; public CarWheels carWheels; public CarLights carLights; public CarSounds carSounds; public CarParticles carParticles; public CarSetting carSetting; [HideInInspector] public float steer; [HideInInspector] public float accel; [HideInInspector] public bool brake; private bool shifmotor; [HideInInspector] public float curTorque = 100f; [HideInInspector] public float powerShift = 100f; [HideInInspector] public bool shift; private float torque = 100f; [HideInInspector] public float speed; private float lastSpeed = -10f; private bool shifting; private float[] efficiencyTable = new float[22] { 0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1f, 0.95f, 0.8f, 0.7f, 0.6f, 0.5f, 0.45f, 0.4f, 0.36f, 0.33f, 0.3f, 0.2f, 0.1f, 0.05f }; private float efficiencyTableStep = 250f; private float Pitch; private float PitchDelay; private float shiftTime; private float shiftDelay; [HideInInspector] public int currentGear; [HideInInspector] public bool NeutralGear = true; [HideInInspector] public float motorRPM; [HideInInspector] public bool Backward; [HideInInspector] public float accelFwd; [HideInInspector] public float accelBack; [HideInInspector] public float steerAmount; private float wantedRPM; private float w_rotate; private float slip; private float slip2; private GameObject[] Particle = (GameObject[])(object)new GameObject[4]; private Vector3 steerCurAngle; private Rigidbody myRigidbody; private WheelComponent[] wheels; public bool isOn = true; public bool isForciblyOff; public Rigidbody GetRigidbody() { return myRigidbody; } private WheelComponent SetWheelComponent(Transform wheel, float maxSteer, bool drive, float pos_y, WheelSetting setting) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0033: 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_0059: 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_00ab: 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) WheelComponent wheelComponent = new WheelComponent(); GameObject val = new GameObject(((Object)wheel).name + "WheelCollider"); val.transform.parent = ((Component)this).transform; val.transform.position = wheel.position; val.transform.eulerAngles = ((Component)this).transform.eulerAngles; pos_y = val.transform.localPosition.y; _ = (WheelCollider)val.AddComponent(typeof(WheelCollider)); wheelComponent.wheel = wheel; wheelComponent.collider = val.GetComponent<WheelCollider>(); wheelComponent.drive = drive; wheelComponent.pos_y = pos_y; wheelComponent.maxSteer = maxSteer; wheelComponent.startPos = val.transform.localPosition; wheelComponent.settings = setting; return wheelComponent; } private void Awake() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) if (carSetting.automaticGear) { NeutralGear = false; } myRigidbody = ((Component)((Component)this).transform).GetComponent<Rigidbody>(); wheels = new WheelComponent[4]; wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y, carWheels.wheels.frontSetting); wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y, carWheels.wheels.frontSetting); wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y, carWheels.wheels.rearSetting); wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y, carWheels.wheels.rearSetting); if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { steerCurAngle = carSetting.carSteer.localEulerAngles; } WheelComponent[] array = wheels; foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; collider.suspensionDistance = wheelComponent.settings.Distance; JointSpring suspensionSpring = collider.suspensionSpring; suspensionSpring.spring = carSetting.springs; suspensionSpring.damper = carSetting.dampers; collider.suspensionSpring = suspensionSpring; collider.radius = wheelComponent.settings.Radius; collider.mass = wheelComponent.settings.Weight; WheelFrictionCurve val = collider.forwardFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.forwardFriction = val; val = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 7500f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 2f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.sidewaysFriction = val; } } public void TurnOnEngine(bool forcibly) { if (!isForciblyOff) { isOn = true; } else if (forcibly) { isForciblyOff = false; isOn = true; } } public void TurnOffEngine(bool forcibly) { isForciblyOff = forcibly; isOn = false; } public void ShiftTo(int newGear) { ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); currentGear = newGear; if (currentGear == 0) { NeutralGear = true; } else { NeutralGear = false; } if (currentGear == -1) { currentGear = 0; } } public void ShiftUp(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || currentGear >= carSetting.gears.Length - 1) { return; } ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); if (!carSetting.automaticGear) { if (currentGear == 0) { if (NeutralGear) { currentGear++; NeutralGear = false; } else { NeutralGear = true; } } else { currentGear++; } } else { currentGear++; } shiftDelay = timeSinceLevelLoad + 1f; shiftTime = 1.5f; } public void ShiftDown(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || (currentGear <= 0 && !NeutralGear)) { return; } ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); if (!carSetting.automaticGear) { if (currentGear == 1) { if (!NeutralGear) { currentGear--; NeutralGear = true; } } else if (currentGear == 0) { NeutralGear = false; } else { currentGear--; } } else { currentGear--; } shiftDelay = timeSinceLevelLoad + 0.1f; shiftTime = 2f; } private void OnCollisionEnter(Collision collision) { //IL_002b: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>())) { VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>(); Vector3 relativeVelocity = collision.relativeVelocity; component.slip2 = Mathf.Clamp(((Vector3)(ref relativeVelocity)).magnitude, 0f, 10f); myRigidbody.angularVelocity = new Vector3((0f - myRigidbody.angularVelocity.x) * 0.5f, myRigidbody.angularVelocity.y * 0.5f, (0f - myRigidbody.angularVelocity.z) * 0.5f); myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, myRigidbody.velocity.y * 0.5f, myRigidbody.velocity.z); } } private void OnCollisionStay(Collision collision) { if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>())) { ((Component)collision.transform.root).GetComponent<VehicleControl>().slip2 = 5f; } } private void Update() { } private void FixedUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09d0: Unknown result type (might be due to invalid IL or missing references) //IL_0e40: Unknown result type (might be due to invalid IL or missing references) //IL_0e4a: Unknown result type (might be due to invalid IL or missing references) //IL_0d79: Unknown result type (might be due to invalid IL or missing references) //IL_0d80: Unknown result type (might be due to invalid IL or missing references) //IL_0d85: Unknown result type (might be due to invalid IL or missing references) //IL_0d9f: Unknown result type (might be due to invalid IL or missing references) //IL_0daa: Unknown result type (might be due to invalid IL or missing references) //IL_0db4: Unknown result type (might be due to invalid IL or missing references) //IL_0dca: Unknown result type (might be due to invalid IL or missing references) //IL_0e5f: Unknown result type (might be due to invalid IL or missing references) //IL_0a21: Unknown result type (might be due to invalid IL or missing references) //IL_0a26: Unknown result type (might be due to invalid IL or missing references) //IL_0be3: Unknown result type (might be due to invalid IL or missing references) if (!isOn) { accel = 0f; } Vector3 velocity = myRigidbody.velocity; speed = ((Vector3)(ref velocity)).magnitude * 2.7f; if (speed < lastSpeed - 10f && slip < 10f) { slip = lastSpeed / 15f; } lastSpeed = speed; if (slip2 != 0f) { slip2 = Mathf.MoveTowards(slip2, 0f, 0.1f); } myRigidbody.centerOfMass = carSetting.shiftCentre; if (!carWheels.wheels.frontWheelDrive && !carWheels.wheels.backWheelDrive) { accel = 0f; } if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { carSetting.carSteer.localEulerAngles = new Vector3(steerCurAngle.x, steerCurAngle.y, steerCurAngle.z + steer * -120f); } if (carSetting.automaticGear && currentGear == 1 && accel < 0f) { if (speed < 5f) { ShiftDown(ignoreDelay: false); } } else if (carSetting.automaticGear && currentGear == 0 && accel > 0f) { if (speed < 5f) { ShiftUp(ignoreDelay: false); } } else if (carSetting.automaticGear && motorRPM > carSetting.shiftUpRPM && accel > 0f && speed > 10f && !brake) { ShiftUp(ignoreDelay: false); } else if (carSetting.automaticGear && motorRPM < carSetting.shiftDownRPM && currentGear > 1) { ShiftDown(ignoreDelay: false); } if (speed < 1f) { Backward = true; } if (currentGear != 0 || !Backward) { Backward = false; } Light[] brakeLights = carLights.brakeLights; foreach (Light val in brakeLights) { if (brake || accel < 0f || speed < 1f) { val.intensity = Mathf.MoveTowards(val.intensity, 8f, 0.5f); } else { val.intensity = Mathf.MoveTowards(val.intensity, 0f, 0.5f); } ((Behaviour)val).enabled = val.intensity != 0f; } brakeLights = carLights.reverseLights; foreach (Light val2 in brakeLights) { if (speed > 2f && currentGear == 0) { val2.intensity = Mathf.MoveTowards(val2.intensity, 8f, 0.5f); } else { val2.intensity = Mathf.MoveTowards(val2.intensity, 0f, 0.5f); } ((Behaviour)val2).enabled = val2.intensity != 0f; } wantedRPM = 5500f * accel * 0.1f + wantedRPM * 0.9f; float num = 0f; int num2 = 0; bool flag = false; int num3 = 0; WheelComponent[] array = wheels; WheelHit val4 = default(WheelHit); foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; if (wheelComponent.drive) { num = ((!NeutralGear && brake && currentGear < 2) ? (num + accel * carSetting.idleRPM) : (NeutralGear ? (num + carSetting.idleRPM * accel) : (num + collider.rpm))); num2++; } if (brake || accel < 0f) { if (accel < 0f || (brake && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (brake && accel > 0f) { slip = Mathf.Lerp(slip, 5f, accel * 0.01f); } else if (speed > 1f) { slip = Mathf.Lerp(slip, 1f, 0.002f); } else { slip = Mathf.Lerp(slip, 1f, 0.02f); } wantedRPM = 0f; collider.brakeTorque = carSetting.brakePower; wheelComponent.rotation = w_rotate; } } else { float brakeTorque; if (accel != 0f && !NeutralGear) { float num5 = (collider.brakeTorque = 0f); brakeTorque = num5; } else { float num5 = (collider.brakeTorque = 1000f); brakeTorque = num5; } collider.brakeTorque = brakeTorque; slip = ((!(speed > 0f)) ? (slip = Mathf.Lerp(slip, 0.01f, 0.02f)) : ((speed > 100f) ? (slip = Mathf.Lerp(slip, 1f + Mathf.Abs(steer), 0.02f)) : (slip = Mathf.Lerp(slip, 1.5f, 0.02f)))); w_rotate = wheelComponent.rotation; } WheelFrictionCurve val3 = collider.forwardFriction; ((WheelFrictionCurve)(ref val3)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val3)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val3)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); collider.forwardFriction = val3; val3 = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); ((WheelFrictionCurve)(ref val3)).extremumSlip = 0.2f + Mathf.Abs(steer); collider.sidewaysFriction = val3; if (shift && currentGear > 1 && speed > 50f && shifmotor && Mathf.Abs(steer) < 0.2f) { if (powerShift == 0f) { shifmotor = false; } powerShift = Mathf.MoveTowards(powerShift, 0f, Time.deltaTime * 10f); carSounds.nitro.volume = Mathf.Lerp(carSounds.nitro.volume, 1f, Time.deltaTime * 10f); if (!carSounds.nitro.isPlaying) { ((Component)carSounds.nitro).GetComponent<AudioSource>().Play(); } curTorque = ((powerShift > 0f) ? carSetting.shiftPower : carSetting.carPower); carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); } else { if (powerShift > 20f) { shifmotor = true; } carSounds.nitro.volume = Mathf.MoveTowards(carSounds.nitro.volume, 0f, Time.deltaTime * 2f); if (carSounds.nitro.volume == 0f) { carSounds.nitro.Stop(); } powerShift = Mathf.MoveTowards(powerShift, 100f, Time.deltaTime * 5f); curTorque = carSetting.carPower; carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, 0f, Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, 0f, Time.deltaTime * 10f); } wheelComponent.rotation = Mathf.Repeat(wheelComponent.rotation + Time.deltaTime * collider.rpm * 360f / 60f, 360f); wheelComponent.rotation2 = Mathf.Lerp(wheelComponent.rotation2, collider.steerAngle, 0.1f); wheelComponent.wheel.localRotation = Quaternion.Euler(wheelComponent.rotation, wheelComponent.rotation2, 0f); Vector3 localPosition = wheelComponent.wheel.localPosition; if (collider.GetGroundHit(ref val4)) { if (Object.op_Implicit((Object)(object)carParticles.brakeParticlePerfab)) { if ((Object)(object)Particle[num3] == (Object)null) { Particle[num3] = Object.Instantiate<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity); ((Object)Particle[num3]).name = "WheelParticle"; Particle[num3].transform.parent = ((Component)this).transform; Particle[num3].AddComponent<AudioSource>(); Particle[num3].GetComponent<AudioSource>().maxDistance = 50f; Particle[num3].GetComponent<AudioSource>().spatialBlend = 1f; Particle[num3].GetComponent<AudioSource>().dopplerLevel = 5f; Particle[num3].GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)2; } ParticleSystem component = Particle[num3].GetComponent<ParticleSystem>(); bool flag2 = false; for (int j = 0; j < carSetting.hitGround.Length; j++) { if (((Component)((WheelHit)(ref val4)).collider).CompareTag(carSetting.hitGround[j].tag)) { flag2 = carSetting.hitGround[j].grounded; if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.5f) && speed > 1f) { Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[j].brakeSound; } else if ((Object)(object)Particle[num3].GetComponent<AudioSource>().clip != (Object)(object)carSetting.hitGround[j].groundSound && !Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[j].groundSound; } Particle[num3].GetComponent<ParticleSystem>().startColor = carSetting.hitGround[j].brakeColor; } } if (flag2 && speed > 5f && !brake) { component.enableEmission = true; Particle[num3].GetComponent<AudioSource>().volume = 0.5f; if (!Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().Play(); } } else if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && speed > 1f) { if (accel < 0f || ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (!Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().Play(); } component.enableEmission = true; Particle[num3].GetComponent<AudioSource>().volume = 10f; } } else { component.enableEmission = false; Particle[num3].GetComponent<AudioSource>().volume = Mathf.Lerp(Particle[num3].GetComponent<AudioSource>().volume, 0f, Time.deltaTime * 10f); } } localPosition.y -= Vector3.Dot(wheelComponent.wheel.position - ((WheelHit)(ref val4)).point, ((Component)this).transform.TransformDirection(0f, 1f, 0f) / ((Component)this).transform.lossyScale.x) - collider.radius; localPosition.y = Mathf.Clamp(localPosition.y, -10f, wheelComponent.pos_y); flag = flag || wheelComponent.drive; } else { if ((Object)(object)Particle[num3] != (Object)null) { Particle[num3].GetComponent<ParticleSystem>().enableEmission = false; } localPosition.y = wheelComponent.startPos.y - wheelComponent.settings.Distance; myRigidbody.AddForce(Vector3.down * 5000f); } num3++; wheelComponent.wheel.localPosition = localPosition; } if (num2 > 1) { num /= (float)num2; } motorRPM = 0.95f * motorRPM + 0.05f * Mathf.Abs(num * carSetting.gears[currentGear]); if (motorRPM > 5500f) { motorRPM = 5200f; } int num7 = (int)(motorRPM / efficiencyTableStep); if (num7 >= efficiencyTable.Length) { num7 = efficiencyTable.Length - 1; } if (num7 < 0) { num7 = 0; } float num8 = curTorque * carSetting.gears[currentGear] * efficiencyTable[num7]; array = wheels; foreach (WheelComponent wheelComponent2 in array) { WheelCollider collider2 = wheelComponent2.collider; if (wheelComponent2.drive) { if (Mathf.Abs(collider2.rpm) > Mathf.Abs(wantedRPM)) { collider2.motorTorque = 0f; } else { float motorTorque = collider2.motorTorque; if (!brake && accel != 0f && !NeutralGear) { if ((speed < carSetting.LimitForwardSpeed && currentGear > 0) || (speed < carSetting.LimitBackwardSpeed && currentGear == 0)) { collider2.motorTorque = motorTorque * 0.9f + num8 * 1f; } else { collider2.motorTorque = 0f; collider2.brakeTorque = 2000f; } } else { collider2.motorTorque = 0f; } } } if (brake || slip2 > 2f) { collider2.steerAngle = Mathf.Lerp(collider2.steerAngle, steer * wheelComponent2.maxSteer, 0.02f); continue; } float num9 = Mathf.Clamp(speed / carSetting.maxSteerAngle, 1f, carSetting.maxSteerAngle); collider2.steerAngle = steer * (wheelComponent2.maxSteer / num9); } Pitch = Mathf.Clamp(1.2f + (motorRPM - carSetting.idleRPM) / (carSetting.shiftUpRPM - carSetting.idleRPM), carSounds.minPitch, carSounds.maxPitch); shiftTime = Mathf.MoveTowards(shiftTime, 0f, 0.1f); if (Pitch == 1f) { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1f, 0.1f); carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.1f); } else { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1.8f - Pitch, 0.1f); if ((Pitch > PitchDelay || accel > 0f) && shiftTime == 0f) { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0f, 0.2f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 1f, 0.1f); } else { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.2f); } carSounds.HighEngine.pitch = Pitch; carSounds.LowEngine.pitch = Pitch; PitchDelay = Pitch; } if (!isOn) { carSounds.IdleEngine.volume = 0f; carSounds.LowEngine.volume = 0f; carSounds.HighEngine.volume = 0f; } } private void OnDrawGizmos() { //IL_001b: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) if (carSetting.showNormalGizmos && !Application.isPlaying) { Gizmos.matrix = Matrix4x4.TRS(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.lossyScale); Gizmos.color = new Color(1f, 0f, 0f, 0.5f); Gizmos.DrawCube(Vector3.up / 1.5f, new Vector3(2.5f, 2f, 6f)); Gizmos.DrawSphere(carSetting.shiftCentre / ((Component)this).transform.lossyScale.x, 0.2f); } } } namespace H3VRUtils { [BepInPlugin("dll.wfiost.h3vrutilitieslib.vehicles", "H3VR Utilities Vehicles Library", "8.11.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("h3vr.exe")] public class BepInExLoader_VehiclesLib : BaseUnityPlugin { } } namespace H3VRUtils.Vehicles { internal class EngineDamagable : VehicleDamagable { public GameObject particleSystemCentre; public GameObject explosionCentre; public float SmokeParticleHPThreshold; public GameObject particleSmokePrefab; public GameObject particleFirePrefab; public GameObject explosionPrefab; public GameObject fixedMesh; public GameObject damagedMesh; public GameObject destroyedMesh; public float explosionStrength = 200f; private ParticleSystem particleSmoke; private ParticleSystem particleFire; private bool dontChangeMesh; public void Start() { if ((Object)(object)fixedMesh == (Object)null || (Object)(object)damagedMesh == (Object)null || (Object)(object)destroyedMesh == (Object)null) { dontChangeMesh = true; } GameObject val = Object.Instantiate<GameObject>(particleSmokePrefab, particleSystemCentre.transform); particleSmoke = val.GetComponent<ParticleSystem>(); particleSmoke.Stop(); GameObject val2 = Object.Instantiate<GameObject>(particleFirePrefab, particleSystemCentre.transform); particleFire = val2.GetComponent<ParticleSystem>(); particleFire.Stop(); } public override void onHealthChange() { if (HPLessThanPercent(SmokeParticleHPThreshold)) { if (!particleSmoke.IsAlive()) { particleSmoke.Play(); } } else { particleSmoke.Stop(); } if (!dontChangeMesh) { if (health < 0f) { fixedMesh.SetActive(false); damagedMesh.SetActive(false); destroyedMesh.SetActive(true); } else if (HPLessThanPercent(SmokeParticleHPThreshold)) { fixedMesh.SetActive(false); damagedMesh.SetActive(true); destroyedMesh.SetActive(false); } else { fixedMesh.SetActive(true); damagedMesh.SetActive(false); destroyedMesh.SetActive(false); } } } public override void onDeath() { //IL_002a: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) particleFire.Play(); if ((Object)(object)explosionPrefab != (Object)null) { Object.Instantiate<GameObject>(explosionPrefab, explosionCentre.transform.position, explosionCentre.transform.rotation); vehicle.GetRigidbody().AddForceAtPosition(new Vector3(0f, explosionStrength, 0f), ((Component)this).transform.position); } vehicle.TurnOffEngine(forcibly: true); } public override void whileDead() { vehicle.isForciblyOff = true; } public override void whileUndead() { } public override void Heal(float heal) { base.Heal(heal); } public override void HealPercent(float percentHeal) { base.HealPercent(percentHeal); } public override void onUndeath() { particleFire.Stop(); vehicle.isForciblyOff = false; } public override void Damage(Damage dmg) { float damage = getDamage(dmg); health -= damage; } } public class FuelTank : VehicleDamagable { public float currentFuel; public float maxFuel; public float fuelUsagePer1000Rpm = 0.01f; public float leakMult; public GameObject explosionEffect; public bool BlowsOnDeath; public AudioSource leakSound; private new void FixedUpdate() { base.FixedUpdate(); float num = vehicle.motorRPM / 1000f * (fuelUsagePer1000Rpm / 3000f); currentFuel -= num; float num2 = Mathf.InverseLerp(maxHealth * 0.5f, 0f, health); currentFuel -= num2 * leakMult / 50f; if ((Object)(object)leakSound != (Object)null) { leakSound.volume = num2; } if (currentFuel < 0f) { currentFuel = 0f; } if (currentFuel == 0f) { vehicle.TurnOffEngine(forcibly: false); } } public override void whileDead() { base.whileDead(); } public override void onDeath() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) base.onDeath(); if (BlowsOnDeath) { Object.Instantiate<GameObject>(explosionEffect, ((Component)this).transform.position, ((Component)this).transform.rotation); currentFuel = 0f; } } public float AddFuel(float fuelAdded) { currentFuel += fuelAdded; float num = maxFuel - currentFuel; if (num <= 0f) { return 0f; } return num; } } [Serializable] public class VehicleDamagableMult { public float projectileMult = 1f; public float meleeMult = 1f; public float explosionMult = 1f; public float piercingMult = 1f; public float cuttingMult = 1f; public float thermalMult = 1f; public float bluntMult = 1f; public float totalKineticMult = 1f; } public class VehicleDamagable : MonoBehaviour, IFVRDamageable { public float health; public float maxHealth; public float minHealth; public VehicleDamagableMult dmgMult; public VehicleControl vehicle; public bool dead; private float prevhealth; public virtual void FixedUpdate() { if (health < 0f) { if (!dead) { onDeath(); dead = true; } whileDead(); } else { if (dead) { onUndeath(); dead = false; } whileUndead(); } if (health < minHealth) { health = minHealth; } if (health != prevhealth) { onHealthChange(); } prevhealth = health; } public virtual void onHealthChange() { } public bool HPLessThan(float num) { if (health < num) { return true; } return false; } public bool HPLessThanPercent(float num) { if (health < num * maxHealth) { return true; } return false; } public virtual void onDeath() { } public virtual void whileDead() { } public virtual void whileUndead() { } public virtual void onUndeath() { } public virtual void HealPercent(float percentHeal) { Heal(percentHeal * maxHealth); Debug.Log((object)("percenthealing for " + percentHeal)); } public virtual void Heal(float heal) { health += heal; Debug.Log((object)("Healed for " + heal)); } public virtual void Damage(Damage dmg) { health -= getDamage(dmg); } public float getDamage(Damage dmg) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Invalid comparison between Unknown and I4 float num = Vector3.Angle(dmg.strikeDir, -dmg.hitNormal); float num2 = Mathf.Clamp((1f - num / 90f) * 1.5f, 0.4f, 1.5f); dmg.Dam_Blunt *= num2; dmg.Dam_Cutting *= num2; dmg.Dam_Piercing *= num2; dmg.Dam_TotalKinetic *= num2; if ((int)dmg.Class == 1) { dmg.Dam_Blunt *= dmgMult.projectileMult; dmg.Dam_Cutting *= dmgMult.projectileMult; dmg.Dam_Piercing *= dmgMult.projectileMult; dmg.Dam_TotalKinetic *= dmgMult.projectileMult; } else if ((int)dmg.Class == 3) { dmg.Dam_Blunt *= dmgMult.meleeMult; dmg.Dam_Cutting *= dmgMult.meleeMult; dmg.Dam_Piercing *= dmgMult.meleeMult; dmg.Dam_TotalKinetic *= dmgMult.meleeMult; } else if ((int)dmg.Class == 2) { dmg.Dam_Blunt *= dmgMult.explosionMult; dmg.Dam_Cutting *= dmgMult.explosionMult; dmg.Dam_Piercing *= dmgMult.explosionMult; dmg.Dam_TotalKinetic *= dmgMult.explosionMult; } dmg.Dam_Blunt *= dmgMult.bluntMult; dmg.Dam_Cutting *= dmgMult.cuttingMult; dmg.Dam_TotalKinetic *= dmgMult.totalKineticMult; dmg.Dam_Piercing *= dmgMult.piercingMult; dmg.Dam_Thermal *= dmgMult.thermalMult; float num3 = 0f; num3 += dmg.Dam_Blunt; num3 += dmg.Dam_Cutting; num3 += dmg.Dam_Piercing; num3 += dmg.Dam_Piercing; num3 += dmg.Dam_Thermal; Debug.Log((object)("Damage taken: " + num3)); return num3; } } internal class EnterVehicle : FVRInteractiveObject { public VehicleSeat vehicleSeat; public override void SimpleInteraction(FVRViveHand hand) { //IL_007a: 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_00e8: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); if (hand.IsThisTheRightHand) { hand = hand.OtherHand; } if ((Object)(object)vehicleSeat.hand == (Object)null) { if (VehicleSeat.currentSeat.ContainsKey(hand)) { VehicleSeat.currentSeat[hand].RemoveHand(); } VehicleSeat.currentSeat.Add(hand, vehicleSeat); vehicleSeat.hand = hand; hand.MovementManager.TeleportToPoint(vehicleSeat.SitPos.transform.position, false, vehicleSeat.SitPos.transform.localEulerAngles); } else if ((Object)(object)hand == (Object)(object)vehicleSeat.hand) { vehicleSeat.RemoveHand(); if ((Object)(object)vehicleSeat.EjectPos != (Object)null) { ((Component)hand.MovementManager).transform.position = vehicleSeat.EjectPos.transform.position; } } } } public class ButtonIgnition : FVRInteractiveObject { public VehicleControl vehicle; public VehicleAudioSet audioSet; public float ignitionTime; private float m_it; public float failChance; public Random rand; public void Start() { rand = new Random(); } public override void BeginInteraction(FVRViveHand hand) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) m_it = ignitionTime; if (vehicle.isOn) { SM.PlayGenericSound(audioSet.VehicleStop, ((Component)this).transform.position); m_it = 999999f; vehicle.TurnOffEngine(forcibly: false); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); m_it -= Time.fixedDeltaTime; if (m_it <= 0f) { vehicle.TurnOnEngine(forcibly: false); SM.PlayGenericSound(audioSet.VehicleStart, ((Component)this).transform.position); m_it = 999999f; } } } [Serializable] public class DriveShiftNode { public Vector3 localposition; public Vector3 rotation; public int left = -1; public int up = -1; public int right = -1; public int down = -1; public int gear; } public class DriveShift : FVRInteractiveObject { public VehicleControl vehicle; public Text gearText; public int currentNode; public List<DriveShiftNode> driveShiftNodes; public VehicleAudioSet audioSet; public void Update() { if (vehicle.carSetting.automaticGear) { if (vehicle.currentGear > 0 && vehicle.speed > 1f) { gearText.text = vehicle.currentGear.ToString(); } else if (vehicle.speed > 1f) { gearText.text = "R"; } else { gearText.text = "N"; } } else if (vehicle.NeutralGear) { gearText.text = "N"; } else if (vehicle.currentGear != 0) { gearText.text = vehicle.currentGear.ToString(); } else { gearText.text = "R"; } } private void Start() { //IL_0038: 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) vehicle.ShiftTo(driveShiftNodes[currentNode].gear); ((Component)this).transform.localPosition = driveShiftNodes[currentNode].localposition; ((Component)this).transform.localEulerAngles = driveShiftNodes[currentNode].rotation; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0008: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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) bool flag = false; if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].left != -1) { flag = true; currentNode = driveShiftNodes[currentNode].left; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].up != -1) { flag = true; currentNode = driveShiftNodes[currentNode].up; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].right != -1) { flag = true; currentNode = driveShiftNodes[currentNode].right; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].down != -1) { flag = true; currentNode = driveShiftNodes[currentNode].down; } if (flag) { vehicle.ShiftTo(driveShiftNodes[currentNode].gear); ((Component)this).transform.localPosition = driveShiftNodes[currentNode].localposition; ((Component)this).transform.localEulerAngles = driveShiftNodes[currentNode].rotation; } } } public class ParkingBrakeClick : FVRInteractiveObject { public VehicleControl vehicle; public Vector3 positionOff; public Vector3 positionOn; public Vector3 rotationOff; public Vector3 rotationOn; public bool isOn; public VehicleAudioSet audioSet; public override void SimpleInteraction(FVRViveHand hand) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0040: 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) ((FVRInteractiveObject)this).SimpleInteraction(hand); isOn = !isOn; if (isOn) { SM.PlayGenericSound(audioSet.HandbrakeUp, ((Component)this).transform.position); ((Component)this).transform.localPosition = positionOn; ((Component)this).transform.localEulerAngles = rotationOn; vehicle.brake = true; } else { SM.PlayGenericSound(audioSet.HandbrakeDown, ((Component)this).transform.position); ((Component)this).transform.localPosition = positionOff; ((Component)this).transform.localEulerAngles = rotationOff; vehicle.brake = false; } } } internal class SteeringWheel : FVRInteractiveObject { public VehicleControl vehicle; public float resetLerpSpeed; public float maxRot; public bool reverseRot; [Header("Debug Values")] public Text rotText; public float rot; public float rh; public float lr; public float inlerp; public float lerp; public float rotAmt; public VehicleAudioSet audioSet; public override void BeginInteraction(FVRViveHand hand) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0053: 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) ((FVRInteractiveObject)this).BeginInteraction(hand); Transform child = ((Component)this).transform.GetChild(0); child.parent = null; Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; ((Component)this).transform.LookAt(((Component)hand).transform); ((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, ((Component)this).transform.localEulerAngles.y, localEulerAngles.z); child.parent = ((Component)this).transform; } public override void EndInteraction(FVRViveHand hand) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).EndInteraction(hand); Transform child = ((Component)this).transform.GetChild(0); child.parent = null; ((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, 0f, ((Component)this).transform.localEulerAngles.z); child.parent = ((Component)this).transform; } public override void UpdateInteraction(FVRViveHand hand) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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_0031: 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_0088: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00dd: 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) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; ((Component)this).transform.LookAt(((Component)hand).transform); Vector3 localEulerAngles2 = ((Component)this).transform.localEulerAngles; rot = Mathf.DeltaAngle((float)Math.Round(localEulerAngles2.y), (float)Math.Round(localEulerAngles.y)); rotAmt += rot; if (rotAmt >= maxRot) { rotAmt = maxRot; ((Component)this).transform.localEulerAngles = localEulerAngles; } else if (rotAmt <= 0f - maxRot) { rotAmt = 0f - maxRot; ((Component)this).transform.localEulerAngles = localEulerAngles; } else { ((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles2.y, localEulerAngles.z); } rh = localEulerAngles2.y; lr = localEulerAngles.y; SetRot(); bool flag = false; if (hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.25f) { flag = true; } if (flag) { vehicle.accel = 0f - (float)Math.Pow(((Vector2)(ref hand.Input.TouchpadAxes)).magnitude, 2.0); vehicle.brake = true; } else { vehicle.accel = (float)Math.Pow(hand.Input.TriggerFloat, 2.0); vehicle.brake = false; } } private void FixedUpdate() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) if ((Object)(object)base.m_hand == (Object)null) { float num = resetLerpSpeed; if (rotAmt > 0f) { num = 0f - num; } if (rotAmt > num || rotAmt < 0f - num) { rotAmt += num; ((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, ((Component)this).transform.localEulerAngles.y - num, ((Component)this).transform.localEulerAngles.z); vehicle.accel = 0f; SetRot(); } } } private void SetRot() { bool num = rotAmt <= 0f; lerp = Mathf.Abs(rotAmt) / maxRot; lerp *= -1f; if (num) { lerp *= -1f; } if (reverseRot) { lerp = 0f - lerp; } if ((Object)(object)rotText != (Object)null) { rotText.text = lerp.ToString(); } vehicle.steer = lerp; } } [CreateAssetMenu(fileName = "New Vehicle Audio Set", menuName = "Vehicles/AudioSet", order = 0)] public class VehicleAudioSet : ScriptableObject { private static AudioEvent defaultAE = new AudioEvent { PitchRange = new Vector2(0.98f, 1.04f), VolumeRange = new Vector2(0.98f, 1.04f), ClipLengthRange = new Vector2(1f, 1f) }; public AudioEvent VehicleStart; public AudioEvent VehicleIdle; public AudioEvent VehicleStop; public AudioEvent HandbrakeUp; public AudioEvent HandbrakeDown; public AudioEvent ShiftDownGear; public AudioEvent RevLoop; public AudioEvent ShiftUpGear; public AudioEvent Brake; public AudioEvent BrakeLong; public AudioEvent PedalSwitchSound; } internal class VehicleSeat : MonoBehaviour { public static Dictionary<FVRViveHand, VehicleSeat> currentSeat = new Dictionary<FVRViveHand, VehicleSeat>(); public FVRViveHand hand; public GameObject SitPos; public GameObject EjectPos; public void Update() { //IL_0021: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_0127: 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_0158: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hand != (Object)null) { if (Vector3.Distance(((Component)hand.MovementManager).transform.position, ((Component)this).transform.position) > 25f) { RemoveHand(); } ((Component)hand.MovementManager).transform.position = SitPos.transform.position; Vector3 eulerAngles = ((Component)hand.MovementManager).transform.eulerAngles; if (UtilsBepInExLoader.VehicleLockXRot.Value) { eulerAngles.x = SitPos.transform.rotation.x; } if (UtilsBepInExLoader.VehicleLockYRot.Value) { eulerAngles.y = SitPos.transform.rotation.y; } if (UtilsBepInExLoader.VehicleLockZRot.Value) { eulerAngles.z = SitPos.transform.rotation.z; } ((Component)hand.MovementManager).transform.eulerAngles = Vector3.Lerp(((Component)hand.MovementManager).transform.eulerAngles, eulerAngles, 0.2f * Time.deltaTime); if (GM.CurrentPlayerBody.GetPlayerHealth() <= 0f) { RemoveHand(); } if (((Component)hand.MovementManager).transform.position.y < GM.CurrentSceneSettings.CatchHeight) { RemoveHand(); } } } public void RemoveHand() { if (currentSeat.ContainsKey(hand)) { currentSeat.Remove(hand); } hand = null; } } public class FuelNeedle : MonoBehaviour { public FuelTank tank; public GameObject needle; public Vector3 needleNoFuel; public Vector3 needleMaxFuel; public void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float currentFuel = tank.currentFuel; float num = Mathf.InverseLerp(0f, tank.maxFuel, currentFuel); needle.transform.localEulerAngles = Vector3.Lerp(needleNoFuel, needleMaxFuel, num); } } public class SpedometerNeedle : MonoBehaviour { public VehicleControl vehicle; public GameObject needle; public bool isImperial; public float maxSpeed; public Vector3 needleNoSpeed; public Vector3 needleMaxSpeed; public void Update() { //IL_003f: 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_004b: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(vehicle.speed); if (isImperial) { num *= 0.6213712f; } float num2 = Mathf.InverseLerp(0f, maxSpeed, num); needle.transform.localEulerAngles = Vector3.Lerp(needleNoSpeed, needleMaxSpeed, num2); } } internal class ForkliftLift : FVRInteractiveObject { public Vector3 rotUpwards; public Vector3 rotRegular; public Vector3 rotDownwards; public GameObject lift; public float liftSpeed; public float minLiftY; public float maxLiftY; public override void UpdateInteraction(FVRViveHand hand) { //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_001f: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00f9: 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_0087: 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_00ef: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 position = lift.transform.position; ((Component)this).transform.localEulerAngles = rotRegular; if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { position.y += liftSpeed / 50f; ((Component)this).transform.localEulerAngles = rotUpwards; } if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f) { position.y -= liftSpeed / 50f; ((Component)this).transform.localEulerAngles = rotDownwards; } if (position.y > maxLiftY) { position.y = maxLiftY; } else if (position.y < minLiftY) { position.y = minLiftY; } lift.transform.position = position; } } } namespace H3VRUtils.Vehicles.Core { public class DamagingArea : MonoBehaviour { public VehicleControl vehicle; public float damageMult = 15f; public float sharpyness = 50f; private void OnCollisionEnter(Collision other) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002d: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) if (!(vehicle.speed < 12f)) { IFVRDamageable component = other.gameObject.GetComponent<IFVRDamageable>(); if (component != null) { Damage val = new Damage(); val.Class = (DamageClass)4; val.Dam_Piercing = sharpyness; val.Dam_Blunt = vehicle.speed * damageMult; val.Dam_TotalKinetic = val.Dam_Blunt + val.Dam_Piercing; val.point = ((ContactPoint)(ref other.contacts[0])).point; val.hitNormal = ((ContactPoint)(ref other.contacts[0])).normal; val.strikeDir = ((Component)this).transform.forward; component.Damage(val); } } } } }
plugins/H3VRUtilsConfig.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using BepInEx.Configuration; using FistVR; using Sodalite; using Sodalite.Api; using Sodalite.UiWidgets; using Sodalite.Utilities; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("H3VRUtilsConfig")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("H3VRUtilsConfig")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("83438cce-0ced-4ed4-a2f8-e1468b5bc01b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace H3VRUtils { public static class UtilsPluginInfo { public const string VERSION = "8.11.0"; } [BepInPlugin("dll.wfiost.h3vrutilities", "H3VR Utilities", "8.11.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("h3vr.exe")] public class UtilsBepInExLoader : BaseUnityPlugin { public enum TouchpadDirTypePT { Up, Down, Left, Right, Trigger, BasedOnWeapon } public static ConfigEntry<bool> paddleMagRelease; public static ConfigEntry<bool> magDropRequiredRelease; public static ConfigEntry<bool> VehicleLockXRot; public static ConfigEntry<bool> VehicleLockYRot; public static ConfigEntry<bool> VehicleLockZRot; public static ConfigEntry<bool> SimpleControls; public static ConfigEntry<TouchpadDirTypePT> paddleMagReleaseDir; public static bool setToEnablePaddleMagRelease; public static void EnablePaddleMagRelease() { try { paddleMagRelease.Value = true; magDropRequiredRelease.Value = true; } catch { setToEnablePaddleMagRelease = true; } } private void Awake() { paddleMagRelease = ((BaseUnityPlugin)this).Config.Bind<bool>("General Settings", "Enable Paddle Release", false, "Allows custom guns to utilize the feature to require a direction press on the touchpad to release the mag, usually to simulate a paddle release."); magDropRequiredRelease = ((BaseUnityPlugin)this).Config.Bind<bool>("General Settings", "Enable Mandatory Mag Drop", false, "Allows custom guns to utilize the feature to require the mag to be dropped by your primary hand, even if your other hand is gripping the magazine."); paddleMagReleaseDir = ((BaseUnityPlugin)this).Config.Bind<TouchpadDirTypePT>("Fine Tuning", "Enhanced Mag Release Direction", TouchpadDirTypePT.BasedOnWeapon, "Based On Weapon is the default direction chosen by the modmaker. Others are overrides."); VehicleLockXRot = ((BaseUnityPlugin)this).Config.Bind<bool>("Vehicles", "Lock X Rotation", false, "Rotates your X rotation based on the vehicles rotation. Induces VR sickness."); VehicleLockYRot = ((BaseUnityPlugin)this).Config.Bind<bool>("Vehicles", "Lock Y Rotation", false, "Rotates your Y rotation based on the vehicles rotation. Induces VR sickness."); VehicleLockZRot = ((BaseUnityPlugin)this).Config.Bind<bool>("Vehicles", "Lock Z Rotation", false, "Rotates your Z rotation based on the vehicles rotation. Induces VR sickness."); SimpleControls = ((BaseUnityPlugin)this).Config.Bind<bool>("General Settings", "Enable Simple Controls", false, "Allows simpler controls (e.g enables ModulAR bolt release via up press on touchpad)"); if (setToEnablePaddleMagRelease) { setToEnablePaddleMagRelease = false; paddleMagRelease.Value = true; magDropRequiredRelease.Value = true; } try { new UtilsOptionsPanel(); } catch { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Error when initializing panel! Is Sodalite not installed?"); } } } public class UtilsOptionsPanel : MonoBehaviour { private LockablePanel _UtilsPanel; private ButtonWidget paddleMagReleaseButton; private ButtonWidget MagDropRequiredReleaseButton; private ButtonWidget VehicleLockXRotButton; private ButtonWidget VehicleLockYRotButton; private ButtonWidget VehicleLockZRotButton; private ButtonWidget SimpleControls; public UtilsOptionsPanel() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown WristMenuAPI.Buttons.Add(new WristMenuButton("Spawn Utils Panel", int.MaxValue, new ButtonClickEvent(SpawnUtilsPanel))); _UtilsPanel = new LockablePanel(); _UtilsPanel.Configure += ConfigureUtilsPanel; _UtilsPanel.TextureOverride = SodaliteUtils.LoadTextureFromBytes(SodaliteUtils.GetResource(Assembly.GetExecutingAssembly(), "UtilsPanel.png")); } public static string GetTerm(bool value) { if (!value) { return "Enable"; } return "Disable"; } private void ConfigureUtilsPanel(GameObject panel) { UiWidget.CreateAndConfigureWidget<GridLayoutWidget>(((Component)panel.transform.Find("OptionsCanvas_0_Main/Canvas")).gameObject, (Action<GridLayoutWidget>)delegate(GridLayoutWidget widget) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0069: 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_0093: 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_00ad: Unknown result type (might be due to invalid IL or missing references) ((Transform)((UiWidget)widget).RectTransform).localScale = new Vector3(0.07f, 0.07f, 0.07f); ((Transform)((UiWidget)widget).RectTransform).localPosition = Vector3.zero; ((UiWidget)widget).RectTransform.anchoredPosition = Vector2.zero; ((UiWidget)widget).RectTransform.sizeDelta = new Vector2(528.5714f, 342.85715f); ((UiWidget)widget).RectTransform.pivot = new Vector2(0.5f, 1f); ((Transform)((UiWidget)widget).RectTransform).localRotation = Quaternion.identity; ((LayoutWidget<GridLayoutGroup>)(object)widget).LayoutGroup.cellSize = new Vector2(171f, 50f); ((LayoutWidget<GridLayoutGroup>)(object)widget).LayoutGroup.spacing = Vector2.one * 4f; ((LayoutWidget<GridLayoutGroup>)(object)widget).LayoutGroup.startCorner = (Corner)0; ((LayoutWidget<GridLayoutGroup>)(object)widget).LayoutGroup.startAxis = (Axis)0; ((LayoutGroup)((LayoutWidget<GridLayoutGroup>)(object)widget).LayoutGroup).childAlignment = (TextAnchor)1; ((LayoutWidget<GridLayoutGroup>)(object)widget).LayoutGroup.constraint = (Constraint)1; ((LayoutWidget<GridLayoutGroup>)(object)widget).LayoutGroup.constraintCount = 3; ((LayoutWidget<GridLayoutGroup>)(object)widget).AddChild<TextWidget>((Action<TextWidget>)delegate(TextWidget text) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) text.Text.text = ""; ((Transform)((UiWidget)text).RectTransform).localRotation = Quaternion.identity; }); ((LayoutWidget<GridLayoutGroup>)(object)widget).AddChild<TextWidget>((Action<TextWidget>)delegate(TextWidget text) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) text.Text.text = "H3VR Utilities Settings"; text.Text.alignment = (TextAnchor)4; Text text2 = text.Text; text2.fontSize += 5; ((Transform)((UiWidget)text).RectTransform).localRotation = Quaternion.identity; }); ((LayoutWidget<GridLayoutGroup>)(object)widget).AddChild<TextWidget>((Action<TextWidget>)delegate(TextWidget text) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) text.Text.text = ""; ((Transform)((UiWidget)text).RectTransform).localRotation = Quaternion.identity; }); ((LayoutWidget<GridLayoutGroup>)(object)widget).AddChild<ButtonWidget>((Action<ButtonWidget>)delegate(ButtonWidget button) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) button.ButtonText.text = GetTerm(UtilsBepInExLoader.paddleMagRelease.Value) + " Paddle Release"; button.AddButtonListener(new ButtonClickEvent(TogglePaddleRelease)); paddleMagReleaseButton = button; ((Component)button.ButtonText).transform.localRotation = Quaternion.identity; }); ((LayoutWidget<GridLayoutGroup>)(object)widget).AddChild<ButtonWidget>((Action<ButtonWidget>)delegate(ButtonWidget button) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) button.ButtonText.text = GetTerm(UtilsBepInExLoader.magDropRequiredRelease.Value) + " Mag Drop Required Release"; button.AddButtonListener(new ButtonClickEvent(ToggleMagRelease)); MagDropRequiredReleaseButton = button; ((Component)button.ButtonText).transform.localRotation = Quaternion.identity; }); ((LayoutWidget<GridLayoutGroup>)(object)widget).AddChild<ButtonWidget>((Action<ButtonWidget>)delegate(ButtonWidget button) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) button.ButtonText.text = GetTerm(UtilsBepInExLoader.SimpleControls.Value) + " Simple Controls"; button.AddButtonListener(new ButtonClickEvent(ToggleSimpleControls)); SimpleControls = button; ((Component)button.ButtonText).transform.localRotation = Quaternion.identity; }); }); } private void TogglePaddleRelease(object sender, ButtonClickEventArgs args) { UtilsBepInExLoader.paddleMagRelease.Value = !UtilsBepInExLoader.paddleMagRelease.Value; paddleMagReleaseButton.ButtonText.text = GetTerm(UtilsBepInExLoader.paddleMagRelease.Value) + " Paddle Release"; } private void ToggleMagRelease(object sender, ButtonClickEventArgs args) { UtilsBepInExLoader.magDropRequiredRelease.Value = !UtilsBepInExLoader.magDropRequiredRelease.Value; MagDropRequiredReleaseButton.ButtonText.text = GetTerm(UtilsBepInExLoader.magDropRequiredRelease.Value) + " Mag Drop Required Release"; } private void lockXRot(object sender, ButtonClickEventArgs args) { UtilsBepInExLoader.VehicleLockXRot.Value = !UtilsBepInExLoader.paddleMagRelease.Value; VehicleLockXRotButton.ButtonText.text = GetTerm(UtilsBepInExLoader.paddleMagRelease.Value) + " Vehicle X Lock"; } private void lockYRot(object sender, ButtonClickEventArgs args) { UtilsBepInExLoader.VehicleLockYRot.Value = !UtilsBepInExLoader.paddleMagRelease.Value; VehicleLockYRotButton.ButtonText.text = GetTerm(UtilsBepInExLoader.paddleMagRelease.Value) + " Vehicle Y Lock"; } private void lockZRot(object sender, ButtonClickEventArgs args) { UtilsBepInExLoader.VehicleLockZRot.Value = !UtilsBepInExLoader.paddleMagRelease.Value; VehicleLockZRotButton.ButtonText.text = GetTerm(UtilsBepInExLoader.paddleMagRelease.Value) + " Vehicle Z Lock"; } private void ToggleSimpleControls(object sender, ButtonClickEventArgs args) { UtilsBepInExLoader.SimpleControls.Value = !UtilsBepInExLoader.SimpleControls.Value; SimpleControls.ButtonText.text = GetTerm(UtilsBepInExLoader.SimpleControls.Value) + " Simple Controls"; } private void SpawnUtilsPanel(object sender, ButtonClickEventArgs args) { FVRWristMenu instance = WristMenuAPI.Instance; if (instance != null && Object.op_Implicit((Object)(object)instance)) { GameObject orCreatePanel = _UtilsPanel.GetOrCreatePanel(); instance.m_currentHand.RetrieveObject(orCreatePanel.GetComponent<FVRPhysicalObject>()); } } } } namespace H3VRUtilsConfig.patchers { public class patch_ClosedBoltWeapon { } }