Decompiled source of LungeMine v1.0.0

LungeMine.dll

Decompiled 5 days ago
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public class AT4 : FVRFireArm
{
	[Header("Rocket Settings")]
	public FVRFireArmChamber Chamber;

	[HideInInspector]
	public bool isArmed = false;

	[HideInInspector]
	public bool hasFired = false;

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

	public Axis Trigger_Axis;

	public InterpStyle Trigger_Interp;

	public Vector2 Trigger_ValRange;

	private float m_triggerVal;

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

	public override void Awake()
	{
		((FVRFireArm)this).Awake();
		if ((Object)(object)Chamber != (Object)null)
		{
			base.FChambers.Add(Chamber);
		}
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0059: 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)
		((FVRPhysicalObject)this).UpdateInteraction(hand);
		if (m_triggerVal != hand.Input.TriggerFloat)
		{
			m_triggerVal = hand.Input.TriggerFloat;
			((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ValRange.x, Trigger_ValRange.y, m_triggerVal), Trigger_Interp, Trigger_Axis);
		}
		if (!((FVRPhysicalObject)this).IsAltHeld && hand.Input.TriggerDown && !hasFired && isArmed && Chamber.IsFull && !Chamber.IsSpent)
		{
			Fire();
		}
	}

	public void SetArmed(bool armed)
	{
		isArmed = armed;
	}

	public void Fire()
	{
		if (Chamber.IsFull && !Chamber.IsSpent)
		{
			Chamber.Fire();
			((FVRFireArm)this).FireMuzzleSmoke();
			hasFired = true;
			((MonoBehaviour)this).StartCoroutine(SelfDestructCheck());
		}
	}

	private IEnumerator SelfDestructCheck()
	{
		float timer = 0f;
		while (timer < DestroyDelay)
		{
			if (((FVRInteractiveObject)this).IsHeld)
			{
				yield break;
			}
			timer += Time.deltaTime;
			yield return null;
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class AT4ArmingLever : FVRInteractiveObject
{
	public enum LeverHandleState
	{
		Forward,
		Mid,
		Rear
	}

	public enum LeverHandleRot
	{
		Up,
		Mid,
		Down
	}

	public AT4 Weapon;

	public Transform LeverRoot;

	public Transform LeverHandle;

	public float BaseRotOffset = 0f;

	private float rotAngle;

	public float MinRot = 0f;

	public float MaxRot = 90f;

	public float UnlockThreshold = 70f;

	public Transform Point_Forward;

	public Transform Point_Rearward;

	public Vector3 HandPosOffset = Vector3.zero;

	public bool UsesExtraRotationPiece;

	public Transform ExtraRotationPiece;

	public LeverHandleState HandleState;

	public LeverHandleState LastHandleState;

	public LeverHandleRot HandleRot = LeverHandleRot.Down;

	public LeverHandleRot LastHandleRot = LeverHandleRot.Down;

	private Vector3 m_localHandPos_Rest;

	private Vector3 m_localHandPos_Up;

	private Vector3 m_localHandPos_Back;

	private float fakeDrive;

	private bool m_wasTPInitiated;

	public bool UsesQuickRelease = false;

	public bool CursedLeftHanded = false;

	public bool InvertZAxis = true;

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

	public void TPInitiate()
	{
		m_wasTPInitiated = true;
	}

	public override bool IsInteractable()
	{
		return (Object)(object)Weapon != (Object)null && !Weapon.hasFired && ((FVRInteractiveObject)this).IsInteractable();
	}

	private void CalculateHandPoses()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: 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)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: 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_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)Weapon == (Object)null))
		{
			m_localHandPos_Rest = ((Component)Weapon).transform.InverseTransformPoint(((Component)this).transform.position);
			if ((Object)(object)Point_Forward == (Object)null || (Object)(object)Point_Rearward == (Object)null || (Object)(object)LeverRoot == (Object)null)
			{
				m_localHandPos_Up = m_localHandPos_Rest + new Vector3(0f, 0.02f, 0f);
				m_localHandPos_Back = m_localHandPos_Up + -LeverRoot.forward * 0.02f;
				return;
			}
			Vector3 val = ((Component)this).transform.position - LeverRoot.position;
			val = Quaternion.AngleAxis(Mathf.Abs(MaxRot - MinRot) + 10f, LeverRoot.forward) * val;
			val += LeverRoot.position;
			m_localHandPos_Up = ((Component)Weapon).transform.InverseTransformPoint(val);
			Vector3 val2 = val + -LeverRoot.forward * (0.005f + Vector3.Distance(Point_Forward.position, Point_Rearward.position));
			m_localHandPos_Back = ((Component)Weapon).transform.InverseTransformPoint(val2);
		}
	}

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

	public void DriveLever(float amount)
	{
		//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_009f: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		fakeDrive += amount;
		fakeDrive = Mathf.Clamp(fakeDrive, 0f, 1f);
		Vector3 pos = ((!(fakeDrive < 0.5f)) ? Vector3.Lerp(((Component)Weapon).transform.TransformPoint(m_localHandPos_Up), ((Component)Weapon).transform.TransformPoint(m_localHandPos_Back), (fakeDrive - 0.5f) * 2f) : Vector3.Slerp(((Component)Weapon).transform.TransformPoint(m_localHandPos_Rest), ((Component)Weapon).transform.TransformPoint(m_localHandPos_Up), fakeDrive * 2f));
		ManipulateLeverUsingPosition(pos, touchpadDrive: true);
		float num = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, LeverRoot.localPosition.z);
		if (num < 0.05f)
		{
			HandleState = LeverHandleState.Forward;
		}
		else if (num > 0.95f)
		{
			HandleState = LeverHandleState.Rear;
		}
		else
		{
			HandleState = LeverHandleState.Mid;
		}
		LastHandleState = HandleState;
	}

	private bool ManipulateLeverUsingPosition(Vector3 pos, bool touchpadDrive)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: 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)
		//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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: 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_00ed: 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)
		bool result = false;
		if (HandleState == LeverHandleState.Forward)
		{
			Vector3 val = pos - LeverHandle.position;
			Vector3 val2 = Vector3.ProjectOnPlane(val, LeverRoot.forward);
			val = ((Vector3)(ref val2)).normalized;
			Vector3 val3 = LeverRoot.right;
			if (CursedLeftHanded)
			{
				val3 = -val3;
			}
			float num = ((!InvertZAxis) ? 1f : (-1f));
			rotAngle = Mathf.Atan2(Vector3.Dot(LeverRoot.forward, Vector3.Cross(val3, val)), Vector3.Dot(val3, val)) * 57.29578f * num;
			rotAngle += BaseRotOffset;
			rotAngle = Mathf.Clamp(rotAngle, MinRot, MaxRot);
			LeverHandle.localEulerAngles = new Vector3(0f, 0f, rotAngle);
			if (UsesExtraRotationPiece && (Object)(object)ExtraRotationPiece != (Object)null)
			{
				ExtraRotationPiece.localEulerAngles = new Vector3(0f, 0f, rotAngle);
			}
			if (rotAngle >= UnlockThreshold)
			{
				HandleRot = LeverHandleRot.Up;
			}
			else if (Mathf.Abs(rotAngle - MinRot) < 2f)
			{
				HandleRot = LeverHandleRot.Down;
			}
			else
			{
				HandleRot = LeverHandleRot.Mid;
			}
			if (HandleRot == LeverHandleRot.Up && LastHandleRot != 0)
			{
				if ((Object)(object)Weapon != (Object)null)
				{
					((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)12, 1f);
				}
			}
			else if (HandleRot == LeverHandleRot.Down && LastHandleRot != LeverHandleRot.Down)
			{
				if ((Object)(object)Weapon != (Object)null)
				{
					((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)13, 1f);
				}
				if ((Object)(object)Weapon != (Object)null)
				{
					Weapon.SetArmed(armed: true);
				}
				result = true;
			}
			LastHandleRot = HandleRot;
		}
		if (rotAngle >= UnlockThreshold)
		{
			Vector3 val4 = HandPosOffset.x * LeverRoot.right + HandPosOffset.y * LeverRoot.up + HandPosOffset.z * LeverRoot.forward;
			Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Forward.position, Point_Rearward.position, pos - val4);
			LeverRoot.position = closestValidPoint;
		}
		return result;
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0008: 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_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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		ManipulateLeverUsingPosition(((HandInput)(ref hand.Input)).Pos, touchpadDrive: false);
		float num = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, LeverRoot.localPosition.z);
		if (num < 0.025f)
		{
			HandleState = LeverHandleState.Forward;
		}
		else if (num > 0.975f)
		{
			HandleState = LeverHandleState.Rear;
		}
		else
		{
			HandleState = LeverHandleState.Mid;
		}
		LastHandleState = HandleState;
		((FVRInteractiveObject)this).UpdateInteraction(hand);
	}

	public override void EndInteraction(FVRViveHand hand)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		((FVRInteractiveObject)this).EndInteraction(hand);
		float num = Vector3.Distance(LeverRoot.position, Point_Forward.position);
		float num2 = Vector3.Distance(LeverRoot.position, Point_Rearward.position);
		if (num < 0.01f)
		{
			LeverRoot.position = Point_Forward.position;
			HandleState = LeverHandleState.Forward;
			if ((Object)(object)Weapon != (Object)null)
			{
				((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)31, 1f);
			}
		}
		else if (num2 < 0.01f)
		{
			LeverRoot.position = Point_Rearward.position;
			HandleState = LeverHandleState.Rear;
			if ((Object)(object)Weapon != (Object)null)
			{
				((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)30, 1f);
			}
		}
		else
		{
			HandleState = LeverHandleState.Mid;
		}
	}

	public void PlayRecoilJolt()
	{
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine(RecoilRoutine());
	}

	private IEnumerator RecoilRoutine()
	{
		Vector3 start = LeverRoot.localPosition;
		Vector3 back = start + new Vector3(0f, 0f, -0.02f);
		float half = 0.06f;
		float t2 = 0f;
		while (t2 < half)
		{
			t2 += Time.deltaTime;
			LeverRoot.localPosition = Vector3.Lerp(start, back, t2 / half);
			yield return null;
		}
		t2 = 0f;
		while (t2 < half)
		{
			t2 += Time.deltaTime;
			LeverRoot.localPosition = Vector3.Lerp(back, start, t2 / half);
			yield return null;
		}
		LeverRoot.localPosition = start;
	}
}
public class AT4SightCover : FVRInteractiveObject
{
	[Header("Sight References")]
	public Transform Sight;

	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_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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);
			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 FVRCappedGrenadeCapExtended : FVRCappedGrenadeCap
{
	[Header("Extra Behaviours")]
	public GameObject EnableOnRemove;

	public GameObject ExplosionPrefab;

	public LayerMask TriggerLayers;

	public float ImpactVelocity = 2f;

	private bool _isRemoved = false;

	public override void BeginInteraction(FVRViveHand hand)
	{
		((FVRCappedGrenadeCap)this).BeginInteraction(hand);
		if (!_isRemoved)
		{
			_isRemoved = true;
			if ((Object)(object)EnableOnRemove != (Object)null)
			{
				EnableOnRemove.SetActive(true);
			}
		}
	}

	private void OnCollisionEnter(Collision col)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		if (!_isRemoved)
		{
			return;
		}
		Vector3 relativeVelocity = col.relativeVelocity;
		if (((Vector3)(ref relativeVelocity)).magnitude > ImpactVelocity && ((1 << col.gameObject.layer) & ((LayerMask)(ref TriggerLayers)).value) != 0)
		{
			if ((Object)(object)ExplosionPrefab != (Object)null)
			{
				Object.Instantiate<GameObject>(ExplosionPrefab, ((Component)this).transform.position, Quaternion.identity);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class LungeMine : FVRCappedGrenade
{
	[Header("Lunge Mine Settings")]
	public bool ExplodeOnAnyContactWhenArmed = false;

	public LayerMask TriggerLayers = LayerMask.op_Implicit(-1);

	public bool ForceArmOnPrimaryCap = true;

	public float MinArmedDelay = 0f;

	private bool m_isArmed = false;

	private float m_armedTime = -1f;

	private bool m_prevObservedArmedState = false;

	public override void Start()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		((FVRCappedGrenade)this).Start();
		base.FuseType = (CappedGrenadeFuseType)1;
		if (ForceArmOnPrimaryCap)
		{
			base.UsesSecondaryCap = false;
		}
	}

	private void Update()
	{
		bool flag = (ForceArmOnPrimaryCap ? base.IsPrimaryCapRemoved : ((!base.UsesSecondaryCap) ? base.IsPrimaryCapRemoved : (base.IsPrimaryCapRemoved && base.IsSecondaryCapRemoved)));
		if (flag && !m_prevObservedArmedState)
		{
			m_isArmed = true;
			m_armedTime = Time.time;
		}
		else if (!flag && m_prevObservedArmedState)
		{
			m_isArmed = false;
			m_armedTime = -1f;
		}
		m_prevObservedArmedState = flag;
	}

	public override void OnCollisionEnter(Collision col)
	{
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		((FVRCappedGrenade)this).OnCollisionEnter(col);
		if (!m_isArmed || (MinArmedDelay > 0f && m_armedTime > 0f && Time.time - m_armedTime < MinArmedDelay) || ((1 << col.gameObject.layer) & LayerMask.op_Implicit(TriggerLayers)) == 0)
		{
			return;
		}
		if (ExplodeOnAnyContactWhenArmed)
		{
			((FVRCappedGrenade)this).Explode();
			return;
		}
		Vector3 relativeVelocity = col.relativeVelocity;
		float magnitude = ((Vector3)(ref relativeVelocity)).magnitude;
		if (magnitude >= base.ImpactFuseVelThreshold)
		{
			((FVRCappedGrenade)this).Explode();
		}
	}

	public void Disarm()
	{
		m_isArmed = false;
		m_armedTime = -1f;
	}

	public void ForceDetonate()
	{
		((FVRCappedGrenade)this).Explode();
	}
}
public class LungeMineProng : MonoBehaviour
{
	[Tooltip("If left empty, the script will auto-find FVRCappedGrenade in parent.")]
	public FVRCappedGrenade Grenade;

	[Tooltip("Which layers can trigger the prong (set in inspector).")]
	public LayerMask TriggerLayers = LayerMask.op_Implicit(-1);

	[Tooltip("Minimum collision velocity required to trigger.")]
	public float MinVelocity = 1f;

	[Tooltip("Require grenade to be armed (cap removed) before it can detonate.")]
	public bool RequireArmed = true;

	[Tooltip("Show debug logs in console.")]
	public bool DebugEnabled = false;

	private void Start()
	{
		if ((Object)(object)Grenade == (Object)null)
		{
			Grenade = ((Component)this).GetComponentInParent<FVRCappedGrenade>();
			if (DebugEnabled)
			{
				Debug.Log((object)("[LungeMineProng] Auto-found grenade: " + ((Object)(object)Grenade != (Object)null)));
			}
		}
	}

	private void OnCollisionEnter(Collision col)
	{
		//IL_00ed: 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)
		if (DebugEnabled)
		{
			Debug.Log((object)"[LungeMineProng] OnCollisionEnter called.");
		}
		if (DebugEnabled)
		{
			Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
			Collider component2 = ((Component)this).GetComponent<Collider>();
			Debug.Log((object)("[LungeMineProng] Rigidbody: " + ((Object)(object)component != (Object)null) + " Collider: " + ((Object)(object)component2 != (Object)null)));
		}
		if ((Object)(object)Grenade == (Object)null)
		{
			if (DebugEnabled)
			{
				Debug.Log((object)"[LungeMineProng] No grenade reference.");
			}
			return;
		}
		if (((1 << col.gameObject.layer) & ((LayerMask)(ref TriggerLayers)).value) == 0)
		{
			if (DebugEnabled)
			{
				Debug.Log((object)("[LungeMineProng] Wrong layer: " + LayerMask.LayerToName(col.gameObject.layer)));
			}
			return;
		}
		Vector3 relativeVelocity = col.relativeVelocity;
		float magnitude = ((Vector3)(ref relativeVelocity)).magnitude;
		if (magnitude < MinVelocity)
		{
			if (DebugEnabled)
			{
				Debug.Log((object)("[LungeMineProng] Hit too soft: " + magnitude));
			}
			return;
		}
		bool flag = true;
		if (RequireArmed)
		{
			PropertyInfo property = ((object)Grenade).GetType().GetProperty("IsPrimaryCapRemoved");
			if ((object)property != null)
			{
				flag = (bool)property.GetValue(Grenade, null);
			}
			else
			{
				if (DebugEnabled)
				{
					Debug.Log((object)"[LungeMineProng] Could not find IsPrimaryCapRemoved property.");
				}
				flag = false;
			}
		}
		if (!flag)
		{
			if (DebugEnabled)
			{
				Debug.Log((object)"[LungeMineProng] Grenade not armed yet.");
			}
			return;
		}
		if (DebugEnabled)
		{
			Debug.Log((object)("[LungeMineProng] Detonating! Velocity: " + magnitude + " Object: " + ((Object)col.gameObject).name));
		}
		((Component)Grenade).gameObject.SendMessage("Explode", (SendMessageOptions)1);
	}
}
namespace Volks.LungeMine;

[BepInPlugin("Volks.LungeMine", "LungeMine", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class LungeMinePlugin : BaseUnityPlugin
{
	private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	internal static ManualLogSource Logger;

	private void Awake()
	{
		Logger = ((BaseUnityPlugin)this).Logger;
		LoadAssets();
	}

	private void LoadAssets()
	{
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Volks.LungeMine");
		OtherLoader.RegisterDirectLoad(BasePath, "Volks.LungeMine", "", "", "lungemine", "");
	}
}
public class FlipGrip : FVRAlternateGrip
{
	private float curXRot;

	private float m_curFlipLerp;

	private float m_tarFlipLerp;

	private float m_lastFlipLerp;

	public float XRotUp;

	public float XRotDown;

	public bool IsUp { get; private set; }

	public override void Awake()
	{
		((FVRAlternateGrip)this).Awake();
		if (IsUp)
		{
			curXRot = XRotUp;
			m_curFlipLerp = 1f;
			m_tarFlipLerp = 1f;
			m_lastFlipLerp = 1f;
		}
		else
		{
			curXRot = XRotDown;
			m_curFlipLerp = 0f;
			m_tarFlipLerp = 0f;
			m_lastFlipLerp = 0f;
		}
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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)
		Vector2 touchpadAxes = hand.Input.TouchpadAxes;
		if (hand.IsInStreamlinedMode)
		{
			if (hand.Input.BYButtonDown)
			{
				IsUp = !IsUp;
				Flip();
			}
		}
		else if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.25f && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
		{
			Flip();
		}
		((FVRAlternateGrip)this).UpdateInteraction(hand);
	}

	private void Flip()
	{
		if (IsUp)
		{
			curXRot = XRotUp;
			m_tarFlipLerp = 1f;
		}
		else
		{
			curXRot = XRotDown;
			m_tarFlipLerp = 0f;
		}
	}
}
public class GripRotation : FVRAlternateGrip
{
	[Header("Grip Rotation")]
	public Vector3 rotationDirection = Vector3.up;
}
public enum E_InteractionType
{
	None = -1,
	Holding,
	Touchpad,
	TouchpadUp,
	TouchpadDown,
	TouchpadLeft,
	TouchpadRight,
	AXButton,
	BYButton,
	Trigger,
	Simple,
	TriggerTouched,
	GripPressed
}
public class Safety_RPG : SimpleLauncher
{
	private int m_fireSelectorMode;

	public int FireSelectorModeIndex => m_fireSelectorMode;

	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class RKGChute : PinnedGrenade
{
	public GameObject objectToEnable;

	public float delay = 1f;

	public float dragFactor = 5f;

	public Vector3 targetDirection = Vector3.right;

	public float rotationSpeed = 5f;

	private bool isTimerStarted = false;

	private Rigidbody rb;

	private void Start()
	{
		rb = ((Component)this).GetComponent<Rigidbody>();
	}

	public override void FVRUpdate()
	{
		((PinnedGrenade)this).FVRUpdate();
		if (base.m_isPinPulled && base.m_isLeverReleased && !((FVRInteractiveObject)this).IsHeld && !isTimerStarted)
		{
			((MonoBehaviour)this).StartCoroutine(EnableObjectAfterDelay());
		}
		if ((Object)(object)objectToEnable != (Object)null && objectToEnable.activeSelf)
		{
			AlignToWorldDirection();
		}
	}

	private IEnumerator EnableObjectAfterDelay()
	{
		isTimerStarted = true;
		yield return (object)new WaitForSeconds(delay);
		if ((Object)(object)objectToEnable != (Object)null)
		{
			objectToEnable.SetActive(true);
			Debug.Log((object)"Parachute deployed.");
		}
	}

	private void AlignToWorldDirection()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_007a: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)rb == (Object)null))
		{
			rb.velocity *= 1f - Time.deltaTime * dragFactor;
			Vector3 normalized = ((Vector3)(ref targetDirection)).normalized;
			Quaternion val = Quaternion.LookRotation(normalized, Vector3.up);
			((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val, rotationSpeed * Time.deltaTime);
		}
	}
}
public class DM34Destroy : MonoBehaviour
{
	public FVRPhysicalObject triggerDestroy;

	public FVRFireArmChamber chamber;

	private bool isTimerStarted;

	public float timeBeforedestruction;

	private float timer = 1f;

	private void FixedUpdate()
	{
		if (!chamber.IsFull && !isTimerStarted)
		{
			isTimerStarted = true;
			timer = timeBeforedestruction;
		}
		if (((FVRInteractiveObject)triggerDestroy).IsHeld)
		{
			timer = timeBeforedestruction;
		}
		if (isTimerStarted)
		{
			timer -= Time.fixedDeltaTime;
		}
		if (timer <= 0f)
		{
			Object.Destroy((Object)(object)((Component)triggerDestroy).gameObject);
		}
	}
}
public class EnableEngine : MonoBehaviour
{
	public FVRFireArmChamber chamber;

	public GameObject objectToEnable;

	private void FixedUpdate()
	{
		if (!chamber.IsFull)
		{
			objectToEnable.SetActive(true);
		}
	}
}
public class Semtex : PinnedGrenade
{
	[Header("Semtex Values")]
	public bool isSticky;

	public LayerMask stickyMask;

	[Header("Semtex Extras (Leave Empty If Not Needed)")]
	[Tooltip("If not null, will play audio clip placed inside of source. Used for a stick sound if you want.")]
	public AudioSource StickSource;

	public override void OnCollisionEnter(Collision collision)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		if (collision.gameObject.layer == LayerMask.op_Implicit(stickyMask) && !((FVRInteractiveObject)this).IsHeld)
		{
			((Component)this).transform.parent = collision.transform;
			((Component)this).GetComponent<Rigidbody>().isKinematic = true;
			if ((Object)(object)StickSource != (Object)null)
			{
				StickSource.Play();
			}
		}
		((PinnedGrenade)this).OnCollisionEnter(collision);
	}
}
public class Semtex_Updated : PinnedGrenade
{
	[Header("Semtex Values")]
	public bool isSticky;

	public LayerMask stickyMask;

	[Header("Semtex Extras (Leave Empty If Not Needed)")]
	[Tooltip("If not null, will play audio clip placed inside of source. Used for a stick sound if you want.")]
	public AudioSource StickSource;

	private Transform fakeParent;

	private Vector3 pos;

	private Vector3 fw;

	private Vector3 up;

	private void FixedUpdate()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: 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)
		if ((Object)(object)fakeParent != (Object)null)
		{
			Vector3 position = ((Component)fakeParent).transform.TransformPoint(pos);
			Vector3 val = ((Component)fakeParent).transform.TransformDirection(fw);
			Vector3 val2 = ((Component)fakeParent).transform.TransformDirection(up);
			Quaternion rotation = Quaternion.LookRotation(val, val2);
			((Component)this).transform.position = position;
			((Component)this).transform.rotation = rotation;
		}
	}

	public override void OnCollisionEnter(Collision collision)
	{
		//IL_0012: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00c4: 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 (((1 << collision.gameObject.layer) & LayerMask.op_Implicit(stickyMask)) != 0 && !((FVRInteractiveObject)this).IsHeld)
		{
			((Component)this).transform.position = ((ContactPoint)(ref collision.contacts[0])).point;
			((Component)this).transform.rotation = Quaternion.LookRotation(((ContactPoint)(ref collision.contacts[0])).normal);
			pos = ((Component)fakeParent).transform.InverseTransformPoint(((Component)this).transform.position);
			fw = ((Component)fakeParent).transform.InverseTransformDirection(((Component)this).transform.forward);
			up = ((Component)fakeParent).transform.InverseTransformDirection(((Component)this).transform.up);
			((Component)this).GetComponent<Rigidbody>().isKinematic = true;
			if ((Object)(object)StickSource != (Object)null)
			{
				StickSource.Play();
			}
		}
		((PinnedGrenade)this).OnCollisionEnter(collision);
	}

	public override void BeginInteraction(FVRViveHand hand)
	{
		((PinnedGrenade)this).BeginInteraction(hand);
		fakeParent = null;
	}
}