Decompiled source of 84mm Additional v1.0.0

84mm_Additional.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using ShermanJumbo;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace VolksScripts
{
	public class ArmedMunition : MonoBehaviour
	{
		public enum StreamlinedArmButton
		{
			AX,
			BY
		}

		[Header("Round Reference")]
		public FVRFireArmRound ParentRound;

		[Header("Arming")]
		[Tooltip("Round class set when ARMED.")]
		public FireArmRoundClass ArmedRoundClass;

		[Tooltip("Round class restored when DISARMED. Set this to match the prefab's default class.")]
		public FireArmRoundClass UnarmedRoundClass;

		[Header("Visual")]
		[Tooltip("The renderer whose material is swapped on arm/disarm.")]
		public Renderer TargetRenderer;

		public Material UnarmedMaterial;

		public Material ArmedMaterial;

		[Header("Audio")]
		public AudioEvent AudEvent_Arm;

		public AudioEvent AudEvent_Disarm;

		[Header("Controls")]
		[Tooltip("Which streamlined mode button toggles the armed state.")]
		public StreamlinedArmButton ArmingButton = StreamlinedArmButton.AX;

		[Header("Debug")]
		public bool EnableDebug = false;

		private bool m_isArmed = false;

		private void Start()
		{
			ApplyState();
		}

		private void Update()
		{
			//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)
			//IL_00e2: 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)
			if ((Object)(object)ParentRound == (Object)null)
			{
				return;
			}
			FVRViveHand hand = ((FVRInteractiveObject)ParentRound).m_hand;
			if ((Object)(object)hand == (Object)null)
			{
				return;
			}
			if (hand.IsInStreamlinedMode)
			{
				if ((ArmingButton != StreamlinedArmButton.AX) ? hand.Input.BYButtonDown : hand.Input.AXButtonDown)
				{
					Toggle();
				}
			}
			else
			{
				if (!hand.Input.TouchpadDown || !(((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f))
				{
					return;
				}
				if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f)
				{
					if (!m_isArmed)
					{
						Toggle();
					}
				}
				else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f && m_isArmed)
				{
					Toggle();
				}
			}
		}

		private void Toggle()
		{
			//IL_0077: 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)
			m_isArmed = !m_isArmed;
			ApplyState();
			AudioEvent val = ((!m_isArmed) ? AudEvent_Disarm : AudEvent_Arm);
			if (val != null)
			{
				SM.PlayGenericSound(val, ((Component)this).transform.position);
			}
			DebugLog("Armed: " + m_isArmed + " — RoundClass: " + ParentRound.RoundClass);
		}

		private void ApplyState()
		{
			//IL_002f: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ParentRound != (Object)null)
			{
				ParentRound.RoundClass = ((!m_isArmed) ? UnarmedRoundClass : ArmedRoundClass);
			}
			if ((Object)(object)TargetRenderer != (Object)null)
			{
				TargetRenderer.material = ((!m_isArmed) ? UnarmedMaterial : ArmedMaterial);
			}
		}

		private void DebugLog(string msg)
		{
			if (EnableDebug)
			{
				Debug.Log((object)("[ArmedMunition] " + msg));
			}
		}
	}
}
public class AT4 : SimpleLauncher
{
	[Header("Trigger Settings")]
	public Transform Trigger;

	public Axis Trigger_Axis = (Axis)0;

	public Vector2 Trigger_ValRange = new Vector2(0f, 10f);

	private float m_triggerVal;

	[Header("Rocket Settings")]
	[HideInInspector]
	public bool hasFired = false;

	[Header("Self-Destruct")]
	public float DestroyDelay = 10f;

	private bool selfDestructStarted = false;

	public AT4ArmingLever ArmingLever;

	private void FireAT4()
	{
		if (base.Chamber.IsFull && !base.Chamber.IsSpent && !((Object)(object)ArmingLever == (Object)null) && ArmingLever.IsArmed)
		{
			base.Chamber.Fire();
			((FVRFireArm)this).FireMuzzleSmoke();
			hasFired = true;
			StartSelfDestructCheck();
		}
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Expected I4, but got Unknown
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected I4, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ArmingLever != (Object)null && !ArmingLever.IsArmed)
		{
			if ((Object)(object)Trigger != (Object)null && (Object)(object)hand != (Object)null)
			{
				Vector3 localPosition = Trigger.localPosition;
				((Vector3)(ref localPosition))[(int)Trigger_Axis] = Mathf.Lerp(Trigger_ValRange.x, Trigger_ValRange.y, hand.Input.TriggerFloat);
				Trigger.localPosition = localPosition;
			}
			return;
		}
		((SimpleLauncher)this).UpdateInteraction(hand);
		if ((Object)(object)Trigger != (Object)null && (Object)(object)hand != (Object)null)
		{
			Vector3 localPosition2 = Trigger.localPosition;
			((Vector3)(ref localPosition2))[(int)Trigger_Axis] = Mathf.Lerp(Trigger_ValRange.x, Trigger_ValRange.y, hand.Input.TriggerFloat);
			Trigger.localPosition = localPosition2;
		}
		if ((Object)(object)ArmingLever != (Object)null && ArmingLever.IsArmed && !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)hand != (Object)null && hand.Input.TriggerDown && !hasFired && base.Chamber.IsFull && !base.Chamber.IsSpent)
		{
			FireAT4();
		}
		if ((!base.Chamber.IsFull || hasFired) && !selfDestructStarted && !((FVRInteractiveObject)this).IsHeld)
		{
			StartSelfDestructCheck();
		}
	}

	private void StartSelfDestructCheck()
	{
		if (!selfDestructStarted)
		{
			selfDestructStarted = true;
			((MonoBehaviour)this).StartCoroutine(SelfDestructCheck());
		}
	}

	private IEnumerator SelfDestructCheck()
	{
		float timer = 0f;
		while (timer < DestroyDelay)
		{
			if (!((FVRInteractiveObject)this).IsHeld)
			{
				timer += Time.deltaTime;
			}
			yield return null;
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class AT4ArmingLever : FVRInteractiveObject
{
	public AT4 Weapon;

	[Header("Lever Movement")]
	public Transform LeverRoot;

	public Transform ForwardPoint;

	public Transform RearPoint;

	[Header("Arming Settings")]
	public float ArmThreshold = 0.9f;

	[Header("Lever Rotation Settings")]
	[Tooltip("Which local axis to rotate around: 0=X, 1=Y, 2=Z")]
	public int RotationAxis = 1;

	[Tooltip("Starting rotation (degrees) for the selected axis.")]
	public float StartRotation = 0f;

	[Tooltip("Ending rotation (degrees) for the selected axis.")]
	public float EndRotation = 45f;

	[Tooltip("How far right (in local X units) the hand must move for full rotation.")]
	public float MaxRightOffset = 0.1f;

	private bool isArmed = false;

	private float leverProgress = 0f;

	private Vector3 startLocalPos;

	private Vector3 endLocalPos;

	public bool IsArmed => isArmed;

	public override void Awake()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).Awake();
		if ((Object)(object)LeverRoot != (Object)null && (Object)(object)ForwardPoint != (Object)null && (Object)(object)RearPoint != (Object)null)
		{
			startLocalPos = RearPoint.localPosition;
			endLocalPos = ForwardPoint.localPosition;
		}
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).UpdateInteraction(hand);
		if ((Object)(object)LeverRoot == (Object)null || (Object)(object)ForwardPoint == (Object)null || (Object)(object)RearPoint == (Object)null || (Object)(object)Weapon == (Object)null)
		{
			return;
		}
		Vector3 position = RearPoint.position;
		Vector3 position2 = ForwardPoint.position;
		Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(position, position2, ((HandInput)(ref hand.Input)).Pos);
		float num = Vector3.Distance(position, closestValidPoint) / Vector3.Distance(position, position2);
		num = Mathf.Clamp01(num);
		if (num < 1f)
		{
			LeverRoot.position = closestValidPoint;
			leverProgress = num;
			SetLeverRotation(StartRotation);
		}
		else
		{
			LeverRoot.position = position2;
			float num2 = Mathf.Clamp(ForwardPoint.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).x, 0f - MaxRightOffset, MaxRightOffset);
			float num3 = ((!(MaxRightOffset > 0f)) ? 0f : ((num2 + MaxRightOffset) / (2f * MaxRightOffset)));
			float leverRotation = Mathf.Lerp(StartRotation, EndRotation, num3);
			SetLeverRotation(leverRotation);
			leverProgress = 1f;
		}
		if (!isArmed && leverProgress >= ArmThreshold)
		{
			isArmed = true;
			if ((Object)(object)Weapon != (Object)null)
			{
				((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)12, 1f);
			}
		}
		else if (isArmed && leverProgress < 0.2f)
		{
			isArmed = false;
		}
	}

	private void SetLeverRotation(float angle)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		Vector3 zero = Vector3.zero;
		if (RotationAxis == 0)
		{
			zero.x = angle;
		}
		else if (RotationAxis == 1)
		{
			zero.y = angle;
		}
		else
		{
			zero.z = angle;
		}
		LeverRoot.localRotation = Quaternion.Euler(zero);
	}

	public override void EndInteraction(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_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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: 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)
		((FVRInteractiveObject)this).EndInteraction(hand);
		Vector3 position = RearPoint.position;
		Vector3 position2 = ForwardPoint.position;
		float num = Vector3.Distance(LeverRoot.position, position);
		float num2 = Vector3.Distance(LeverRoot.position, position2);
		if (num2 < num)
		{
			LeverRoot.position = position2;
			SetLeverRotation(EndRotation);
		}
		else
		{
			LeverRoot.position = position;
			SetLeverRotation(StartRotation);
		}
	}
}
public class AT4SightCover : FVRInteractiveObject
{
	[Header("Sight References")]
	public Transform Sight;

	public Transform Cover;

	public Transform CoverRearPos;

	public Transform CoverForwardPos;

	[Header("Sight Local Positions & Rotations")]
	public Vector3 SightDownLocalPos;

	public Vector3 SightUpLocalPos;

	public Vector3 SightDownRot;

	public Vector3 SightUpRot;

	[Header("Interaction Settings")]
	[Range(0f, 1f)]
	public float CoverThreshold = 0.95f;

	private bool sightUp = false;

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0047: 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_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_008a: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: 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_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: 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_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).UpdateInteraction(hand);
		if (!((Object)(object)Sight == (Object)null) && !((Object)(object)CoverRearPos == (Object)null) && !((Object)(object)CoverForwardPos == (Object)null))
		{
			Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(CoverRearPos.position, CoverForwardPos.position, ((HandInput)(ref hand.Input)).Pos);
			float num = Vector3.Distance(CoverRearPos.position, closestValidPoint) / Vector3.Distance(CoverRearPos.position, CoverForwardPos.position);
			num = Mathf.Clamp01(num);
			if ((Object)(object)Cover != (Object)null)
			{
				Cover.position = Vector3.Lerp(CoverRearPos.position, CoverForwardPos.position, num);
			}
			else
			{
				((Component)this).transform.position = Vector3.Lerp(CoverRearPos.position, CoverForwardPos.position, num);
			}
			Sight.localPosition = Vector3.Lerp(SightDownLocalPos, SightUpLocalPos, num);
			Sight.localEulerAngles = Vector3.Lerp(SightDownRot, SightUpRot, num);
			if (num >= CoverThreshold && !sightUp)
			{
				sightUp = true;
			}
			else if (num < CoverThreshold && sightUp)
			{
				sightUp = false;
			}
		}
	}
}
public class Arwen : FVRFireArm
{
	[Header("Arwen 37mm Config")]
	public ArwenCylinder Cylinder;

	public FVRFireArmChamber[] Chambers;

	[Header("Trigger")]
	public Transform Trigger;

	[Tooltip("Trigger float value at which the weapon fires (DAO pull depth).")]
	public float TriggerFiringThreshold = 0.95f;

	[Tooltip("Trigger float value below which a spent shell ejects on release.")]
	public float TriggerEjectThreshold = 0.35f;

	[Tooltip("Trigger float value below which the trigger is considered fully reset.")]
	public float TriggerResetThreshold = 0.1f;

	public bool TriggerUsesRotation = true;

	public Vector3 TriggerRotationAxis = Vector3.right;

	public float TriggerMinAngle = 0f;

	public float TriggerMaxAngle = 30f;

	public bool TriggerUsesTranslation = false;

	public Vector3 TriggerTranslationAxis = Vector3.back;

	public float TriggerMinPosition = 0f;

	public float TriggerMaxPosition = 0.02f;

	[Header("Hammer")]
	public Transform Hammer;

	public bool HammerUsesRotation = true;

	public Vector3 HammerRotationAxis = Vector3.right;

	public float HammerMinAngle = 0f;

	public float HammerMaxAngle = 45f;

	public bool HammerUsesTranslation = false;

	public Vector3 HammerTranslationAxis = Vector3.back;

	public float HammerMinPosition = 0f;

	public float HammerMaxPosition = 0.01f;

	[Header("Bolt (animates forward→rear as trigger pulls)")]
	public Transform BoltTransform;

	public Transform Point_Bolt_Forward;

	public Transform Point_Bolt_Rear;

	[Header("Chamber Feed")]
	[Tooltip("How far (metres) the round nudges forward into the barrel as the trigger pulls.")]
	public float ChamberFeedDistance = 0.005f;

	[Header("Ejection")]
	public Transform EjectionPos;

	public Vector3 EjectionVelocity = new Vector3(0.2f, 0.5f, 0f);

	public Vector3 EjectionSpin = new Vector3(0f, 200f, 0f);

	[Header("Cylinder")]
	public float CylinderRotateDuration = 0.2f;

	[Header("Safety")]
	public Transform SafetySwitchLeft;

	public Transform SafetySwitchRight;

	public InterpStyle SafetyInterpStyle = (InterpStyle)1;

	public Axis SafetyAxis;

	public float SafetyPosition_Fire = 0f;

	public float SafetyPosition_Safe = 45f;

	private int m_curChamber = 0;

	private bool m_isSafetyOn = false;

	private bool m_hasTriggerCycled = false;

	private bool m_hasFired = false;

	private bool m_hasDryFired = false;

	private bool m_hasSafetyToggled = false;

	private bool m_isRestoringState = false;

	private bool[] m_prevChamberFull;

	private bool[] m_prevChamberPresent;

	private Coroutine m_cylinderCoroutine;

	public override void Awake()
	{
		((FVRFireArm)this).Awake();
		if (Chambers != null)
		{
			for (int i = 0; i < Chambers.Length; i++)
			{
				base.FChambers.Add(Chambers[i]);
			}
		}
		int num = ((Chambers != null) ? Chambers.Length : 0);
		m_prevChamberFull = new bool[num];
		m_prevChamberPresent = new bool[num];
		for (int j = 0; j < num; j++)
		{
			if (!((Object)(object)Chambers[j] == (Object)null))
			{
				m_prevChamberFull[j] = Chambers[j].IsFull && !Chambers[j].IsSpent;
				m_prevChamberPresent[j] = Chambers[j].IsFull;
			}
		}
		SetAllChambersAccessible(accessible: true);
		UpdateSafetyVisual();
	}

	public override void FVRUpdate()
	{
		((FVRFireArm)this).FVRUpdate();
		if (!m_isRestoringState)
		{
			DetectShellLoaded();
		}
	}

	private void DetectShellLoaded()
	{
		if (Chambers == null)
		{
			return;
		}
		for (int i = 0; i < Chambers.Length; i++)
		{
			bool flag = Chambers[i].IsFull && !Chambers[i].IsSpent;
			bool isFull = Chambers[i].IsFull;
			if (flag && !m_prevChamberFull[i])
			{
				OnShellLoaded();
			}
			if (!isFull && m_prevChamberPresent[i])
			{
				OnShellRemoved(i);
			}
			m_prevChamberFull[i] = flag;
			m_prevChamberPresent[i] = isFull;
		}
	}

	private void OnShellLoaded()
	{
		RotateToChamber(m_curChamber = (m_curChamber - 1 + Chambers.Length) % Chambers.Length);
		((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)20, 1f);
	}

	private void OnShellRemoved(int chamberIndex)
	{
		if (chamberIndex == m_curChamber)
		{
			int num = FindNextLoadedChamberClockwise();
			if (num != m_curChamber)
			{
				RotateToChamber(num);
				m_curChamber = num;
			}
		}
	}

	private int FindNextLoadedChamberClockwise()
	{
		for (int i = 1; i < Chambers.Length; i++)
		{
			int num = (m_curChamber + i) % Chambers.Length;
			if (Chambers[num].IsFull && !Chambers[num].IsSpent)
			{
				return num;
			}
		}
		return m_curChamber;
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		((FVRPhysicalObject)this).UpdateInteraction(hand);
		if (!((Object)(object)hand == (Object)null))
		{
			float triggerFloat = hand.Input.TriggerFloat;
			UpdateTriggerVisual(triggerFloat);
			UpdateHammerVisual(triggerFloat);
			UpdateBoltVisual(triggerFloat);
			UpdateChamberFeedVisual(triggerFloat);
			HandleSafetyInput(hand);
			if (m_hasFired && triggerFloat < TriggerEjectThreshold)
			{
				EjectCurrentChamber();
				AdvanceChamberClockwise();
				m_hasFired = false;
			}
			if (m_hasDryFired && triggerFloat < TriggerResetThreshold)
			{
				AdvanceChamberClockwise();
				m_hasDryFired = false;
			}
			if (!m_isSafetyOn && triggerFloat >= TriggerFiringThreshold && !m_hasTriggerCycled)
			{
				FireOrDryFire();
				m_hasTriggerCycled = true;
			}
			if (triggerFloat < TriggerResetThreshold && m_hasTriggerCycled)
			{
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
				m_hasTriggerCycled = false;
			}
		}
	}

	private void FireOrDryFire()
	{
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		FVRFireArmChamber val = Chambers[m_curChamber];
		if (val.IsFull && !val.IsSpent)
		{
			val.Fire();
			((FVRFireArm)this).Fire(val, (!((Object)(object)base.MuzzlePos != (Object)null)) ? ((Component)this).transform : base.MuzzlePos, true, 1f, -1f);
			((FVRFireArm)this).FireMuzzleSmoke();
			((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f);
			((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
			if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
			{
				val.IsSpent = false;
				val.UpdateProxyDisplay();
			}
			m_hasFired = true;
		}
		else
		{
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
			m_hasDryFired = true;
		}
	}

	private void EjectCurrentChamber()
	{
		//IL_0074: 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_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: 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)
		FVRFireArmChamber val = Chambers[m_curChamber];
		if (val.IsFull)
		{
			if ((Object)(object)EjectionPos != (Object)null)
			{
				val.EjectRound(EjectionPos.position, EjectionVelocity, EjectionSpin, EjectionPos.position, EjectionPos.rotation, false);
			}
			else
			{
				val.EjectRound(((Component)val).transform.position + ((Component)val).transform.forward * 0.1f, ((Component)val).transform.forward * 3f + Vector3.up * 1.5f, Vector3.up * 200f, true);
			}
		}
	}

	private void AdvanceChamberClockwise()
	{
		int num = (m_curChamber + 1) % Chambers.Length;
		RotateToChamber(num);
		m_curChamber = num;
	}

	private void RotateToChamber(int index)
	{
		if (m_cylinderCoroutine != null)
		{
			((MonoBehaviour)this).StopCoroutine(m_cylinderCoroutine);
		}
		m_cylinderCoroutine = ((MonoBehaviour)this).StartCoroutine(RotateCylinderTo(index));
	}

	private IEnumerator RotateCylinderTo(int toIndex)
	{
		if (!((Object)(object)Cylinder == (Object)null))
		{
			Quaternion from = ((Component)Cylinder).transform.localRotation;
			Quaternion to = Cylinder.GetLocalRotationFromCylinder(toIndex);
			float elapsed = 0f;
			float dur = Mathf.Max(0.01f, CylinderRotateDuration);
			while (elapsed < 1f)
			{
				elapsed += Time.deltaTime / dur;
				((Component)Cylinder).transform.localRotation = Quaternion.Slerp(from, to, elapsed);
				yield return null;
			}
			((Component)Cylinder).transform.localRotation = to;
		}
	}

	public void StopCylinderRotation()
	{
		if (m_cylinderCoroutine != null)
		{
			((MonoBehaviour)this).StopCoroutine(m_cylinderCoroutine);
			m_cylinderCoroutine = null;
		}
	}

	public void SyncChamberFromCylinder()
	{
		if ((Object)(object)Cylinder != (Object)null)
		{
			m_curChamber = Cylinder.GetClosestChamberIndex();
		}
	}

	private void UpdateTriggerVisual(float t)
	{
		//IL_003b: 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_0061: 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)
		if (!((Object)(object)Trigger == (Object)null))
		{
			if (TriggerUsesRotation)
			{
				Trigger.localRotation = Quaternion.AngleAxis(Mathf.Lerp(TriggerMinAngle, TriggerMaxAngle, t), TriggerRotationAxis);
			}
			if (TriggerUsesTranslation)
			{
				Trigger.localPosition = ((Vector3)(ref TriggerTranslationAxis)).normalized * Mathf.Lerp(TriggerMinPosition, TriggerMaxPosition, t);
			}
		}
	}

	private void UpdateHammerVisual(float t)
	{
		//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_0078: 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)
		if (!((Object)(object)Hammer == (Object)null))
		{
			float num = ((!m_isSafetyOn) ? t : 0f);
			if (HammerUsesRotation)
			{
				Hammer.localRotation = Quaternion.AngleAxis(Mathf.Lerp(HammerMinAngle, HammerMaxAngle, num), HammerRotationAxis);
			}
			if (HammerUsesTranslation)
			{
				Hammer.localPosition = ((Vector3)(ref HammerTranslationAxis)).normalized * Mathf.Lerp(HammerMinPosition, HammerMaxPosition, num);
			}
		}
	}

	private void UpdateBoltVisual(float t)
	{
		//IL_005c: 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_006d: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)BoltTransform == (Object)null) && !((Object)(object)Point_Bolt_Forward == (Object)null) && !((Object)(object)Point_Bolt_Rear == (Object)null))
		{
			float num = ((!m_isSafetyOn) ? t : 0f);
			BoltTransform.localPosition = Vector3.Lerp(Point_Bolt_Forward.localPosition, Point_Bolt_Rear.localPosition, num);
		}
	}

	private void UpdateChamberFeedVisual(float t)
	{
		//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_0080: 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)
		if (Chambers != null && m_curChamber < Chambers.Length)
		{
			FVRFireArmChamber val = Chambers[m_curChamber];
			if (val.IsFull && !((Object)(object)val.ProxyRound == (Object)null))
			{
				float num = ((!m_isSafetyOn) ? t : 0f);
				val.ProxyRound.localPosition = Vector3.Lerp(Vector3.zero, Vector3.forward * ChamberFeedDistance, num);
			}
		}
	}

	private void HandleSafetyInput(FVRViveHand hand)
	{
		//IL_0072: 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_0089: 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)
		if (hand.IsInStreamlinedMode)
		{
			if (hand.Input.BYButtonDown && !m_hasSafetyToggled)
			{
				ToggleSafety();
				m_hasSafetyToggled = true;
			}
			else if (!hand.Input.BYButtonDown)
			{
				m_hasSafetyToggled = false;
			}
		}
		else if (hand.Input.TouchpadDown)
		{
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.left) < 45f)
			{
				ToggleSafety();
			}
		}
	}

	private void ToggleSafety()
	{
		m_isSafetyOn = !m_isSafetyOn;
		UpdateSafetyVisual();
		((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
	}

	private void UpdateSafetyVisual()
	{
		//IL_0038: 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_0062: 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)
		float num = ((!m_isSafetyOn) ? SafetyPosition_Fire : SafetyPosition_Safe);
		if ((Object)(object)SafetySwitchLeft != (Object)null)
		{
			((FVRPhysicalObject)this).SetAnimatedComponent(SafetySwitchLeft, num, SafetyInterpStyle, SafetyAxis);
		}
		if ((Object)(object)SafetySwitchRight != (Object)null)
		{
			((FVRPhysicalObject)this).SetAnimatedComponent(SafetySwitchRight, num, SafetyInterpStyle, SafetyAxis);
		}
	}

	private void SetAllChambersAccessible(bool accessible)
	{
		if (Chambers == null)
		{
			return;
		}
		for (int i = 0; i < Chambers.Length; i++)
		{
			if ((Object)(object)Chambers[i] != (Object)null)
			{
				Chambers[i].IsAccessible = accessible;
			}
		}
	}

	public override List<FireArmRoundClass> GetChamberRoundList()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		bool flag = false;
		List<FireArmRoundClass> list = new List<FireArmRoundClass>();
		for (int i = 0; i < Chambers.Length; i++)
		{
			if (Chambers[i].IsFull && !Chambers[i].IsSpent)
			{
				list.Add(Chambers[i].GetRound().RoundClass);
				flag = true;
			}
			else
			{
				list.Add((FireArmRoundClass)(-1));
			}
		}
		return (!flag) ? null : list;
	}

	public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Invalid comparison between Unknown and I4
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		if (rounds == null)
		{
			return;
		}
		m_isRestoringState = true;
		for (int i = 0; i < rounds.Count && i < Chambers.Length; i++)
		{
			if ((int)rounds[i] >= 0)
			{
				Chambers[i].Autochamber(rounds[i]);
			}
		}
		for (int j = 0; j < Chambers.Length; j++)
		{
			m_prevChamberFull[j] = Chambers[j].IsFull && !Chambers[j].IsSpent;
			m_prevChamberPresent[j] = Chambers[j].IsFull;
		}
		m_isRestoringState = false;
	}
}
public class ArwenCylinder : FVRInteractiveObject
{
	[Header("Arwen Cylinder Config")]
	public Arwen Arwen;

	public int numChambers = 5;

	private float m_fakeAngularVel;

	public override void Awake()
	{
		((FVRInteractiveObject)this).Awake();
	}

	public override bool IsInteractable()
	{
		return true;
	}

	public override void BeginInteraction(FVRViveHand hand)
	{
		((FVRInteractiveObject)this).BeginInteraction(hand);
		if ((Object)(object)Arwen != (Object)null)
		{
			Arwen.StopCylinderRotation();
		}
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//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_0039: 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_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).UpdateInteraction(hand);
		if (!((Object)(object)Arwen == (Object)null))
		{
			float num = (0f - ((Component)Arwen).transform.InverseTransformDirection(hand.Input.VelLinearWorld).y) * 120f;
			((Component)this).transform.localEulerAngles = new Vector3(0f, 0f, ((Component)this).transform.localEulerAngles.z + num);
			m_fakeAngularVel = Mathf.Clamp(num, -360f, 360f);
		}
	}

	public override void EndInteraction(FVRViveHand hand)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Arwen != (Object)null)
		{
			m_fakeAngularVel = Mathf.Clamp((0f - ((Component)Arwen).transform.InverseTransformDirection(hand.Input.VelLinearWorld).y) * 120f, -360f, 360f);
			Arwen.SyncChamberFromCylinder();
		}
		((FVRInteractiveObject)this).EndInteraction(hand);
	}

	public override void FVRUpdate()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).FVRUpdate();
		if (!((FVRInteractiveObject)this).IsHeld && Mathf.Abs(m_fakeAngularVel) > 0.01f)
		{
			((Component)this).transform.localEulerAngles = new Vector3(0f, 0f, ((Component)this).transform.localEulerAngles.z + m_fakeAngularVel);
			m_fakeAngularVel = Mathf.Lerp(m_fakeAngularVel, 0f, Time.deltaTime * 0.8f);
		}
		else if (!((FVRInteractiveObject)this).IsHeld)
		{
			m_fakeAngularVel = 0f;
		}
	}

	public int GetClosestChamberIndex()
	{
		//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)
		float num = 0f - ((Component)this).transform.localEulerAngles.z;
		num += 360f / (float)numChambers * 0.5f;
		num = Mathf.Repeat(num, 360f);
		return Mathf.Clamp(Mathf.CeilToInt(num / (360f / (float)numChambers)) - 1, 0, numChambers - 1);
	}

	public Quaternion GetLocalRotationFromCylinder(int cylinder)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Repeat((float)cylinder * (360f / (float)numChambers) * -1f, 360f);
		return Quaternion.Euler(0f, 0f, num);
	}
}
public class BouncingBetty : PinnedGrenade
{
	[Header("Betty Settings")]
	public float BounceHeight = 2f;

	public float ExplosionDelay = 0.5f;

	public float ArmDelay = 0.4f;

	[Header("Proximity Settings")]
	public float ProxRange = 3f;

	public LayerMask LM_Prox;

	[Header("Parts")]
	public GameObject BottomPartToDisable;

	public AudioEvent LaunchSound;

	public AudioEvent ArmSound;

	[Header("Stick Settings")]
	[Tooltip("Point Z to direction to check. If an layer object is within 0.05m from the raycastdir, it will lock.")]
	public Transform RaycastDir;

	public LayerMask StickLayer;

	[Tooltip("If velocity is below this, it will allow it to lock.")]
	public float MinStickVelocity = 0.1f;

	private bool isArmed = false;

	private bool isSet = false;

	private bool hasBounced = false;

	private bool beginCountdown = false;

	private float timer = 0f;

	private bool timerReached = false;

	private bool hasExploded = false;

	private bool isPinPulled = false;

	private bool isStuck = false;

	private bool isLocked = false;

	private Vector3 stuckNormal;

	private Transform stuckToSurface;

	public override void Awake()
	{
		((PinnedGrenade)this).Awake();
		base.m_isLeverReleased = true;
		base.m_isFused = false;
		base.m_fuseTime = float.MaxValue;
		base.m_startFuseTime = float.MaxValue;
		base.FuseOnSpawn = false;
		if ((Object)(object)base.FakeHandle != (Object)null)
		{
			base.FakeHandle.SetActive(false);
		}
		if ((Object)(object)base.RealHandle != (Object)null)
		{
			base.RealHandle.SetActive(false);
		}
		if ((Object)(object)base.LeverJoint != (Object)null)
		{
			Object.Destroy((Object)(object)base.LeverJoint);
		}
	}

	public override void FVRUpdate()
	{
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		((PinnedGrenade)this).FVRUpdate();
		if (base.m_rings.Count > 0)
		{
			isPinPulled = true;
			foreach (PinnedGrenadeRing ring in base.m_rings)
			{
				if (!ring.HasPinDetached())
				{
					isPinPulled = false;
				}
			}
		}
		if (!isPinPulled || isStuck || !((FVRInteractiveObject)this).IsHeld)
		{
		}
		if (isStuck && !beginCountdown && !isArmed)
		{
			BeginArming();
		}
		if (beginCountdown && !timerReached)
		{
			timer += Time.deltaTime;
			if (timer >= ArmDelay)
			{
				isSet = true;
				beginCountdown = false;
				timerReached = true;
				isArmed = true;
			}
		}
		if (isSet && isArmed && !hasBounced && !hasExploded)
		{
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, ProxRange, LayerMask.op_Implicit(LM_Prox));
			if (array.Length > 0)
			{
				hasBounced = true;
				((MonoBehaviour)this).StartCoroutine(BounceAndExplode());
			}
		}
	}

	public override void OnCollisionEnter(Collision collision)
	{
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		if (isPinPulled && !isStuck && !((FVRInteractiveObject)this).IsHeld && ((1 << collision.gameObject.layer) & (LayerMask.GetMask(new string[1] { "Default" }) | LayerMask.GetMask(new string[1] { "Environment" }))) != 0)
		{
			ContactPoint val = collision.contacts[0];
			((Component)this).transform.position = ((ContactPoint)(ref val)).point;
			stuckNormal = ((ContactPoint)(ref val)).normal;
			stuckToSurface = collision.transform;
			Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.isKinematic = true;
				component.velocity = Vector3.zero;
				component.angularVelocity = Vector3.zero;
			}
			isStuck = true;
			if ((Object)(object)BottomPartToDisable != (Object)null)
			{
				BottomPartToDisable.SetActive(false);
			}
		}
	}

	private void BeginArming()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		beginCountdown = true;
		timer = 0f;
		if (ArmSound != null)
		{
			SM.PlayCoreSound((FVRPooledAudioType)0, ArmSound, ((Component)this).transform.position);
		}
	}

	private IEnumerator BounceAndExplode()
	{
		Rigidbody rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)rb == (Object)null)
		{
			rb = ((Component)this).gameObject.AddComponent<Rigidbody>();
		}
		rb.isKinematic = false;
		float bounceVel = Mathf.Sqrt(19.62f * BounceHeight);
		rb.velocity = Vector3.zero;
		rb.AddForce(Vector3.up * bounceVel, (ForceMode)2);
		if (LaunchSound != null)
		{
			SM.PlayCoreSound((FVRPooledAudioType)0, LaunchSound, ((Component)this).transform.position);
		}
		yield return (object)new WaitForSeconds(ExplosionDelay);
		TriggerExplosion();
	}

	private void TriggerExplosion()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		if (hasExploded)
		{
			return;
		}
		hasExploded = true;
		for (int i = 0; i < base.SpawnOnSplode.Count; i++)
		{
			GameObject val = Object.Instantiate<GameObject>(base.SpawnOnSplode[i], ((Component)this).transform.position, Quaternion.identity);
			Explosion component = val.GetComponent<Explosion>();
			if ((Object)(object)component != (Object)null)
			{
				component.IFF = base.IFF;
			}
			ExplosionSound component2 = val.GetComponent<ExplosionSound>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.IFF = base.IFF;
			}
			GrenadeExplosion component3 = val.GetComponent<GrenadeExplosion>();
			if ((Object)(object)component3 != (Object)null)
			{
				component3.IFF = base.IFF;
			}
		}
		if ((Object)(object)base.SmokeEmitter != (Object)null)
		{
			base.SmokeEmitter.Engaged = true;
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}

	private void OnDrawGizmosSelected()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		Gizmos.color = Color.red;
		Gizmos.DrawWireSphere(((Component)this).transform.position, ProxRange);
	}

	public override void FVRFixedUpdate()
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		((PinnedGrenade)this).FVRFixedUpdate();
		base.m_isImpactFuseActive = false;
		base.m_impactFuseBurnDown = float.MaxValue;
		Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)component != (Object)null && !isStuck && isPinPulled && !((FVRInteractiveObject)this).IsHeld)
		{
			Vector3 velocity = component.velocity;
			RaycastHit val = default(RaycastHit);
			if (((Vector3)(ref velocity)).magnitude <= MinStickVelocity && (Object)(object)RaycastDir != (Object)null && Physics.Raycast(RaycastDir.position, RaycastDir.forward, ref val, 2f, LayerMask.op_Implicit(StickLayer)))
			{
				isStuck = true;
				isLocked = true;
				component.isKinematic = true;
				component.velocity = Vector3.zero;
				component.angularVelocity = Vector3.zero;
				((Component)this).transform.position = ((RaycastHit)(ref val)).point;
				stuckNormal = ((RaycastHit)(ref val)).normal;
				stuckToSurface = ((RaycastHit)(ref val)).transform;
				if ((Object)(object)BottomPartToDisable != (Object)null)
				{
					BottomPartToDisable.SetActive(false);
				}
			}
		}
		if (isLocked && ((FVRInteractiveObject)this).IsHeld)
		{
			isLocked = false;
			if ((Object)(object)component != (Object)null)
			{
				component.isKinematic = false;
			}
		}
	}
}
namespace VolksScripts
{
	public class BreacherDrone : FVRPhysicalObject, IFVRDamageable
	{
		[Serializable]
		public class WingAnimator
		{
			public Transform Wing;

			public Vector3 FoldedLocalEulers = Vector3.zero;

			public Vector3 DeployedLocalEulers = new Vector3(0f, 0f, 90f);

			[Tooltip("How fast the wing moves (0→1 per second). 2 = fully deployed in 0.5s.")]
			public float AnimSpeed = 2f;
		}

		[Serializable]
		public class PropellerSpinner
		{
			public enum SpinAxis
			{
				X,
				Y,
				Z
			}

			public Transform Propeller;

			public SpinAxis Axis = SpinAxis.Y;

			[Tooltip("Max spin speed in degrees per second.")]
			public float MaxSpinSpeed = 1800f;

			[Tooltip("How fast spin ramps up/down (degrees per second squared).")]
			public float RampSpeed = 900f;

			[HideInInspector]
			public float CurrentSpeed = 0f;
		}

		[Header("Wings & Propellers")]
		public List<WingAnimator> Wings = new List<WingAnimator>();

		public List<PropellerSpinner> Propellers = new List<PropellerSpinner>();

		[Header("Activation Effects")]
		[Tooltip("Mesh GameObject toggled ON when the drone is activated (e.g. an LED or glow mesh).")]
		public GameObject ActivatedMesh;

		public AudioSource ActivationSound;

		public AudioSource PropellerLoopSound;

		[Header("Flight")]
		[Tooltip("Continuous thrust force (N) in the drone's forward direction while flying.")]
		public float ThrustForce = 5f;

		[Tooltip("Radius of the forward SphereCast used to detect impacts. Increase if drone tunnels through thin walls.")]
		public float ImpactCheckRadius = 0.05f;

		[Tooltip("Minimum lookahead distance (metres) for the impact SphereCast. Automatically scales with speed.")]
		public float ImpactCheckDistance = 0.15f;

		[Header("Arm Delay")]
		[Tooltip("Seconds after launch before collision can trigger detonation. Prevents accidental explosion on release.")]
		public float ArmDelay = 1f;

		[Header("Explosion — Collision")]
		[Tooltip("Layers that trigger detonation on contact once armed.")]
		public LayerMask ExplosionLayerMask;

		[Tooltip("If true, any collision triggers detonation instead of only matching layers.")]
		public bool ExplodeOnAnyCollision = false;

		[Header("Explosion — Timer")]
		[Tooltip("Seconds after launch before auto-detonation. 0 = disabled.")]
		public float AutoDestructTime = 15f;

		[Header("Explosion — Beeping")]
		[Tooltip("AudioSource for the beep (short one-shot clip). Assigned on the GameObject — NOT pooled.")]
		public AudioSource BeepAudioSource;

		[Tooltip("Remaining seconds on the timer at which beeping begins.")]
		public float BeepStartAtSeconds = 5f;

		public float BeepPitchStart = 1f;

		public float BeepPitchEnd = 2f;

		[Tooltip("Beep interval at start (seconds).")]
		public float BeepRefireStart = 0.8f;

		[Tooltip("Beep interval at end (seconds).")]
		public float BeepRefireEnd = 0.05f;

		[Header("Explosion — Shot")]
		public bool ExplodeOnShot = true;

		public float ShotDamageThreshold = 10f;

		[Header("Explosion — Payload")]
		public List<GameObject> SpawnOnExplode = new List<GameObject>();

		public int IFF;

		[Header("Debug")]
		public bool EnableDebug = false;

		private bool m_isActivated = false;

		private bool m_isLaunched = false;

		private bool m_hasExploded = false;

		private bool m_isArmed = false;

		private float m_armTimer = 0f;

		private float m_autoDestructTimer = 0f;

		private float m_beepTimer = 0f;

		private float[] m_wingLerps;

		private Vector3 m_prevFixedPos;

		public override void Awake()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b1: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).Awake();
			Collider component = ((Component)this).GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Bounds bounds = component.bounds;
				Vector3 extents = ((Bounds)(ref bounds)).extents;
				ImpactCheckRadius = ((Vector3)(ref extents)).magnitude * 0.5f;
			}
			m_prevFixedPos = ((Component)this).transform.position;
			m_wingLerps = new float[Wings.Count];
			for (int i = 0; i < Wings.Count; i++)
			{
				m_wingLerps[i] = 0f;
				if ((Object)(object)Wings[i].Wing != (Object)null)
				{
					Wings[i].Wing.localEulerAngles = Wings[i].FoldedLocalEulers;
				}
			}
			if ((Object)(object)ActivatedMesh != (Object)null)
			{
				ActivatedMesh.SetActive(false);
			}
			if ((Object)(object)PropellerLoopSound != (Object)null)
			{
				PropellerLoopSound.Stop();
			}
			if ((Object)(object)BeepAudioSource != (Object)null)
			{
				BeepAudioSource.Stop();
			}
		}

		private void OnDrawGizmosSelected()
		{
			//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_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_006f: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			Gizmos.color = new Color(1f, 0.4f, 0f, 0.35f);
			Gizmos.DrawSphere(((Component)this).transform.position, ImpactCheckRadius);
			Gizmos.color = new Color(1f, 0.4f, 0f, 0.9f);
			Gizmos.DrawWireSphere(((Component)this).transform.position, ImpactCheckRadius);
			Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * ImpactCheckDistance;
			Gizmos.color = new Color(1f, 0.8f, 0f, 0.9f);
			Gizmos.DrawLine(((Component)this).transform.position, val);
			Gizmos.DrawWireSphere(val, ImpactCheckRadius);
			Handles.color = new Color(1f, 0.8f, 0f, 0.5f);
			Handles.Label(val + Vector3.up * (ImpactCheckRadius + 0.05f), "Impact lookahead: " + ImpactCheckDistance.ToString("F2") + "m");
		}

		public void ToggleActivation()
		{
			if (m_hasExploded || m_isLaunched)
			{
				return;
			}
			m_isActivated = !m_isActivated;
			if (m_isActivated)
			{
				if ((Object)(object)ActivatedMesh != (Object)null)
				{
					ActivatedMesh.SetActive(true);
				}
				if ((Object)(object)ActivationSound != (Object)null)
				{
					ActivationSound.Stop();
					ActivationSound.Play();
				}
				if ((Object)(object)PropellerLoopSound != (Object)null)
				{
					PropellerLoopSound.loop = true;
					PropellerLoopSound.Play();
				}
			}
			else
			{
				if ((Object)(object)ActivatedMesh != (Object)null)
				{
					ActivatedMesh.SetActive(false);
				}
				if ((Object)(object)PropellerLoopSound != (Object)null)
				{
					PropellerLoopSound.Stop();
				}
			}
			DebugLog("Toggled — activated: " + m_isActivated);
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			if (m_isActivated && !m_isLaunched && !m_hasExploded)
			{
				m_isLaunched = true;
				m_isArmed = false;
				m_armTimer = 0f;
				if (AutoDestructTime > 0f)
				{
					m_autoDestructTimer = AutoDestructTime;
					m_beepTimer = 0f;
				}
				if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null)
				{
					((FVRPhysicalObject)this).RootRigidbody.collisionDetectionMode = (CollisionDetectionMode)2;
				}
				DebugLog("Launched! Arm delay: " + ArmDelay + "s  Auto-destruct: " + AutoDestructTime + "s");
			}
			((FVRPhysicalObject)this).EndInteraction(hand);
		}

		public override void FVRFixedUpdate()
		{
			//IL_003f: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00cb: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).FVRFixedUpdate();
			if (!m_isLaunched || m_hasExploded || (Object)(object)((FVRPhysicalObject)this).RootRigidbody == (Object)null)
			{
				return;
			}
			((FVRPhysicalObject)this).RootRigidbody.AddForce(((Component)this).transform.forward * ThrustForce, (ForceMode)0);
			Vector3 position = ((Component)this).transform.position;
			Vector3 val = position - m_prevFixedPos;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (m_isArmed)
			{
				Vector3 val2 = ((!(magnitude > 0.0001f)) ? ((Component)this).transform.forward : (val / magnitude));
				float num = Mathf.Max(ImpactCheckDistance, magnitude + ImpactCheckRadius);
				LayerMask val3 = ((!ExplodeOnAnyCollision) ? ExplosionLayerMask : LayerMask.op_Implicit(-1));
				RaycastHit val4 = default(RaycastHit);
				if (Physics.SphereCast(m_prevFixedPos, ImpactCheckRadius, val2, ref val4, num, LayerMask.op_Implicit(val3), (QueryTriggerInteraction)1))
				{
					DebugLog("SphereCast impact: " + ((Object)((Component)((RaycastHit)(ref val4)).collider).gameObject).name);
					Explode();
					return;
				}
			}
			m_prevFixedPos = position;
		}

		public override void FVRUpdate()
		{
			((FVRPhysicalObject)this).FVRUpdate();
			UpdateWings();
			UpdatePropellers();
			UpdateArming();
			UpdateAutoDestruct();
		}

		public override void OnCollisionEnter(Collision col)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).OnCollisionEnter(col);
			if (m_isLaunched && m_isArmed && !m_hasExploded && (ExplodeOnAnyCollision || ((1 << col.gameObject.layer) & LayerMask.op_Implicit(ExplosionLayerMask)) != 0))
			{
				DebugLog("Collision detonation.");
				Explode();
			}
		}

		public void Damage(Damage d)
		{
			if (!m_hasExploded && ExplodeOnShot && d.Dam_TotalKinetic >= ShotDamageThreshold)
			{
				DebugLog("Shot detonation — damage: " + d.Dam_TotalKinetic.ToString("F2"));
				Explode();
			}
		}

		private void UpdateArming()
		{
			if (m_isLaunched && !m_isArmed && !m_hasExploded)
			{
				m_armTimer += Time.deltaTime;
				if (m_armTimer >= ArmDelay)
				{
					m_isArmed = true;
					DebugLog("Armed.");
				}
			}
		}

		private void UpdateAutoDestruct()
		{
			if (!m_isLaunched || m_hasExploded || AutoDestructTime <= 0f)
			{
				return;
			}
			m_autoDestructTimer -= Time.deltaTime;
			if ((Object)(object)BeepAudioSource != (Object)null && m_autoDestructTimer <= BeepStartAtSeconds && m_autoDestructTimer > 0f)
			{
				m_beepTimer -= Time.deltaTime;
				if (m_beepTimer <= 0f)
				{
					float num = Mathf.Clamp01(1f - m_autoDestructTimer / BeepStartAtSeconds);
					num = Mathf.Pow(num, 2f);
					m_beepTimer = Mathf.Lerp(BeepRefireStart, BeepRefireEnd, num);
					BeepAudioSource.pitch = Mathf.Lerp(BeepPitchStart, BeepPitchEnd, num);
					BeepAudioSource.Play();
				}
			}
			if (m_autoDestructTimer <= 0f)
			{
				DebugLog("Auto-destruct triggered.");
				Explode();
			}
		}

		private void UpdateWings()
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			float num = ((!m_isActivated) ? 0f : 1f);
			for (int i = 0; i < Wings.Count; i++)
			{
				WingAnimator wingAnimator = Wings[i];
				if (!((Object)(object)wingAnimator.Wing == (Object)null))
				{
					m_wingLerps[i] = Mathf.MoveTowards(m_wingLerps[i], num, wingAnimator.AnimSpeed * Time.deltaTime);
					float num2 = m_wingLerps[i];
					wingAnimator.Wing.localEulerAngles = new Vector3(Mathf.LerpAngle(wingAnimator.FoldedLocalEulers.x, wingAnimator.DeployedLocalEulers.x, num2), Mathf.LerpAngle(wingAnimator.FoldedLocalEulers.y, wingAnimator.DeployedLocalEulers.y, num2), Mathf.LerpAngle(wingAnimator.FoldedLocalEulers.z, wingAnimator.DeployedLocalEulers.z, num2));
				}
			}
		}

		private void UpdatePropellers()
		{
			for (int i = 0; i < Propellers.Count; i++)
			{
				PropellerSpinner propellerSpinner = Propellers[i];
				if ((Object)(object)propellerSpinner.Propeller == (Object)null)
				{
					continue;
				}
				float num = ((!m_isActivated) ? 0f : propellerSpinner.MaxSpinSpeed);
				propellerSpinner.CurrentSpeed = Mathf.MoveTowards(propellerSpinner.CurrentSpeed, num, propellerSpinner.RampSpeed * Time.deltaTime);
				if (!(Mathf.Abs(propellerSpinner.CurrentSpeed) < Mathf.Epsilon))
				{
					float num2 = propellerSpinner.CurrentSpeed * Time.deltaTime;
					switch (propellerSpinner.Axis)
					{
					case PropellerSpinner.SpinAxis.X:
						propellerSpinner.Propeller.Rotate(num2, 0f, 0f, (Space)1);
						break;
					case PropellerSpinner.SpinAxis.Y:
						propellerSpinner.Propeller.Rotate(0f, num2, 0f, (Space)1);
						break;
					case PropellerSpinner.SpinAxis.Z:
						propellerSpinner.Propeller.Rotate(0f, 0f, num2, (Space)1);
						break;
					}
				}
			}
		}

		private void Explode()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (m_hasExploded)
			{
				return;
			}
			m_hasExploded = true;
			m_isActivated = false;
			if ((Object)(object)PropellerLoopSound != (Object)null)
			{
				PropellerLoopSound.Stop();
			}
			if ((Object)(object)BeepAudioSource != (Object)null)
			{
				BeepAudioSource.Stop();
			}
			if ((Object)(object)ActivatedMesh != (Object)null)
			{
				ActivatedMesh.SetActive(false);
			}
			for (int i = 0; i < SpawnOnExplode.Count; i++)
			{
				if (!((Object)(object)SpawnOnExplode[i] == (Object)null))
				{
					GameObject val = Object.Instantiate<GameObject>(SpawnOnExplode[i], ((Component)this).transform.position, Quaternion.identity);
					Explosion component = val.GetComponent<Explosion>();
					if ((Object)(object)component != (Object)null)
					{
						component.IFF = IFF;
					}
					ExplosionSound component2 = val.GetComponent<ExplosionSound>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.IFF = IFF;
					}
					GrenadeExplosion component3 = val.GetComponent<GrenadeExplosion>();
					if ((Object)(object)component3 != (Object)null)
					{
						component3.IFF = IFF;
					}
				}
			}
			if (((FVRInteractiveObject)this).IsHeld)
			{
				FVRViveHand hand = ((FVRInteractiveObject)this).m_hand;
				((FVRInteractiveObject)this).m_hand.ForceSetInteractable((FVRInteractiveObject)null);
				((FVRInteractiveObject)this).EndInteraction(hand);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void DebugLog(string msg)
		{
			if (EnableDebug)
			{
				Debug.Log((object)("[BreacherDrone] " + msg));
			}
		}
	}
	public class BreacherDroneButton : FVRInteractiveObject
	{
		[Header("Breacher Drone Button")]
		public BreacherDrone Drone;

		[Tooltip("Minimum time (seconds) between presses.")]
		public float PressCooldown = 0.3f;

		[Header("Press Animation")]
		[Tooltip("The transform to animate on press (the button visual mesh).")]
		public Transform ButtonVisual;

		public Vector3 RestLocalPos = Vector3.zero;

		public Vector3 RestLocalRot = Vector3.zero;

		public Vector3 PressedLocalPos = new Vector3(0f, -0.002f, 0f);

		public Vector3 PressedLocalRot = Vector3.zero;

		[Tooltip("Time in seconds to reach the pressed position.")]
		public float PressDuration = 0.05f;

		[Tooltip("Time in seconds to return to rest.")]
		public float ReturnDuration = 0.1f;

		private float m_lastPressTime = -1f;

		private bool m_isAnimating = false;

		private bool m_isReturning = false;

		private float m_animLerp = 0f;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			if (!((Object)(object)Drone == (Object)null) && !(Time.time - m_lastPressTime < PressCooldown) && !m_isAnimating)
			{
				m_lastPressTime = Time.time;
				((FVRInteractiveObject)this).SimpleInteraction(hand);
				Drone.ToggleActivation();
				if ((Object)(object)ButtonVisual != (Object)null)
				{
					m_isAnimating = true;
					m_isReturning = false;
					m_animLerp = 0f;
				}
			}
		}

		public override void FVRUpdate()
		{
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			if (!m_isAnimating || (Object)(object)ButtonVisual == (Object)null)
			{
				return;
			}
			float num = ((!m_isReturning) ? PressDuration : ReturnDuration);
			m_animLerp += Time.deltaTime / num;
			if (m_animLerp >= 1f)
			{
				m_animLerp = 1f;
				if (m_isReturning)
				{
					m_isAnimating = false;
					m_animLerp = 0f;
					ButtonVisual.localPosition = RestLocalPos;
					ButtonVisual.localEulerAngles = RestLocalRot;
					return;
				}
				m_isReturning = true;
				m_animLerp = 0f;
			}
			if (m_isReturning)
			{
				ButtonVisual.localPosition = Vector3.Lerp(PressedLocalPos, RestLocalPos, m_animLerp);
				ButtonVisual.localEulerAngles = Vector3.Lerp(PressedLocalRot, RestLocalRot, m_animLerp);
			}
			else
			{
				ButtonVisual.localPosition = Vector3.Lerp(RestLocalPos, PressedLocalPos, m_animLerp);
				ButtonVisual.localEulerAngles = Vector3.Lerp(RestLocalRot, PressedLocalRot, m_animLerp);
			}
		}
	}
	public class BriefcaseNukeButton : FVRInteractiveObject
	{
		public enum NukeButtonType
		{
			Number,
			Confirm,
			Reset
		}

		[Header("Briefcase Nuke Button")]
		public Briefcase_Nuke Nuke;

		public NukeButtonType ButtonType = NukeButtonType.Number;

		[Tooltip("The number this button types (0-9). Only used when ButtonType is Number.")]
		public int NumberValue;

		[Tooltip("Minimum time (seconds) between button presses.")]
		public float PressCooldown = 0.25f;

		[Header("Press Animation")]
		[Tooltip("The transform to animate (the button visual mesh). If null, no animation plays.")]
		public Transform ButtonVisual;

		[Tooltip("Local position of the button at rest.")]
		public Vector3 RestLocalPos = Vector3.zero;

		[Tooltip("Local rotation of the button at rest.")]
		public Vector3 RestLocalRot = Vector3.zero;

		[Tooltip("Local position of the button when fully pressed.")]
		public Vector3 PressedLocalPos = new Vector3(0f, -0.002f, 0f);

		[Tooltip("Local rotation of the button when fully pressed.")]
		public Vector3 PressedLocalRot = Vector3.zero;

		[Tooltip("Time in seconds for the button to go from rest to pressed.")]
		public float PressDuration = 0.05f;

		[Tooltip("Time in seconds for the button to return from pressed to rest.")]
		public float ReturnDuration = 0.1f;

		private bool m_isAnimating = false;

		private bool m_isReturning = false;

		private float m_animLerp = 0f;

		private float m_lastPressTime = -1f;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			if (!((Object)(object)Nuke == (Object)null) && !((Object)(object)((FVRPhysicalObject)Nuke).QuickbeltSlot != (Object)null) && !m_isAnimating && !(Time.time - m_lastPressTime < PressCooldown))
			{
				m_lastPressTime = Time.time;
				((FVRInteractiveObject)this).SimpleInteraction(hand);
				switch (ButtonType)
				{
				case NukeButtonType.Number:
					Nuke.TypeNumber(NumberValue);
					break;
				case NukeButtonType.Confirm:
					Nuke.ConfirmAndStart(hand);
					break;
				case NukeButtonType.Reset:
					Nuke.ResetTimer(hand);
					break;
				}
				if ((Object)(object)ButtonVisual != (Object)null)
				{
					m_isAnimating = true;
					m_animLerp = 0f;
					m_isReturning = false;
				}
			}
		}

		public override void FVRUpdate()
		{
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			if (!m_isAnimating || (Object)(object)ButtonVisual == (Object)null)
			{
				return;
			}
			m_animLerp += Time.deltaTime / ((!m_isReturning) ? PressDuration : ReturnDuration);
			if (m_animLerp >= 1f)
			{
				m_animLerp = 1f;
				if (m_isReturning)
				{
					m_isAnimating = false;
					m_animLerp = 0f;
					ButtonVisual.localPosition = RestLocalPos;
					ButtonVisual.localEulerAngles = RestLocalRot;
					return;
				}
				m_isReturning = true;
				m_animLerp = 0f;
			}
			float animLerp = m_animLerp;
			if (m_isReturning)
			{
				ButtonVisual.localPosition = Vector3.Lerp(PressedLocalPos, RestLocalPos, animLerp);
				ButtonVisual.localEulerAngles = Vector3.Lerp(PressedLocalRot, RestLocalRot, animLerp);
			}
			else
			{
				ButtonVisual.localPosition = Vector3.Lerp(RestLocalPos, PressedLocalPos, animLerp);
				ButtonVisual.localEulerAngles = Vector3.Lerp(RestLocalRot, PressedLocalRot, animLerp);
			}
		}
	}
	public class Briefcase_Nuke : FVRPhysicalObject, IFVRDamageable
	{
		private int[] digits = new int[5];

		private float m_remainingTime;

		private bool m_isCounting;

		private bool m_hasDetonated;

		private float m_lastTickTime;

		private float m_tick1Timer;

		private float m_tick2Timer;

		[Header("Timer Display")]
		public Text TimerText;

		[Header("Armed Indicator")]
		public GameObject CountdownIndicator;

		[Header("Armed State Visuals")]
		public List<GameObject> ArmedObjects = new List<GameObject>();

		public List<GameObject> DisarmedObjects = new List<GameObject>();

		public List<ParticleSystem> ArmedParticles = new List<ParticleSystem>();

		[Header("Explosion")]
		public List<GameObject> SpawnOnDetonate = new List<GameObject>();

		[Header("Tick Audio 1 — Main Countdown")]
		[Tooltip("AudioSource on this GameObject for the per-second tick. Play On Awake OFF.")]
		public AudioSource Tick1AudioSource;

		public bool Tick1UsePitchRamp = true;

		public float Tick1PitchStart = 1f;

		public float Tick1PitchEnd = 1.5f;

		public float Tick1PitchRampOverSeconds = 30f;

		[Header("Tick Audio 2 — Urgent Countdown")]
		[Tooltip("AudioSource on this GameObject for the urgent tick. Play On Awake OFF.")]
		public AudioSource Tick2AudioSource;

		public float Tick2StartAtSeconds = 10f;

		public float Tick2Interval = 0.5f;

		public bool Tick2UsePitchRamp = false;

		public float Tick2PitchStart = 1f;

		public float Tick2PitchEnd = 1.8f;

		[Header("Audio")]
		public AudioEvent AudEvent_DigitChange;

		public AudioEvent AudEvent_Confirm;

		public AudioEvent AudEvent_Reset;

		public AudioEvent AudEvent_Error;

		public void TypeNumber(int number)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (!m_isCounting && !m_hasDetonated && number >= 0 && number <= 9)
			{
				for (int i = 0; i < 4; i++)
				{
					digits[i] = digits[i + 1];
				}
				digits[4] = number;
				digits[1] = Mathf.Min(digits[1], 5);
				digits[3] = Mathf.Min(digits[3], 5);
				SM.PlayGenericSound(AudEvent_DigitChange, ((Component)this).transform.position);
				UpdateDisplay();
			}
		}

		public void ConfirmAndStart(FVRViveHand hand)
		{
			//IL_00ac: 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)
			if (!m_hasDetonated && (!((FVRInteractiveObject)this).IsHeld || !((Object)(object)hand == (Object)(object)((FVRInteractiveObject)this).m_hand)) && !m_isCounting)
			{
				float totalSecondsFromDigits = GetTotalSecondsFromDigits();
				if (totalSecondsFromDigits <= 0f)
				{
					SM.PlayGenericSound(AudEvent_Error, ((Component)this).transform.position);
					return;
				}
				m_remainingTime = totalSecondsFromDigits;
				m_isCounting = true;
				m_lastTickTime = m_remainingTime;
				m_tick1Timer = 0f;
				m_tick2Timer = 0f;
				SM.PlayGenericSound(AudEvent_Confirm, ((Component)this).transform.position);
				SetArmedState(armed: true);
				UpdateDisplay();
			}
		}

		public void ResetTimer(FVRViveHand hand)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			if (!m_hasDetonated && (!((FVRInteractiveObject)this).IsHeld || !((Object)(object)hand == (Object)(object)((FVRInteractiveObject)this).m_hand)))
			{
				m_isCounting = false;
				m_remainingTime = 0f;
				m_tick1Timer = 0f;
				m_tick2Timer = 0f;
				for (int i = 0; i < 5; i++)
				{
					digits[i] = 0;
				}
				if ((Object)(object)Tick1AudioSource != (Object)null)
				{
					Tick1AudioSource.Stop();
				}
				if ((Object)(object)Tick2AudioSource != (Object)null)
				{
					Tick2AudioSource.Stop();
				}
				SM.PlayGenericSound(AudEvent_Reset, ((Component)this).transform.position);
				SetArmedState(armed: false);
				UpdateDisplay();
			}
		}

		private void SetArmedState(bool armed)
		{
			if ((Object)(object)CountdownIndicator != (Object)null)
			{
				CountdownIndicator.SetActive(armed);
			}
			for (int i = 0; i < ArmedObjects.Count; i++)
			{
				if ((Object)(object)ArmedObjects[i] != (Object)null)
				{
					ArmedObjects[i].SetActive(armed);
				}
			}
			for (int j = 0; j < DisarmedObjects.Count; j++)
			{
				if ((Object)(object)DisarmedObjects[j] != (Object)null)
				{
					DisarmedObjects[j].SetActive(!armed);
				}
			}
			for (int k = 0; k < ArmedParticles.Count; k++)
			{
				if (!((Object)(object)ArmedParticles[k] == (Object)null))
				{
					if (armed)
					{
						ArmedParticles[k].Play();
					}
					else
					{
						ArmedParticles[k].Stop(true, (ParticleSystemStopBehavior)0);
					}
				}
			}
		}

		public override void FVRUpdate()
		{
			((FVRPhysicalObject)this).FVRUpdate();
			if (!m_hasDetonated && m_isCounting)
			{
				m_remainingTime -= Time.deltaTime;
				TickAudio1();
				TickAudio2();
				m_lastTickTime = m_remainingTime;
				UpdateDigitsFromTime();
				UpdateDisplay();
				if (m_remainingTime <= 0f)
				{
					m_remainingTime = 0f;
					Detonate();
				}
			}
		}

		private void TickAudio1()
		{
			if ((Object)(object)Tick1AudioSource == (Object)null || (Object)(object)Tick1AudioSource.clip == (Object)null)
			{
				return;
			}
			float num = Mathf.Ceil(m_remainingTime);
			if (!(num >= Mathf.Ceil(m_lastTickTime)) && !(m_remainingTime <= 0f))
			{
				if (Tick1UsePitchRamp)
				{
					float num2 = Mathf.Clamp01(1f - m_remainingTime / Tick1PitchRampOverSeconds);
					num2 = Mathf.Pow(num2, 2f);
					Tick1AudioSource.pitch = Mathf.Lerp(Tick1PitchStart, Tick1PitchEnd, num2);
				}
				else
				{
					Tick1AudioSource.pitch = Tick1PitchStart;
				}
				Tick1AudioSource.Play();
			}
		}

		private void TickAudio2()
		{
			if ((Object)(object)Tick2AudioSource == (Object)null || (Object)(object)Tick2AudioSource.clip == (Object)null || m_remainingTime > Tick2StartAtSeconds)
			{
				return;
			}
			m_tick2Timer -= Time.deltaTime;
			if (!(m_tick2Timer > 0f))
			{
				m_tick2Timer = Tick2Interval;
				if (Tick2UsePitchRamp)
				{
					float num = Mathf.Clamp01(1f - m_remainingTime / Tick2StartAtSeconds);
					num = Mathf.Pow(num, 2f);
					Tick2AudioSource.pitch = Mathf.Lerp(Tick2PitchStart, Tick2PitchEnd, num);
				}
				else
				{
					Tick2AudioSource.pitch = Tick2PitchStart;
				}
				Tick2AudioSource.Play();
			}
		}

		private void Detonate()
		{
			//IL_0089: 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)
			if (m_hasDetonated)
			{
				return;
			}
			m_hasDetonated = true;
			m_isCounting = false;
			if ((Object)(object)Tick1AudioSource != (Object)null)
			{
				Tick1AudioSource.Stop();
			}
			if ((Object)(object)Tick2AudioSource != (Object)null)
			{
				Tick2AudioSource.Stop();
			}
			for (int i = 0; i < SpawnOnDetonate.Count; i++)
			{
				if ((Object)(object)SpawnOnDetonate[i] != (Object)null)
				{
					Object.Instantiate<GameObject>(SpawnOnDetonate[i], ((Component)this).transform.position, ((Component)this).transform.rotation);
				}
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void Damage(Damage d)
		{
			if (!((FVRInteractiveObject)this).IsHeld && !((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null))
			{
				m_isCounting = true;
				m_remainingTime = Mathf.Min(m_remainingTime, Random.Range(0.1f, 0.3f));
			}
		}

		private void UpdateDisplay()
		{
			if ((Object)(object)TimerText != (Object)null)
			{
				TimerText.text = $"{digits[0]}:{digits[1]}{digits[2]}:{digits[3]}{digits[4]}";
			}
		}

		private void UpdateDigitsFromTime()
		{
			int num = Mathf.CeilToInt(Mathf.Max(0f, m_remainingTime));
			int num2 = num / 3600;
			int num3 = num % 3600 / 60;
			int num4 = num % 60;
			digits[0] = Mathf.Clamp(num2, 0, 9);
			digits[1] = num3 / 10;
			digits[2] = num3 % 10;
			digits[3] = num4 / 10;
			digits[4] = num4 % 10;
		}

		private float GetTotalSecondsFromDigits()
		{
			int num = digits[0];
			int num2 = digits[1] * 10 + digits[2];
			int num3 = digits[3] * 10 + digits[4];
			return (float)num * 3600f + (float)num2 * 60f + (float)num3;
		}
	}
	public class IceGrenade : PinnedGrenade
	{
		public GameObject pullPinEffectObject;

		public Material newMaterial;

		private Material originalMaterial;

		private Renderer grenadeRenderer;

		private bool materialChanged = false;

		public override void Start()
		{
			((FVRInteractiveObject)this).Start();
			grenadeRenderer = ((Component)this).GetComponentInChildren<Renderer>();
			if ((Object)(object)grenadeRenderer != (Object)null)
			{
				originalMaterial = grenadeRenderer.material;
			}
			if ((Object)(object)pullPinEffectObject != (Object)null)
			{
				pullPinEffectObject.SetActive(false);
			}
		}

		public override void FVRUpdate()
		{
			((PinnedGrenade)this).FVRUpdate();
			if (base.m_isPinPulled && !materialChanged)
			{
				if ((Object)(object)pullPinEffectObject != (Object)null && !pullPinEffectObject.activeSelf)
				{
					pullPinEffectObject.SetActive(true);
				}
				if ((Object)(object)grenadeRenderer != (Object)null && (Object)(object)newMaterial != (Object)null)
				{
					grenadeRenderer.material = newMaterial;
					materialChanged = true;
				}
			}
		}
	}
}
public class Idle : StateMachineBehaviour
{
}
namespace VolksScripts
{
	public class Kolos : FVRFireArm
	{
		[Serializable]
		public class KolosBarrel
		{
			public FVRFireArmChamber Chamber;

			public Transform Muzzle;

			public int MuzzleEffectIndex;

			public int GasOutIndex;
		}

		[Header("Barrels (assign 7)")]
		public KolosBarrel[] Barrels;

		[Header("Latch")]
		public Transform LatchTransform;

		public bool LatchUsesRotation = true;

		public bool LatchUsesTranslation = false;

		public Axis LatchAxis = (Axis)0;

		public float LatchClosedValue = 0f;

		public float LatchThreshold = 10f;

		[Tooltip("Assign the ReloadTriggerWell GameObject here — disabled when latched so the magazine cannot be grabbed or inserted.")]
		public GameObject MagazineInteractionRoot;

		[Header("Trigger Visual")]
		public Transform TriggerTransform;

		public InterpStyle TriggerInterpStyle = (InterpStyle)1;

		public Axis TriggerAxis;

		public float TriggerValueUnpulled = 0f;

		public float TriggerValuePulled = 30f;

		[Tooltip("Trigger float at which the salvo fires.")]
		public float TriggerFiringThreshold = 0.8f;

		[Header("Firing")]
		[Tooltip("Seconds between each barrel firing. 0 = all fire same frame.")]
		public float SalvoDelay = 0.05f;

		private bool m_isLatched = false;

		private bool m_wasLatched = false;

		private bool m_latchInitialized = false;

		private bool m_isFiring = false;

		private bool m_hasTriggerReset = true;

		private float m_triggerFloat = 0f;

		private int m_curBarrel = 0;

		public override void Awake()
		{
			((FVRFireArm)this).Awake();
			if (Barrels != null)
			{
				for (int i = 0; i < Barrels.Length; i++)
				{
					if (Barrels[i] != null && (Object)(object)Barrels[i].Chamber != (Object)null)
					{
						base.FChambers.Add(Barrels[i].Chamber);
					}
				}
			}
			SetAllChambersAccessible(accessible: false);
		}

		public override void FVRUpdate()
		{
			((FVRFireArm)this).FVRUpdate();
			PollLatchState();
		}

		private void PollLatchState()
		{
			if ((Object)(object)LatchTransform == (Object)null)
			{
				return;
			}
			float latchAxisValue = GetLatchAxisValue();
			bool flag = Mathf.Abs(latchAxisValue - LatchClosedValue) <= LatchThreshold;
			if (!m_latchInitialized)
			{
				m_isLatched = flag;
				m_wasLatched = flag;
				m_latchInitialized = true;
				SetAllChambersAccessible(!flag);
				if ((Object)(object)MagazineInteractionRoot != (Object)null)
				{
					MagazineInteractionRoot.SetActive(!flag);
				}
			}
			else
			{
				if (flag && !m_wasLatched)
				{
					OnLatchClosed();
				}
				else if (!flag && m_wasLatched)
				{
					OnLatchOpened();
				}
				m_isLatched = flag;
				m_wasLatched = flag;
			}
		}

		private float GetLatchAxisValue()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 v = (LatchUsesRotation ? LatchTransform.localEulerAngles : ((!LatchUsesTranslation) ? Vector3.zero : LatchTransform.localPosition));
			float num = GetAxisComponent(v);
			if (LatchUsesRotation && num > 180f)
			{
				num -= 360f;
			}
			return num;
		}

		private float GetAxisComponent(Vector3 v)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected I4, but got Unknown
			Axis latchAxis = LatchAxis;
			return (int)latchAxis switch
			{
				0 => v.x, 
				1 => v.y, 
				2 => v.z, 
				_ => v.x, 
			};
		}

		private void OnLatchClosed()
		{
			SetAllChambersAccessible(accessible: false);
			if ((Object)(object)MagazineInteractionRoot != (Object)null)
			{
				MagazineInteractionRoot.SetActive(false);
			}
			if ((Object)(object)base.Magazine != (Object)null)
			{
				((FVRInteractiveObject)base.Magazine).SetAllCollidersToLayer(false, "NoCol");
			}
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
			Debug.Log((object)("[Kolos] OnLatchClosed. Magazine=" + ((!((Object)(object)base.Magazine != (Object)null)) ? "NULL" : ((Object)base.Magazine).name) + " HasARound=" + ((!((Object)(object)base.Magazine != (Object)null)) ? "N/A" : base.Magazine.HasARound().ToString())));
			TryTransferRoundsFromMagazine();
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i] != null && (Object)(object)Barrels[i].Chamber != (Object)null)
				{
					Debug.Log((object)("[Kolos] Chamber[" + i + "] IsFull=" + Barrels[i].Chamber.IsFull));
				}
			}
		}

		private void OnLatchOpened()
		{
			SetAllChambersAccessible(accessible: true);
			if ((Object)(object)MagazineInteractionRoot != (Object)null)
			{
				MagazineInteractionRoot.SetActive(true);
			}
			if ((Object)(object)base.Magazine != (Object)null)
			{
				((FVRInteractiveObject)base.Magazine).SetAllCollidersToLayer(false, "Default");
			}
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
		}

		private void TryTransferRoundsFromMagazine()
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.Magazine == (Object)null)
			{
				Debug.LogWarning((object)"[Kolos] TryTransfer: no magazine mounted.");
				return;
			}
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i] != null && !((Object)(object)Barrels[i].Chamber == (Object)null) && !Barrels[i].Chamber.IsFull)
				{
					if (!base.Magazine.HasARound())
					{
						break;
					}
					FVRLoadedRound val = base.Magazine.RemoveRound(0);
					if (val != null)
					{
						Barrels[i].Chamber.Autochamber(val.LR_Class);
					}
				}
			}
		}

		public override void LoadMag(FVRFireArmMagazine mag)
		{
			if (m_isLatched)
			{
				Debug.LogWarning((object)"[Kolos] LoadMag rejected — latch is closed.");
			}
			else
			{
				((FVRFireArm)this).LoadMag(mag);
			}
		}

		public override void EjectMag(bool PhysicalRelease = false)
		{
			if (m_isLatched)
			{
				Debug.LogWarning((object)"[Kolos] EjectMag rejected — latch is closed.");
			}
			else
			{
				((FVRFireArm)this).EjectMag(PhysicalRelease);
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_006e: 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)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			if (!((FVRPhysicalObject)this).IsAltHeld)
			{
				m_triggerFloat = ((!((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin) ? 0f : hand.Input.TriggerFloat);
				if ((Object)(object)TriggerTransform != (Object)null)
				{
					((FVRPhysicalObject)this).SetAnimatedComponent(TriggerTransform, Mathf.Lerp(TriggerValueUnpulled, TriggerValuePulled, m_triggerFloat), TriggerInterpStyle, TriggerAxis);
				}
				if (!m_hasTriggerReset && m_triggerFloat <= 0.1f)
				{
					m_hasTriggerReset = true;
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
				}
				if (m_triggerFloat > 0.5f)
				{
					Debug.Log((object)("[Kolos] Trigger=" + m_triggerFloat.ToString("F2") + " isLatched=" + m_isLatched + " isFiring=" + m_isFiring + " triggerReset=" + m_hasTriggerReset));
				}
				if (m_isLatched && !m_isFiring && m_hasTriggerReset && m_triggerFloat >= TriggerFiringThreshold)
				{
					Debug.Log((object)"[Kolos] Starting salvo.");
					m_hasTriggerReset = false;
					((MonoBehaviour)this).StartCoroutine(FireSalvo());
				}
			}
		}

		public override Transform GetMuzzle()
		{
			if (Barrels == null || Barrels.Length == 0)
			{
				return base.MuzzlePos;
			}
			int num = Mathf.Clamp(m_curBarrel, 0, Barrels.Length - 1);
			return (Barrels[num] == null) ? base.MuzzlePos : Barrels[num].Muzzle;
		}

		private IEnumerator FireSalvo()
		{
			m_isFiring = true;
			Debug.Log((object)"[Kolos] FireSalvo started.");
			bool twoHand = ((FVRFireArm)this).IsTwoHandStabilized();
			bool altGrip = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
			bool shoulder = ((FVRFireArm)this).IsShoulderStabilized();
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i] != null && !((Object)(object)Barrels[i].Chamber == (Object)null))
				{
					m_curBarrel = i;
					Debug.Log((object)("[Kolos] Barrel[" + i + "] IsFull=" + Barrels[i].Chamber.IsFull + " IsSpent=" + Barrels[i].Chamber.IsSpent));
					FireBarrel(i, twoHand, altGrip, shoulder);
					if (SalvoDelay > 0f)
					{
						yield return (object)new WaitForSeconds(SalvoDelay);
					}
				}
			}
			m_isFiring = false;
		}

		private void FireBarrel(int index, bool twoHand, bool altGrip, bool shoulder)
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			KolosBarrel kolosBarrel = Barrels[index];
			if (kolosBarrel != null && !((Object)(object)kolosBarrel.Chamber == (Object)null) && kolosBarrel.Chamber.IsFull && !kolosBarrel.Chamber.IsSpent && kolosBarrel.Chamber.Fire())
			{
				((FVRFireArm)this).Fire(kolosBarrel.Chamber, kolosBarrel.Muzzle, true, 1f, -1f);
				int num = ((base.MuzzleEffects != null && kolosBarrel.MuzzleEffectIndex < base.MuzzleEffects.Length) ? kolosBarrel.MuzzleEffectIndex : 0);
				((FVRFireArm)this).FireMuzzleSmoke(num);
				int num2 = ((base.GasOutEffects != null && kolosBarrel.GasOutIndex < base.GasOutEffects.Length) ? kolosBarrel.GasOutIndex : 0);
				((FVRFireArm)this).AddGas(num2);
				((FVRFireArm)this).Recoil(twoHand, altGrip, shoulder, (FVRFireArmRecoilProfile)null, 1f);
				((FVRFireArm)this).PlayAudioGunShot(kolosBarrel.Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
				if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
				{
					kolosBarrel.Chamber.IsSpent = false;
					kolosBarrel.Chamber.UpdateProxyDisplay();
				}
				else
				{
					kolosBarrel.Chamber.Unload();
					kolosBarrel.Chamber.IsSpent = false;
				}
			}
		}

		private void SetAllChambersAccessible(bool accessible)
		{
			if (Barrels == null)
			{
				return;
			}
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i] != null && (Object)(object)Barrels[i].Chamber != (Object)null)
				{
					Barrels[i].Chamber.IsAccessible = accessible;
				}
			}
		}

		public override List<FireArmRoundClass> GetChamberRoundList()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			if (Barrels == null)
			{
				return null;
			}
			bool flag = false;
			List<FireArmRoundClass> list = new List<FireArmRoundClass>();
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i] != null && (Object)(object)Barrels[i].Chamber != (Object)null && Barrels[i].Chamber.IsFull && !Barrels[i].Chamber.IsSpent && (Object)(object)Barrels[i].Chamber.GetRound() != (Object)null)
				{
					list.Add(Barrels[i].Chamber.GetRound().RoundClass);
					flag = true;
				}
				else
				{
					list.Add((FireArmRoundClass)(-1));
				}
			}
			return (!flag) ? null : list;
		}

		public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (rounds == null || Barrels == null)
			{
				return;
			}
			for (int i = 0; i < rounds.Count && i < Barrels.Length; i++)
			{
				if (Barrels[i] != null && (Object)(object)Barrels[i].Chamber != (Object)null && (int)rounds[i] >= 0)
				{
					Barrels[i].Chamber.Autochamber(rounds[i]);
				}
			}
		}
	}
}
public class LazeTargeting : FVRPhysicalObject
{
	[Header("Laze Settings")]
	public Transform LaserOrigin;

	public LayerMask LazeLayerMask;

	public GameObject ArrowIndicator;

	public Image FillBar;

	public Text StatusText;

	public AudioEvent ConfirmedSound;

	public AudioEvent DeniedSound;

	public AudioEvent ErrorSound;

	[Tooltip("List of possible strike prefabs. First is default.")]
	public List<GameObject> StrikePrefabs;

	public float HoldTimeToConfirm = 2f;

	public float CooldownTime = 5f;

	public float MaxLazeDistance = 500f;

	public float SpawnAltitude = 100f;

	public int StrikeCount = 1;

	public float StrikeInterval = 0.2f;

	public float StrikeSpread = 0f;

	public LayerMask SkyObstructionMask;

	[Header("Strike Type UI")]
	public GameObject StrikeTypeUI;

	[Header("Laser Visuals")]
	public LaserLight laserLight;

	public AudioEvent LaserOnSound;

	public AudioEvent LaserOffSound;

	[Header("Strike Type Text")]
	public GameObject TextRoot;

	public Text TextField;

	[Header("Strike Knob Visual")]
	public Transform StrikeKnobMesh;

	[Tooltip("Set true for translation, false for rotation, per strike type.")]
	public bool[] UseTranslationForStrike;

	public Vector3 KnobTranslation = new Vector3(0f, 0.02f, 0f);

	public Vector3 KnobRotation = new Vector3(0f, 30f, 0f);

	[Header("Laser Button Visual")]
	public Transform LaserButtonMesh;

	public Vector3 LaserButtonDefaultLocalPos = Vector3.zero;

	public Vector3 LaserButtonPressedLocalPos = new Vector3(0f, -0.01f, 0f);

	private float holdTimer = 0f;

	private float cooldownTimer = 0f;

	private bool isLazing = false;

	private RaycastHit hit;

	private int currentStrikeIndex = 0;

	private bool isStrikeTypeUIActive = false;

	private bool isButtonHeld = false;

	private float buttonHeldTime = 0f;

	private bool hasEventFiredSincePress = false;

	private float holdToOpenStrikeUI = 0.6f;

	private bool m_isLaserOn = false;

	public override void FVRUpdate()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0677: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0616: Unknown result type (might be due to invalid IL or missing references)
		//IL_0599: Unknown result type (might be due to invalid IL or missing references)
		//IL_0422: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_0437: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0503: Unknown result type (might be due to invalid IL or missing references)
		//IL_0539: Unknown result type (might be due to invalid IL or missing references)
		//IL_055a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
		((FVRPhysicalObject)this).FVRUpdate();
		UpdateLaserVisual();
		Vector3 position = LaserOrigin.position;
		Vector3 forward = LaserOrigin.forward;
		float num = 1000f;
		bool flag = Physics.Raycast(position, forward, ref hit, num, LayerMask.op_Implicit(LazeLayerMask));
		Vector3 position2;
		Vector3 up;
		if (flag)
		{
			position2 = ((RaycastHit)(ref hit)).point;
			up = ((RaycastHit)(ref hit)).normal;
		}
		else
		{
			position2 = position + forward * num;
			up = Vector3.up;
		}
		if ((Object)(object)ArrowIndicator != (Object)null)
		{
			ArrowIndicator.transform.position = position2;
			ArrowIndicator.transform.up = up;
			ArrowIndicator.SetActive(true);
		}
		if ((Object)(object)LaserButtonMesh != (Object)null)
		{
			LaserButtonMesh.localPosition = ((!m_isLaserOn) ? LaserButtonDefaultLocalPos : LaserButtonPressedLocalPos);
		}
		FVRViveHand hand = ((FVRInteractiveObject)this).m_hand;
		if ((Object)(object)hand != (Object)null)
		{
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			bool flag2 = (hand.IsInStreamlinedMode && hand.Input.BYButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f);
			bool flag3 = (hand.IsInStreamlinedMode && hand.Input.BYButtonUp) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadUp);
			if ((hand.IsInStreamlinedMode && hand.Input.AXButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f))
			{
				ToggleLaser();
			}
			if (flag2)
			{
				isButtonHeld = true;
				hasEventFiredSincePress = false;
				buttonHeldTime = 0f;
			}
			if (flag3)
			{
				if (!hasEventFiredSincePress && buttonHeldTime < holdToOpenStrikeUI && StrikePrefabs != null && StrikePrefabs.Count > 0)
				{
					currentStrikeIndex = (currentStrikeIndex + 1) % StrikePrefabs.Count;
					ShowStrikeText();
					UpdateStrikeKnobVisual();
				}
				isButtonHeld = false;
				buttonHeldTime = 0f;
				if (isStrikeTypeUIActive)
				{
					isStrikeTypeUIActive = false;
					if ((Object)(object)StrikeTypeUI != (Object)null)
					{
						StrikeTypeUI.SetActive(false);
					}
				}
			}
			if (isButtonHeld && !hasEventFiredSincePress)
			{
				buttonHeldTime += Time.deltaTime;
				if (buttonHeldTime >= holdToOpenStrikeUI)
				{
					hasEventFiredSincePress = true;
					isStrikeTypeUIActive = !isStrikeTypeUIActive;
					if ((Object)(object)StrikeTypeUI != (Object)null)
					{
						StrikeTypeUI.SetActive(isStrikeTypeUIActive);
					}
					if (isStrikeTypeUIActive)
					{
						ShowStrikeText();
					}
				}
			}
			if (m_isLaserOn && hand.Input.TriggerPressed && cooldownTimer <= 0f && !isStrikeTypeUIActive)
			{
				if (flag)
				{
					holdTimer += Time.deltaTime;
					FillBar.fillAmount = holdTimer / HoldTimeToConfirm;
					StatusText.text = "Lazing...";
					if (holdTimer >= HoldTimeToConfirm)
					{
						bool flag4 = ((RaycastHit)(ref hit)).distance > MaxLazeDistance;
						bool flag5 = Physics.Raycast(((RaycastHit)(ref hit)).point + Vector3.up * SpawnAltitude, Vector3.down, SpawnAltitude, LayerMask.op_Implicit(SkyObstructionMask));
						if (flag4)
						{
							StatusText.text = "Target too far!";
							((Graphic)FillBar).color = Color.red;
							SM.PlayCoreSound((FVRPooledAudioType)10, DeniedSound, ((RaycastHit)(ref hit)).point);
							holdTimer = 0f;
							return;
						}
						if (flag5)
						{
							StatusText.text = "No sky sight!";
							((Graphic)FillBar).color = Color.red;
							SM.PlayCoreSound((FVRPooledAudioType)10, ErrorSound, ((RaycastHit)(ref hit)).point);
							holdTimer = 0f;
							return;
						}
						((MonoBehaviour)this).StartCoroutine(SpawnStrikeBarrage(((RaycastHit)(ref hit)).point, StrikeCount, StrikeInterval, StrikeSpread, SpawnAltitude));
						SM.PlayCoreSound((FVRPooledAudioType)10, ConfirmedSound, ((RaycastHit)(ref hit)).point);
						StatusText.text = "Strike Confirmed!";
						((Graphic)FillBar).color = Color.green;
						cooldownTimer = CooldownTime;
						holdTimer = 0f;
					}
				}
				else
				{
					StatusText.text = "No Target";
					((Graphic)FillBar).color = Color.red;
					FillBar.fillAmount = 0f;
					holdTimer = 0f;
				}
			}
			else
			{
				if (holdTimer > 0f && cooldownTimer <= 0f)
				{
					SM.PlayCoreSound((FVRPooledAudioType)10, DeniedSound, ((Component)this).transform.position);
					StatusText.text = "Cancelled";
					((Graphic)FillBar).color = Color.red;
				}
				holdTimer = 0f;
				FillBar.fillAmount = 0f;
			}
		}
		if (cooldownTimer > 0f)
		{
			cooldownTimer -= Time.deltaTime;
			StatusText.text = "Cooldown...";
			((Graphic)FillBar).color = Color.yellow;
		}