using System;
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 : 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 Transform CylinderArm;
public ArwenCylinder Cylinder;
public FVRFireArmChamber[] Chambers;
public Transform Trigger;
public Transform Hammer;
[Header("Ejection")]
public Transform EjectionPos;
public Vector3 EjectionVelocity = new Vector3(0.2f, 0.5f, 0f);
public Vector3 EjectionSpin = new Vector3(0f, 200f, 0f);
[Header("Trigger Movement")]
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 Movement")]
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("Cylinder Rotation")]
public float CylinderRotateDuration = 0.2f;
private int m_curChamber = 0;
private bool m_isCylinderArmLocked = true;
private Coroutine cylinderRotationCoroutine;
private bool m_hasTriggerCycled = false;
public bool CanGrabFromChamber(int chamberIndex)
{
return chamberIndex == m_curChamber;
}
public void LoadShell(FireArmRoundClass round)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (!Chambers[m_curChamber].IsFull)
{
Chambers[m_curChamber].Autochamber(round);
RotateToNextChamberSmooth();
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).UpdateInteraction(hand);
float num = ((!((Object)(object)hand != (Object)null)) ? 0f : hand.Input.TriggerFloat);
UpdateTriggerAndHammer(num);
if ((Object)(object)hand != (Object)null && m_isCylinderArmLocked)
{
if (num > 0.95f && !m_hasTriggerCycled)
{
FireCurrentChamber();
RotateToNextChamberSmooth();
m_hasTriggerCycled = true;
}
else if (num < 0.1f)
{
m_hasTriggerCycled = false;
}
}
}
private void UpdateTriggerAndHammer(float triggerValue)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Trigger != (Object)null)
{
if (TriggerUsesRotation)
{
float num = Mathf.Lerp(TriggerMinAngle, TriggerMaxAngle, triggerValue);
Trigger.localRotation = Quaternion.AngleAxis(num, TriggerRotationAxis);
}
if (TriggerUsesTranslation)
{
float num2 = Mathf.Lerp(TriggerMinPosition, TriggerMaxPosition, triggerValue);
Trigger.localPosition = ((Vector3)(ref TriggerTranslationAxis)).normalized * num2;
}
}
if ((Object)(object)Hammer != (Object)null)
{
if (HammerUsesRotation)
{
float num3 = Mathf.Lerp(HammerMinAngle, HammerMaxAngle, triggerValue);
Hammer.localRotation = Quaternion.AngleAxis(num3, HammerRotationAxis);
}
if (HammerUsesTranslation)
{
float num4 = Mathf.Lerp(HammerMinPosition, HammerMaxPosition, triggerValue);
Hammer.localPosition = ((Vector3)(ref HammerTranslationAxis)).normalized * num4;
}
}
}
private void FireCurrentChamber()
{
//IL_00fc: 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_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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_00ae: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
if (Chambers[m_curChamber].IsFull && !Chambers[m_curChamber].IsSpent)
{
Chambers[m_curChamber].Fire();
((FVRFireArm)this).Fire(Chambers[m_curChamber], (!((Object)(object)base.MuzzlePos != (Object)null)) ? ((Component)this).transform : base.MuzzlePos, true, 1f, -1f);
if ((Object)(object)EjectionPos != (Object)null)
{
Chambers[m_curChamber].EjectRound(EjectionPos.position, EjectionVelocity, EjectionSpin, EjectionPos.position, EjectionPos.rotation, false);
}
else
{
Chambers[m_curChamber].EjectRound(((Component)Chambers[m_curChamber]).transform.position + ((Component)Chambers[m_curChamber]).transform.forward * 0.1f, ((Component)Chambers[m_curChamber]).transform.forward, Vector3.up * 2f, true);
}
}
}
private void RotateToNextChamberSmooth()
{
int num = (m_curChamber + 1) % Chambers.Length;
if (cylinderRotationCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(cylinderRotationCoroutine);
}
cylinderRotationCoroutine = ((MonoBehaviour)this).StartCoroutine(RotateCylinderSmoothly(m_curChamber, num));
m_curChamber = num;
}
private IEnumerator RotateCylinderSmoothly(int fromIndex, int toIndex)
{
if (!((Object)(object)Cylinder == (Object)null))
{
Quaternion startRot = ((Component)Cylinder).transform.localRotation;
Quaternion endRot = Cylinder.GetLocalRotationFromCylinder(toIndex);
float t = 0f;
float duration = Mathf.Max(0.01f, CylinderRotateDuration);
while (t < 1f)
{
t += Time.deltaTime / duration;
((Component)Cylinder).transform.localRotation = Quaternion.Slerp(startRot, endRot, t);
yield return null;
}
((Component)Cylinder).transform.localRotation = endRot;
}
}
public void OnShellRemoved(int chamberIndex)
{
if (chamberIndex != m_curChamber || Chambers[chamberIndex].IsFull)
{
return;
}
int previousLoadedChamber = GetPreviousLoadedChamber(chamberIndex);
if (previousLoadedChamber != chamberIndex)
{
if (cylinderRotationCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(cylinderRotationCoroutine);
}
cylinderRotationCoroutine = ((MonoBehaviour)this).StartCoroutine(RotateCylinderSmoothly(m_curChamber, previousLoadedChamber));
m_curChamber = previousLoadedChamber;
}
}
private int GetPreviousLoadedChamber(int fromIndex)
{
int num = Chambers.Length;
for (int i = 1; i < num; i++)
{
int num2 = (fromIndex - i + num) % num;
if (Chambers[num2].IsFull)
{
return num2;
}
}
return fromIndex;
}
}
public class ArwenCylinder : FVRInteractiveObject
{
[Header("Arwen Cylinder Config")]
public Arwen Arwen;
public int numChambers = 5;
public float CartridgeLength = 0.1f;
public GameObject MoonClip;
private float m_fakeAngularVel;
private float m_timeSinceEject;
public string SpeedLoaderID;
private bool m_hasSpeedLoadedIn;
public bool HasSpeedLoadedIn => m_hasSpeedLoadedIn;
public override void Awake()
{
}
public void LoadFromSpeedLoader(Speedloader loader)
{
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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)
SpeedLoaderID = ((FVRPhysicalObject)loader).ObjectWrapper.ItemID;
m_hasSpeedLoadedIn = true;
bool flag = false;
for (int i = 0; i < loader.Chambers.Count; i++)
{
if (i < Arwen.Chambers.Length && loader.Chambers[i].IsLoaded && !Arwen.Chambers[i].IsFull)
{
if (!loader.Chambers[i].IsSpent)
{
Arwen.Chambers[i].SetRound(loader.Chambers[i].Unload(), ((Component)loader.Chambers[i]).transform.position, ((Component)loader.Chambers[i]).transform.rotation);
flag = true;
}
else
{
Arwen.Chambers[i].Autochamber(loader.Chambers[i].Unload());
Arwen.Chambers[i].Fire();
flag = true;
}
}
}
if (flag)
{
((FVRFireArm)Arwen).PlayAudioEvent((FirearmAudioEventType)20, 1f);
if ((Object)(object)MoonClip != (Object)null)
{
MoonClip.SetActive(true);
}
}
}
public string Eject()
{
m_timeSinceEject = 0f;
if ((Object)(object)MoonClip != (Object)null)
{
MoonClip.SetActive(false);
}
m_hasSpeedLoadedIn = false;
return SpeedLoaderID;
}
public bool CanAccept()
{
return m_timeSinceEject > 0.2f;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)Arwen).transform.InverseTransformDirection(hand.Input.VelLinearWorld);
}
public override void EndInteraction(FVRViveHand hand)
{
//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_001d: Unknown result type (might be due to invalid IL or missing references)
m_fakeAngularVel = (0f - ((Component)Arwen).transform.InverseTransformDirection(hand.Input.VelLinearWorld).y) * 120f;
m_fakeAngularVel = Mathf.Clamp(m_fakeAngularVel, -360f, 360f);
}
private void Update()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (m_timeSinceEject < 1f)
{
m_timeSinceEject += Time.deltaTime;
}
if (!ArwenIsCylinderArmLocked())
{
((Component)this).transform.localEulerAngles = new Vector3(0f, 0f, ((Component)this).transform.localEulerAngles.z + m_fakeAngularVel);
if (Mathf.Abs(m_fakeAngularVel) > 0f)
{
m_fakeAngularVel = Mathf.Lerp(m_fakeAngularVel, 0f, Time.deltaTime * 0.8f);
}
}
else
{
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.CeilToInt(num / (360f / (float)numChambers)) - 1;
}
public Quaternion GetLocalRotationFromCylinder(int cylinder)
{
//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_003f: Unknown result type (might be due to invalid IL or missing references)
float num = (float)cylinder * (360f / (float)numChambers) * -1f;
num = Mathf.Repeat(num, 360f);
return Quaternion.Euler(new Vector3(0f, 0f, num));
}
private bool ArwenIsCylinderArmLocked()
{
return (Object)(object)Arwen != (Object)null && (bool)((object)Arwen).GetType().GetField("m_isCylinderArmLocked", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Arwen);
}
}
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;
}
}
}
}
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.BouncingBetty_Mine;
[BepInPlugin("Volks.BouncingBetty_Mine", "BouncingBetty_Mine", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class BouncingBetty_MinePlugin : 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.BouncingBetty_Mine");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.BouncingBetty_Mine", "", "", "bouncingbetty", "");
}
}
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 Pansarskott : SimpleLauncher
{
public enum Axis
{
X,
Y,
Z
}
[Header("Pansarskott Safety")]
public PansarskottSafety SafetyPin;
public bool IsSafetyOn = true;
[Header("Trigger Animation")]
public Transform TriggerTransform;
public Vector3 TriggerRestEuler = Vector3.zero;
public Vector3 TriggerPulledEuler = new Vector3(-20f, 0f, 0f);
public float TriggerAnimSpeed = 10f;
[Header("Sight Animation")]
public Transform SightToUnlatch;
public float SightStartAngle = 0f;
public float SightEndAngle = 90f;
public float SightUnlatchSpeed = 4f;
public Axis SightAxis = Axis.X;
private float m_triggerAnimT = 0f;
private float sightCurLerp = 0f;
private float sightTarLerp = 0f;
private float sightLastLerp = 0f;
public override void Awake()
{
((SimpleLauncher)this).Awake();
if ((Object)(object)SafetyPin != (Object)null)
{
SafetyPin.OnSafetyRemoved += OnSafetyRemoved;
}
base.HasTrigger = false;
}
private void OnSafetyRemoved()
{
IsSafetyOn = false;
base.HasTrigger = true;
sightTarLerp = 1f;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0083: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
((SimpleLauncher)this).UpdateInteraction(hand);
bool flag = (Object)(object)hand != (Object)null && hand.Input.TriggerFloat > 0.5f && !IsSafetyOn;
float num = ((!flag) ? 0f : 1f);
m_triggerAnimT = Mathf.MoveTowards(m_triggerAnimT, num, Time.deltaTime * TriggerAnimSpeed);
if ((Object)(object)TriggerTransform != (Object)null)
{
TriggerTransform.localEulerAngles = Vector3.Lerp(TriggerRestEuler, TriggerPulledEuler, m_triggerAnimT);
}
if (flag && base.HasTrigger && !IsSafetyOn && !base.Chamber.IsSpent && base.Chamber.IsFull)
{
((SimpleLauncher)this).Fire();
}
sightCurLerp = Mathf.MoveTowards(sightCurLerp, sightTarLerp, Time.deltaTime * SightUnlatchSpeed);
if (Mathf.Abs(sightCurLerp - sightLastLerp) > 0.01f && (Object)(object)SightToUnlatch != (Object)null)
{
float num2 = Mathf.Lerp(SightStartAngle, SightEndAngle, sightCurLerp);
switch (SightAxis)
{
case Axis.X:
SightToUnlatch.localEulerAngles = new Vector3(num2, 0f, 0f);
break;
case Axis.Y:
SightToUnlatch.localEulerAngles = new Vector3(0f, num2, 0f);
break;
case Axis.Z:
SightToUnlatch.localEulerAngles = new Vector3(0f, 0f, num2);
break;
}
}
sightLastLerp = sightCurLerp;
}
}
public class PansarskottSafety : FVRPhysicalObject
{
[Header("Pin Settings")]
public Transform PinRoot;
public Transform PinHomePosition;
public float RemovalDistance = 0.05f;
private bool _isRemoved = false;
public bool IsRemoved => _isRemoved;
public event Action OnSafetyRemoved;
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0041: 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)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (!_isRemoved && (Object)(object)PinRoot != (Object)null && (Object)(object)PinHomePosition != (Object)null)
{
float num = Vector3.Distance(PinRoot.position, PinHomePosition.position);
if (num > RemovalDistance)
{
RemovePin();
}
}
}
public void RemovePin()
{
if (!_isRemoved)
{
_isRemoved = true;
if (this.OnSafetyRemoved != null)
{
this.OnSafetyRemoved();
}
}
}
}
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;
}
}