using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using OtherLoader; using ShermanJumbo; using UnityEditor; using UnityEngine; using UnityEngine.UI; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] 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(); 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(); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).gameObject.AddComponent(); } 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(base.SpawnOnSplode[i], ((Component)this).transform.position, Quaternion.identity); Explosion component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.IFF = base.IFF; } ExplosionSound component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.IFF = base.IFF; } GrenadeExplosion component3 = val.GetComponent(); 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(); if ((Object)(object)component != (Object)null && !isStuck && isPinPulled && !((FVRInteractiveObject)this).IsHeld) { Vector3 velocity = component.velocity; RaycastHit val = default(RaycastHit); if (((Vector3)(ref velocity)).magnitude <= MinStickVelocity && (Object)(object)RaycastDir != (Object)null && Physics.Raycast(RaycastDir.position, RaycastDir.forward, ref val, 2f, LayerMask.op_Implicit(StickLayer))) { isStuck = true; isLocked = true; component.isKinematic = true; component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; ((Component)this).transform.position = ((RaycastHit)(ref val)).point; stuckNormal = ((RaycastHit)(ref val)).normal; stuckToSurface = ((RaycastHit)(ref val)).transform; if ((Object)(object)BottomPartToDisable != (Object)null) { BottomPartToDisable.SetActive(false); } } } if (isLocked && ((FVRInteractiveObject)this).IsHeld) { isLocked = false; if ((Object)(object)component != (Object)null) { component.isKinematic = false; } } } } namespace VolksScripts { public class BreacherDrone : FVRPhysicalObject, IFVRDamageable { [Serializable] public class WingAnimator { public Transform Wing; public Vector3 FoldedLocalEulers = Vector3.zero; public Vector3 DeployedLocalEulers = new Vector3(0f, 0f, 90f); [Tooltip("How fast the wing moves (0→1 per second). 2 = fully deployed in 0.5s.")] public float AnimSpeed = 2f; } [Serializable] public class PropellerSpinner { public enum SpinAxis { X, Y, Z } public Transform Propeller; public SpinAxis Axis = SpinAxis.Y; [Tooltip("Max spin speed in degrees per second.")] public float MaxSpinSpeed = 1800f; [Tooltip("How fast spin ramps up/down (degrees per second squared).")] public float RampSpeed = 900f; [HideInInspector] public float CurrentSpeed = 0f; } [Header("Wings & Propellers")] public List Wings = new List(); public List Propellers = new List(); [Header("Activation Effects")] [Tooltip("Mesh GameObject toggled ON when the drone is activated (e.g. an LED or glow mesh).")] public GameObject ActivatedMesh; public AudioSource ActivationSound; public AudioSource PropellerLoopSound; [Header("Flight")] [Tooltip("Continuous thrust force (N) in the drone's forward direction while flying.")] public float ThrustForce = 5f; [Tooltip("Radius of the forward SphereCast used to detect impacts. Increase if drone tunnels through thin walls.")] public float ImpactCheckRadius = 0.05f; [Tooltip("Minimum lookahead distance (metres) for the impact SphereCast. Automatically scales with speed.")] public float ImpactCheckDistance = 0.15f; [Header("Arm Delay")] [Tooltip("Seconds after launch before collision can trigger detonation. Prevents accidental explosion on release.")] public float ArmDelay = 1f; [Header("Explosion — Collision")] [Tooltip("Layers that trigger detonation on contact once armed.")] public LayerMask ExplosionLayerMask; [Tooltip("If true, any collision triggers detonation instead of only matching layers.")] public bool ExplodeOnAnyCollision = false; [Header("Explosion — Timer")] [Tooltip("Seconds after launch before auto-detonation. 0 = disabled.")] public float AutoDestructTime = 15f; [Header("Explosion — Beeping")] [Tooltip("AudioSource for the beep (short one-shot clip). Assigned on the GameObject — NOT pooled.")] public AudioSource BeepAudioSource; [Tooltip("Remaining seconds on the timer at which beeping begins.")] public float BeepStartAtSeconds = 5f; public float BeepPitchStart = 1f; public float BeepPitchEnd = 2f; [Tooltip("Beep interval at start (seconds).")] public float BeepRefireStart = 0.8f; [Tooltip("Beep interval at end (seconds).")] public float BeepRefireEnd = 0.05f; [Header("Explosion — Shot")] public bool ExplodeOnShot = true; public float ShotDamageThreshold = 10f; [Header("Explosion — Payload")] public List SpawnOnExplode = new List(); public int IFF; [Header("Debug")] public bool EnableDebug = false; private bool m_isActivated = false; private bool m_isLaunched = false; private bool m_hasExploded = false; private bool m_isArmed = false; private float m_armTimer = 0f; private float m_autoDestructTimer = 0f; private float m_beepTimer = 0f; private float[] m_wingLerps; public override void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).Awake(); Collider component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { Bounds bounds = component.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; ImpactCheckRadius = ((Vector3)(ref extents)).magnitude * 0.5f; } m_wingLerps = new float[Wings.Count]; for (int i = 0; i < Wings.Count; i++) { m_wingLerps[i] = 0f; if ((Object)(object)Wings[i].Wing != (Object)null) { Wings[i].Wing.localEulerAngles = Wings[i].FoldedLocalEulers; } } if ((Object)(object)ActivatedMesh != (Object)null) { ActivatedMesh.SetActive(false); } if ((Object)(object)PropellerLoopSound != (Object)null) { PropellerLoopSound.Stop(); } if ((Object)(object)BeepAudioSource != (Object)null) { BeepAudioSource.Stop(); } } private void OnDrawGizmosSelected() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(1f, 0.4f, 0f, 0.35f); Gizmos.DrawSphere(((Component)this).transform.position, ImpactCheckRadius); Gizmos.color = new Color(1f, 0.4f, 0f, 0.9f); Gizmos.DrawWireSphere(((Component)this).transform.position, ImpactCheckRadius); Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * ImpactCheckDistance; Gizmos.color = new Color(1f, 0.8f, 0f, 0.9f); Gizmos.DrawLine(((Component)this).transform.position, val); Gizmos.DrawWireSphere(val, ImpactCheckRadius); Handles.color = new Color(1f, 0.8f, 0f, 0.5f); Handles.Label(val + Vector3.up * (ImpactCheckRadius + 0.05f), "Impact lookahead: " + ImpactCheckDistance.ToString("F2") + "m"); } public void ToggleActivation() { if (m_hasExploded || m_isLaunched) { return; } m_isActivated = !m_isActivated; if (m_isActivated) { if ((Object)(object)ActivatedMesh != (Object)null) { ActivatedMesh.SetActive(true); } if ((Object)(object)ActivationSound != (Object)null) { ActivationSound.Stop(); ActivationSound.Play(); } if ((Object)(object)PropellerLoopSound != (Object)null) { PropellerLoopSound.loop = true; PropellerLoopSound.Play(); } } else { if ((Object)(object)ActivatedMesh != (Object)null) { ActivatedMesh.SetActive(false); } if ((Object)(object)PropellerLoopSound != (Object)null) { PropellerLoopSound.Stop(); } } DebugLog("Toggled — activated: " + m_isActivated); } public override void EndInteraction(FVRViveHand hand) { if (m_isActivated && !m_isLaunched && !m_hasExploded) { m_isLaunched = true; m_isArmed = false; m_armTimer = 0f; if (AutoDestructTime > 0f) { m_autoDestructTimer = AutoDestructTime; m_beepTimer = 0f; } if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.collisionDetectionMode = (CollisionDetectionMode)2; } DebugLog("Launched! Arm delay: " + ArmDelay + "s Auto-destruct: " + AutoDestructTime + "s"); } ((FVRPhysicalObject)this).EndInteraction(hand); } public override void FVRFixedUpdate() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) ((FVRPhysicalObject)this).FVRFixedUpdate(); if (!m_isLaunched || m_hasExploded || (Object)(object)((FVRPhysicalObject)this).RootRigidbody == (Object)null) { return; } ((FVRPhysicalObject)this).RootRigidbody.AddForce(((Component)this).transform.forward * ThrustForce, (ForceMode)0); if (m_isArmed) { Vector3 velocity = ((FVRPhysicalObject)this).RootRigidbody.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; float num = Mathf.Max(ImpactCheckDistance, magnitude * Time.fixedDeltaTime * 2f); Vector3 val = ((!(magnitude > 0.01f)) ? ((Component)this).transform.forward : ((Vector3)(ref velocity)).normalized); LayerMask val2 = ((!ExplodeOnAnyCollision) ? ExplosionLayerMask : LayerMask.op_Implicit(-1)); RaycastHit val3 = default(RaycastHit); if (Physics.SphereCast(((Component)this).transform.position, ImpactCheckRadius, val, ref val3, num, LayerMask.op_Implicit(val2), (QueryTriggerInteraction)1)) { DebugLog("SphereCast impact: " + ((Object)((Component)((RaycastHit)(ref val3)).collider).gameObject).name); Explode(); } } } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); UpdateWings(); UpdatePropellers(); UpdateArming(); UpdateAutoDestruct(); } public override void OnCollisionEnter(Collision col) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).OnCollisionEnter(col); if (m_isLaunched && m_isArmed && !m_hasExploded && (ExplodeOnAnyCollision || ((1 << col.gameObject.layer) & LayerMask.op_Implicit(ExplosionLayerMask)) != 0)) { DebugLog("Collision detonation."); Explode(); } } public void Damage(Damage d) { if (!m_hasExploded && ExplodeOnShot && d.Dam_TotalKinetic >= ShotDamageThreshold) { DebugLog("Shot detonation — damage: " + d.Dam_TotalKinetic.ToString("F2")); Explode(); } } private void UpdateArming() { if (m_isLaunched && !m_isArmed && !m_hasExploded) { m_armTimer += Time.deltaTime; if (m_armTimer >= ArmDelay) { m_isArmed = true; DebugLog("Armed."); } } } private void UpdateAutoDestruct() { if (!m_isLaunched || m_hasExploded || AutoDestructTime <= 0f) { return; } m_autoDestructTimer -= Time.deltaTime; if ((Object)(object)BeepAudioSource != (Object)null && m_autoDestructTimer <= BeepStartAtSeconds && m_autoDestructTimer > 0f) { m_beepTimer -= Time.deltaTime; if (m_beepTimer <= 0f) { float num = Mathf.Clamp01(1f - m_autoDestructTimer / BeepStartAtSeconds); num = Mathf.Pow(num, 2f); m_beepTimer = Mathf.Lerp(BeepRefireStart, BeepRefireEnd, num); BeepAudioSource.pitch = Mathf.Lerp(BeepPitchStart, BeepPitchEnd, num); BeepAudioSource.Play(); } } if (m_autoDestructTimer <= 0f) { DebugLog("Auto-destruct triggered."); Explode(); } } private void UpdateWings() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) float num = ((!m_isActivated) ? 0f : 1f); for (int i = 0; i < Wings.Count; i++) { WingAnimator wingAnimator = Wings[i]; if (!((Object)(object)wingAnimator.Wing == (Object)null)) { m_wingLerps[i] = Mathf.MoveTowards(m_wingLerps[i], num, wingAnimator.AnimSpeed * Time.deltaTime); float num2 = m_wingLerps[i]; wingAnimator.Wing.localEulerAngles = new Vector3(Mathf.LerpAngle(wingAnimator.FoldedLocalEulers.x, wingAnimator.DeployedLocalEulers.x, num2), Mathf.LerpAngle(wingAnimator.FoldedLocalEulers.y, wingAnimator.DeployedLocalEulers.y, num2), Mathf.LerpAngle(wingAnimator.FoldedLocalEulers.z, wingAnimator.DeployedLocalEulers.z, num2)); } } } private void UpdatePropellers() { for (int i = 0; i < Propellers.Count; i++) { PropellerSpinner propellerSpinner = Propellers[i]; if ((Object)(object)propellerSpinner.Propeller == (Object)null) { continue; } float num = ((!m_isActivated) ? 0f : propellerSpinner.MaxSpinSpeed); propellerSpinner.CurrentSpeed = Mathf.MoveTowards(propellerSpinner.CurrentSpeed, num, propellerSpinner.RampSpeed * Time.deltaTime); if (!(Mathf.Abs(propellerSpinner.CurrentSpeed) < Mathf.Epsilon)) { float num2 = propellerSpinner.CurrentSpeed * Time.deltaTime; switch (propellerSpinner.Axis) { case PropellerSpinner.SpinAxis.X: propellerSpinner.Propeller.Rotate(num2, 0f, 0f, (Space)1); break; case PropellerSpinner.SpinAxis.Y: propellerSpinner.Propeller.Rotate(0f, num2, 0f, (Space)1); break; case PropellerSpinner.SpinAxis.Z: propellerSpinner.Propeller.Rotate(0f, 0f, num2, (Space)1); break; } } } } private void Explode() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (m_hasExploded) { return; } m_hasExploded = true; m_isActivated = false; if ((Object)(object)PropellerLoopSound != (Object)null) { PropellerLoopSound.Stop(); } if ((Object)(object)BeepAudioSource != (Object)null) { BeepAudioSource.Stop(); } if ((Object)(object)ActivatedMesh != (Object)null) { ActivatedMesh.SetActive(false); } for (int i = 0; i < SpawnOnExplode.Count; i++) { if (!((Object)(object)SpawnOnExplode[i] == (Object)null)) { GameObject val = Object.Instantiate(SpawnOnExplode[i], ((Component)this).transform.position, Quaternion.identity); Explosion component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.IFF = IFF; } ExplosionSound component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.IFF = IFF; } GrenadeExplosion component3 = val.GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.IFF = IFF; } } } if (((FVRInteractiveObject)this).IsHeld) { FVRViveHand hand = ((FVRInteractiveObject)this).m_hand; ((FVRInteractiveObject)this).m_hand.ForceSetInteractable((FVRInteractiveObject)null); ((FVRInteractiveObject)this).EndInteraction(hand); } Object.Destroy((Object)(object)((Component)this).gameObject); } private void DebugLog(string msg) { if (EnableDebug) { Debug.Log((object)("[BreacherDrone] " + msg)); } } } public class BreacherDroneButton : FVRInteractiveObject { [Header("Breacher Drone Button")] public BreacherDrone Drone; [Tooltip("Minimum time (seconds) between presses.")] public float PressCooldown = 0.3f; [Header("Press Animation")] [Tooltip("The transform to animate on press (the button visual mesh).")] public Transform ButtonVisual; public Vector3 RestLocalPos = Vector3.zero; public Vector3 RestLocalRot = Vector3.zero; public Vector3 PressedLocalPos = new Vector3(0f, -0.002f, 0f); public Vector3 PressedLocalRot = Vector3.zero; [Tooltip("Time in seconds to reach the pressed position.")] public float PressDuration = 0.05f; [Tooltip("Time in seconds to return to rest.")] public float ReturnDuration = 0.1f; private float m_lastPressTime = -1f; private bool m_isAnimating = false; private bool m_isReturning = false; private float m_animLerp = 0f; public override void SimpleInteraction(FVRViveHand hand) { if (!((Object)(object)Drone == (Object)null) && !(Time.time - m_lastPressTime < PressCooldown) && !m_isAnimating) { m_lastPressTime = Time.time; ((FVRInteractiveObject)this).SimpleInteraction(hand); Drone.ToggleActivation(); if ((Object)(object)ButtonVisual != (Object)null) { m_isAnimating = true; m_isReturning = false; m_animLerp = 0f; } } } public override void FVRUpdate() { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!m_isAnimating || (Object)(object)ButtonVisual == (Object)null) { return; } float num = ((!m_isReturning) ? PressDuration : ReturnDuration); m_animLerp += Time.deltaTime / num; if (m_animLerp >= 1f) { m_animLerp = 1f; if (m_isReturning) { m_isAnimating = false; m_animLerp = 0f; ButtonVisual.localPosition = RestLocalPos; ButtonVisual.localEulerAngles = RestLocalRot; return; } m_isReturning = true; m_animLerp = 0f; } if (m_isReturning) { ButtonVisual.localPosition = Vector3.Lerp(PressedLocalPos, RestLocalPos, m_animLerp); ButtonVisual.localEulerAngles = Vector3.Lerp(PressedLocalRot, RestLocalRot, m_animLerp); } else { ButtonVisual.localPosition = Vector3.Lerp(RestLocalPos, PressedLocalPos, m_animLerp); ButtonVisual.localEulerAngles = Vector3.Lerp(RestLocalRot, PressedLocalRot, m_animLerp); } } } public class BriefcaseNukeButton : FVRInteractiveObject { public enum NukeButtonType { Number, Confirm, Reset } [Header("Briefcase Nuke Button")] public Briefcase_Nuke Nuke; public NukeButtonType ButtonType = NukeButtonType.Number; [Tooltip("The number this button types (0-9). Only used when ButtonType is Number.")] public int NumberValue; [Tooltip("Minimum time (seconds) between button presses.")] public float PressCooldown = 0.25f; [Header("Press Animation")] [Tooltip("The transform to animate (the button visual mesh). If null, no animation plays.")] public Transform ButtonVisual; [Tooltip("Local position of the button at rest.")] public Vector3 RestLocalPos = Vector3.zero; [Tooltip("Local rotation of the button at rest.")] public Vector3 RestLocalRot = Vector3.zero; [Tooltip("Local position of the button when fully pressed.")] public Vector3 PressedLocalPos = new Vector3(0f, -0.002f, 0f); [Tooltip("Local rotation of the button when fully pressed.")] public Vector3 PressedLocalRot = Vector3.zero; [Tooltip("Time in seconds for the button to go from rest to pressed.")] public float PressDuration = 0.05f; [Tooltip("Time in seconds for the button to return from pressed to rest.")] public float ReturnDuration = 0.1f; private bool m_isAnimating = false; private bool m_isReturning = false; private float m_animLerp = 0f; private float m_lastPressTime = -1f; public override void SimpleInteraction(FVRViveHand hand) { if (!((Object)(object)Nuke == (Object)null) && !((Object)(object)((FVRPhysicalObject)Nuke).QuickbeltSlot != (Object)null) && !m_isAnimating && !(Time.time - m_lastPressTime < PressCooldown)) { m_lastPressTime = Time.time; ((FVRInteractiveObject)this).SimpleInteraction(hand); switch (ButtonType) { case NukeButtonType.Number: Nuke.TypeNumber(NumberValue); break; case NukeButtonType.Confirm: Nuke.ConfirmAndStart(hand); break; case NukeButtonType.Reset: Nuke.ResetTimer(hand); break; } if ((Object)(object)ButtonVisual != (Object)null) { m_isAnimating = true; m_animLerp = 0f; m_isReturning = false; } } } public override void FVRUpdate() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!m_isAnimating || (Object)(object)ButtonVisual == (Object)null) { return; } m_animLerp += Time.deltaTime / ((!m_isReturning) ? PressDuration : ReturnDuration); if (m_animLerp >= 1f) { m_animLerp = 1f; if (m_isReturning) { m_isAnimating = false; m_animLerp = 0f; ButtonVisual.localPosition = RestLocalPos; ButtonVisual.localEulerAngles = RestLocalRot; return; } m_isReturning = true; m_animLerp = 0f; } float animLerp = m_animLerp; if (m_isReturning) { ButtonVisual.localPosition = Vector3.Lerp(PressedLocalPos, RestLocalPos, animLerp); ButtonVisual.localEulerAngles = Vector3.Lerp(PressedLocalRot, RestLocalRot, animLerp); } else { ButtonVisual.localPosition = Vector3.Lerp(RestLocalPos, PressedLocalPos, animLerp); ButtonVisual.localEulerAngles = Vector3.Lerp(RestLocalRot, PressedLocalRot, animLerp); } } } public class Briefcase_Nuke : FVRPhysicalObject, IFVRDamageable { private int[] digits = new int[5]; private float m_remainingTime; private bool m_isCounting; private bool m_hasDetonated; private float m_lastTickTime; private float m_tick1Timer; private float m_tick2Timer; [Header("Timer Display")] public Text TimerText; [Header("Armed Indicator")] public GameObject CountdownIndicator; [Header("Armed State Visuals")] public List ArmedObjects = new List(); public List DisarmedObjects = new List(); public List ArmedParticles = new List(); [Header("Explosion")] public List SpawnOnDetonate = new List(); [Header("Tick Audio 1 — Main Countdown")] [Tooltip("AudioSource on this GameObject for the per-second tick. Play On Awake OFF.")] public AudioSource Tick1AudioSource; public bool Tick1UsePitchRamp = true; public float Tick1PitchStart = 1f; public float Tick1PitchEnd = 1.5f; public float Tick1PitchRampOverSeconds = 30f; [Header("Tick Audio 2 — Urgent Countdown")] [Tooltip("AudioSource on this GameObject for the urgent tick. Play On Awake OFF.")] public AudioSource Tick2AudioSource; public float Tick2StartAtSeconds = 10f; public float Tick2Interval = 0.5f; public bool Tick2UsePitchRamp = false; public float Tick2PitchStart = 1f; public float Tick2PitchEnd = 1.8f; [Header("Audio")] public AudioEvent AudEvent_DigitChange; public AudioEvent AudEvent_Confirm; public AudioEvent AudEvent_Reset; public AudioEvent AudEvent_Error; public void TypeNumber(int number) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!m_isCounting && !m_hasDetonated && number >= 0 && number <= 9) { for (int i = 0; i < 4; i++) { digits[i] = digits[i + 1]; } digits[4] = number; digits[1] = Mathf.Min(digits[1], 5); digits[3] = Mathf.Min(digits[3], 5); SM.PlayGenericSound(AudEvent_DigitChange, ((Component)this).transform.position); UpdateDisplay(); } } public void ConfirmAndStart(FVRViveHand hand) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (!m_hasDetonated && (!((FVRInteractiveObject)this).IsHeld || !((Object)(object)hand == (Object)(object)((FVRInteractiveObject)this).m_hand)) && !m_isCounting) { float totalSecondsFromDigits = GetTotalSecondsFromDigits(); if (totalSecondsFromDigits <= 0f) { SM.PlayGenericSound(AudEvent_Error, ((Component)this).transform.position); return; } m_remainingTime = totalSecondsFromDigits; m_isCounting = true; m_lastTickTime = m_remainingTime; m_tick1Timer = 0f; m_tick2Timer = 0f; SM.PlayGenericSound(AudEvent_Confirm, ((Component)this).transform.position); SetArmedState(armed: true); UpdateDisplay(); } } public void ResetTimer(FVRViveHand hand) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (!m_hasDetonated && (!((FVRInteractiveObject)this).IsHeld || !((Object)(object)hand == (Object)(object)((FVRInteractiveObject)this).m_hand))) { m_isCounting = false; m_remainingTime = 0f; m_tick1Timer = 0f; m_tick2Timer = 0f; for (int i = 0; i < 5; i++) { digits[i] = 0; } if ((Object)(object)Tick1AudioSource != (Object)null) { Tick1AudioSource.Stop(); } if ((Object)(object)Tick2AudioSource != (Object)null) { Tick2AudioSource.Stop(); } SM.PlayGenericSound(AudEvent_Reset, ((Component)this).transform.position); SetArmedState(armed: false); UpdateDisplay(); } } private void SetArmedState(bool armed) { if ((Object)(object)CountdownIndicator != (Object)null) { CountdownIndicator.SetActive(armed); } for (int i = 0; i < ArmedObjects.Count; i++) { if ((Object)(object)ArmedObjects[i] != (Object)null) { ArmedObjects[i].SetActive(armed); } } for (int j = 0; j < DisarmedObjects.Count; j++) { if ((Object)(object)DisarmedObjects[j] != (Object)null) { DisarmedObjects[j].SetActive(!armed); } } for (int k = 0; k < ArmedParticles.Count; k++) { if (!((Object)(object)ArmedParticles[k] == (Object)null)) { if (armed) { ArmedParticles[k].Play(); } else { ArmedParticles[k].Stop(true, (ParticleSystemStopBehavior)0); } } } } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if (!m_hasDetonated && m_isCounting) { m_remainingTime -= Time.deltaTime; TickAudio1(); TickAudio2(); m_lastTickTime = m_remainingTime; UpdateDigitsFromTime(); UpdateDisplay(); if (m_remainingTime <= 0f) { m_remainingTime = 0f; Detonate(); } } } private void TickAudio1() { if ((Object)(object)Tick1AudioSource == (Object)null || (Object)(object)Tick1AudioSource.clip == (Object)null) { return; } float num = Mathf.Ceil(m_remainingTime); if (!(num >= Mathf.Ceil(m_lastTickTime)) && !(m_remainingTime <= 0f)) { if (Tick1UsePitchRamp) { float num2 = Mathf.Clamp01(1f - m_remainingTime / Tick1PitchRampOverSeconds); num2 = Mathf.Pow(num2, 2f); Tick1AudioSource.pitch = Mathf.Lerp(Tick1PitchStart, Tick1PitchEnd, num2); } else { Tick1AudioSource.pitch = Tick1PitchStart; } Tick1AudioSource.Play(); } } private void TickAudio2() { if ((Object)(object)Tick2AudioSource == (Object)null || (Object)(object)Tick2AudioSource.clip == (Object)null || m_remainingTime > Tick2StartAtSeconds) { return; } m_tick2Timer -= Time.deltaTime; if (!(m_tick2Timer > 0f)) { m_tick2Timer = Tick2Interval; if (Tick2UsePitchRamp) { float num = Mathf.Clamp01(1f - m_remainingTime / Tick2StartAtSeconds); num = Mathf.Pow(num, 2f); Tick2AudioSource.pitch = Mathf.Lerp(Tick2PitchStart, Tick2PitchEnd, num); } else { Tick2AudioSource.pitch = Tick2PitchStart; } Tick2AudioSource.Play(); } } private void Detonate() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (m_hasDetonated) { return; } m_hasDetonated = true; m_isCounting = false; if ((Object)(object)Tick1AudioSource != (Object)null) { Tick1AudioSource.Stop(); } if ((Object)(object)Tick2AudioSource != (Object)null) { Tick2AudioSource.Stop(); } for (int i = 0; i < SpawnOnDetonate.Count; i++) { if ((Object)(object)SpawnOnDetonate[i] != (Object)null) { Object.Instantiate(SpawnOnDetonate[i], ((Component)this).transform.position, ((Component)this).transform.rotation); } } Object.Destroy((Object)(object)((Component)this).gameObject); } public void Damage(Damage d) { if (!((FVRInteractiveObject)this).IsHeld && !((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null)) { m_isCounting = true; m_remainingTime = Mathf.Min(m_remainingTime, Random.Range(0.1f, 0.3f)); } } private void UpdateDisplay() { if ((Object)(object)TimerText != (Object)null) { TimerText.text = $"{digits[0]}:{digits[1]}{digits[2]}:{digits[3]}{digits[4]}"; } } private void UpdateDigitsFromTime() { int num = Mathf.CeilToInt(Mathf.Max(0f, m_remainingTime)); int num2 = num / 3600; int num3 = num % 3600 / 60; int num4 = num % 60; digits[0] = Mathf.Clamp(num2, 0, 9); digits[1] = num3 / 10; digits[2] = num3 % 10; digits[3] = num4 / 10; digits[4] = num4 % 10; } private float GetTotalSecondsFromDigits() { int num = digits[0]; int num2 = digits[1] * 10 + digits[2]; int num3 = digits[3] * 10 + digits[4]; return (float)num * 3600f + (float)num2 * 60f + (float)num3; } } public class IceGrenade : PinnedGrenade { public GameObject pullPinEffectObject; public Material newMaterial; private Material originalMaterial; private Renderer grenadeRenderer; private bool materialChanged = false; public override void Start() { ((FVRInteractiveObject)this).Start(); grenadeRenderer = ((Component)this).GetComponentInChildren(); if ((Object)(object)grenadeRenderer != (Object)null) { originalMaterial = grenadeRenderer.material; } if ((Object)(object)pullPinEffectObject != (Object)null) { pullPinEffectObject.SetActive(false); } } public override void FVRUpdate() { ((PinnedGrenade)this).FVRUpdate(); if (base.m_isPinPulled && !materialChanged) { if ((Object)(object)pullPinEffectObject != (Object)null && !pullPinEffectObject.activeSelf) { pullPinEffectObject.SetActive(true); } if ((Object)(object)grenadeRenderer != (Object)null && (Object)(object)newMaterial != (Object)null) { grenadeRenderer.material = newMaterial; materialChanged = true; } } } } } public class Idle : StateMachineBehaviour { } public class LazeTargeting : FVRPhysicalObject { [Header("Laze Settings")] public Transform LaserOrigin; public LayerMask LazeLayerMask; public GameObject ArrowIndicator; public Image FillBar; public Text StatusText; public AudioEvent ConfirmedSound; public AudioEvent DeniedSound; public AudioEvent ErrorSound; [Tooltip("List of possible strike prefabs. First is default.")] public List StrikePrefabs; public float HoldTimeToConfirm = 2f; public float CooldownTime = 5f; public float MaxLazeDistance = 500f; public float SpawnAltitude = 100f; public int StrikeCount = 1; public float StrikeInterval = 0.2f; public float StrikeSpread = 0f; public LayerMask SkyObstructionMask; [Header("Strike Type UI")] public GameObject StrikeTypeUI; [Header("Laser Visuals")] public LaserLight laserLight; public AudioEvent LaserOnSound; public AudioEvent LaserOffSound; [Header("Strike Type Text")] public GameObject TextRoot; public Text TextField; [Header("Strike Knob Visual")] public Transform StrikeKnobMesh; [Tooltip("Set true for translation, false for rotation, per strike type.")] public bool[] UseTranslationForStrike; public Vector3 KnobTranslation = new Vector3(0f, 0.02f, 0f); public Vector3 KnobRotation = new Vector3(0f, 30f, 0f); [Header("Laser Button Visual")] public Transform LaserButtonMesh; public Vector3 LaserButtonDefaultLocalPos = Vector3.zero; public Vector3 LaserButtonPressedLocalPos = new Vector3(0f, -0.01f, 0f); private float holdTimer = 0f; private float cooldownTimer = 0f; private bool isLazing = false; private RaycastHit hit; private int currentStrikeIndex = 0; private bool isStrikeTypeUIActive = false; private bool isButtonHeld = false; private float buttonHeldTime = 0f; private bool hasEventFiredSincePress = false; private float holdToOpenStrikeUI = 0.6f; private bool m_isLaserOn = false; public override void FVRUpdate() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); UpdateLaserVisual(); Vector3 position = LaserOrigin.position; Vector3 forward = LaserOrigin.forward; float num = 1000f; bool flag = Physics.Raycast(position, forward, ref hit, num, LayerMask.op_Implicit(LazeLayerMask)); Vector3 position2; Vector3 up; if (flag) { position2 = ((RaycastHit)(ref hit)).point; up = ((RaycastHit)(ref hit)).normal; } else { position2 = position + forward * num; up = Vector3.up; } if ((Object)(object)ArrowIndicator != (Object)null) { ArrowIndicator.transform.position = position2; ArrowIndicator.transform.up = up; ArrowIndicator.SetActive(true); } if ((Object)(object)LaserButtonMesh != (Object)null) { LaserButtonMesh.localPosition = ((!m_isLaserOn) ? LaserButtonDefaultLocalPos : LaserButtonPressedLocalPos); } FVRViveHand hand = ((FVRInteractiveObject)this).m_hand; if ((Object)(object)hand != (Object)null) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; bool flag2 = (hand.IsInStreamlinedMode && hand.Input.BYButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f); bool flag3 = (hand.IsInStreamlinedMode && hand.Input.BYButtonUp) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadUp); if ((hand.IsInStreamlinedMode && hand.Input.AXButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f)) { ToggleLaser(); } if (flag2) { isButtonHeld = true; hasEventFiredSincePress = false; buttonHeldTime = 0f; } if (flag3) { if (!hasEventFiredSincePress && buttonHeldTime < holdToOpenStrikeUI && StrikePrefabs != null && StrikePrefabs.Count > 0) { currentStrikeIndex = (currentStrikeIndex + 1) % StrikePrefabs.Count; ShowStrikeText(); UpdateStrikeKnobVisual(); } isButtonHeld = false; buttonHeldTime = 0f; if (isStrikeTypeUIActive) { isStrikeTypeUIActive = false; if ((Object)(object)StrikeTypeUI != (Object)null) { StrikeTypeUI.SetActive(false); } } } if (isButtonHeld && !hasEventFiredSincePress) { buttonHeldTime += Time.deltaTime; if (buttonHeldTime >= holdToOpenStrikeUI) { hasEventFiredSincePress = true; isStrikeTypeUIActive = !isStrikeTypeUIActive; if ((Object)(object)StrikeTypeUI != (Object)null) { StrikeTypeUI.SetActive(isStrikeTypeUIActive); } if (isStrikeTypeUIActive) { ShowStrikeText(); } } } if (m_isLaserOn && hand.Input.TriggerPressed && cooldownTimer <= 0f && !isStrikeTypeUIActive) { if (flag) { holdTimer += Time.deltaTime; FillBar.fillAmount = holdTimer / HoldTimeToConfirm; StatusText.text = "Lazing..."; if (holdTimer >= HoldTimeToConfirm) { bool flag4 = ((RaycastHit)(ref hit)).distance > MaxLazeDistance; bool flag5 = Physics.Raycast(((RaycastHit)(ref hit)).point + Vector3.up * SpawnAltitude, Vector3.down, SpawnAltitude, LayerMask.op_Implicit(SkyObstructionMask)); if (flag4) { StatusText.text = "Target too far!"; ((Graphic)FillBar).color = Color.red; SM.PlayCoreSound((FVRPooledAudioType)10, DeniedSound, ((RaycastHit)(ref hit)).point); holdTimer = 0f; return; } if (flag5) { StatusText.text = "No sky sight!"; ((Graphic)FillBar).color = Color.red; SM.PlayCoreSound((FVRPooledAudioType)10, ErrorSound, ((RaycastHit)(ref hit)).point); holdTimer = 0f; return; } ((MonoBehaviour)this).StartCoroutine(SpawnStrikeBarrage(((RaycastHit)(ref hit)).point, StrikeCount, StrikeInterval, StrikeSpread, SpawnAltitude)); SM.PlayCoreSound((FVRPooledAudioType)10, ConfirmedSound, ((RaycastHit)(ref hit)).point); StatusText.text = "Strike Confirmed!"; ((Graphic)FillBar).color = Color.green; cooldownTimer = CooldownTime; holdTimer = 0f; } } else { StatusText.text = "No Target"; ((Graphic)FillBar).color = Color.red; FillBar.fillAmount = 0f; holdTimer = 0f; } } else { if (holdTimer > 0f && cooldownTimer <= 0f) { SM.PlayCoreSound((FVRPooledAudioType)10, DeniedSound, ((Component)this).transform.position); StatusText.text = "Cancelled"; ((Graphic)FillBar).color = Color.red; } holdTimer = 0f; FillBar.fillAmount = 0f; } } if (cooldownTimer > 0f) { cooldownTimer -= Time.deltaTime; StatusText.text = "Cooldown..."; ((Graphic)FillBar).color = Color.yellow; } } private void UpdateLaserVisual() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)laserLight == (Object)null) && !((Object)(object)LaserOrigin == (Object)null)) { laserLight.LaserAperture.position = LaserOrigin.position; laserLight.LaserAperture.rotation = LaserOrigin.rotation; laserLight.IsActive = m_isLaserOn; } } public void ToggleLaser() { //IL_0056: 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) m_isLaserOn = !m_isLaserOn; if ((Object)(object)laserLight != (Object)null) { laserLight.IsActive = m_isLaserOn; } if (m_isLaserOn && LaserOnSound != null) { SM.PlayCoreSound((FVRPooledAudioType)10, LaserOnSound, ((Component)this).transform.position); } else if (!m_isLaserOn && LaserOffSound != null) { SM.PlayCoreSound((FVRPooledAudioType)10, LaserOffSound, ((Component)this).transform.position); } } public void SetStrikeIndex(int idx) { if (StrikePrefabs != null && StrikePrefabs.Count != 0) { currentStrikeIndex = Mathf.Clamp(idx, 0, StrikePrefabs.Count - 1); ShowStrikeText(); UpdateStrikeKnobVisual(); } } private void ShowStrikeText() { if ((Object)(object)TextField != (Object)null && StrikePrefabs != null && StrikePrefabs.Count > 0) { TextField.text = "Strike: " + ((Object)StrikePrefabs[currentStrikeIndex]).name; if ((Object)(object)TextRoot != (Object)null) { TextRoot.SetActive(true); } ((MonoBehaviour)this).StopCoroutine("HideStrikeText"); ((MonoBehaviour)this).StartCoroutine("HideStrikeText"); } if ((Object)(object)StatusText != (Object)null && StrikePrefabs != null && StrikePrefabs.Count > 0) { StatusText.text = "Strike: " + ((Object)StrikePrefabs[currentStrikeIndex]).name; } } private void UpdateStrikeKnobVisual() { //IL_0099: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_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_0082: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)StrikeKnobMesh == (Object)null) && StrikePrefabs != null && StrikePrefabs.Count != 0) { int num = currentStrikeIndex; bool flag = false; if (UseTranslationForStrike != null && num < UseTranslationForStrike.Length) { flag = UseTranslationForStrike[num]; } if (flag) { StrikeKnobMesh.localPosition = KnobTranslation * (float)num; StrikeKnobMesh.localRotation = Quaternion.identity; } else { StrikeKnobMesh.localPosition = Vector3.zero; StrikeKnobMesh.localRotation = Quaternion.Euler(KnobRotation * (float)num); } } } private IEnumerator HideStrikeText() { yield return (object)new WaitForSeconds(1f); if ((Object)(object)TextRoot != (Object)null) { TextRoot.SetActive(false); } } private IEnumerator SpawnStrikeBarrage(Vector3 target, int count, float interval, float spread, float altitude) { //IL_0016: 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) Debug.Log((object)("SpawnStrikeBarrage called. Prefab count: " + ((StrikePrefabs == null) ? "null" : StrikePrefabs.Count.ToString()))); for (int i = 0; i < count; i++) { Vector3 offset = (Vector3)((!(spread > 0f)) ? Vector3.zero : new Vector3(Random.Range(0f - spread, spread), 0f, Random.Range(0f - spread, spread))); Vector3 spawnPos = target + offset + Vector3.up * altitude; if (StrikePrefabs != null && StrikePrefabs.Count > 0 && (Object)(object)StrikePrefabs[currentStrikeIndex] != (Object)null) { Debug.Log((object)("Spawning prefab: " + ((Object)StrikePrefabs[currentStrikeIndex]).name + " at " + spawnPos)); Object.Instantiate(StrikePrefabs[currentStrikeIndex], spawnPos, Quaternion.identity); } else { Debug.LogError((object)"Strike prefab is null or not assigned!"); } yield return (object)new WaitForSeconds(interval); } } } 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(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(); 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(); Collider component2 = ((Component)this).GetComponent(); 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.PropaneBomb { [BepInPlugin("Volks.PropaneBomb", "PropaneBomb", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class PropaneBombPlugin : 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.PropaneBomb"); OtherLoader.RegisterDirectLoad(BasePath, "Volks.PropaneBomb", "", "", "propanebomb", ""); } } } public class AttachableHammerFirearm : AttachableFirearm { [Header("Hammer Params")] public Transform Hammer; public bool HasVisibleHammer = true; public bool CanCockHammer = true; public Axis HammerAxis; public InterpStyle HammerInterp = (InterpStyle)1; public float HammerMinRot; public float HammerMaxRot = -70f; [Header("Trigger Params")] public Transform Trigger; public Vector2 TriggerForwardBackRots; [Header("Chamber")] public FVRFireArmChamber Chamber; private bool m_isHammerCocked; private bool m_isTriggerReset = true; public void CockHammer() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!m_isHammerCocked && CanCockHammer) { m_isHammerCocked = true; if ((Object)(object)Hammer != (Object)null) { SetAnimatedComponent(Hammer, HammerMaxRot, HammerInterp, HammerAxis); } ((AttachableFirearm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } public void SetHammerCocked(bool cocked) { //IL_003b: 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) m_isHammerCocked = cocked; if ((Object)(object)Hammer != (Object)null) { float rot = ((!cocked) ? HammerMinRot : HammerMaxRot); SetAnimatedComponent(Hammer, rot, HammerInterp, HammerAxis); } } public override void ProcessInput(FVRViveHand hand, bool fromInterface, FVRInteractiveObject o) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) ((AttachableFirearm)this).ProcessInput(hand, fromInterface, o); if ((Object)(object)Trigger != (Object)null) { float triggerFloat = hand.Input.TriggerFloat; float x = Mathf.Lerp(TriggerForwardBackRots.x, TriggerForwardBackRots.y, triggerFloat); Vector3 localEulerAngles = Trigger.localEulerAngles; localEulerAngles.x = x; Trigger.localEulerAngles = localEulerAngles; } if (CanCockHammer) { if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown) { CockHammer(); } } else if (hand.Input.TouchpadUp) { CockHammer(); } } if (m_isHammerCocked && hand.Input.TriggerFloat > 0.7f && m_isTriggerReset) { m_isTriggerReset = false; SetHammerCocked(cocked: false); if ((Object)(object)Chamber != (Object)null && Chamber.IsFull && !Chamber.IsSpent) { FireHammerAction(fromInterface); } else { ((AttachableFirearm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f); } } else if (hand.Input.TriggerFloat < 0.2f && !m_isTriggerReset) { m_isTriggerReset = true; } } private void FireHammerAction(bool firedFromInterface) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Chamber != (Object)null && Chamber.Fire()) { ((AttachableFirearm)this).FireMuzzleSmoke(); ((AttachableFirearm)this).Fire(Chamber, ((AttachableFirearm)this).GetMuzzle(), true, (FVRFireArm)null, 1f); ((AttachableFirearm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); ((AttachableFirearm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); Chamber.SetRound((FVRFireArmRound)null, false); Chamber.UpdateProxyDisplay(); } } protected void SetAnimatedComponent(Transform t, float rot, InterpStyle interp, Axis axis) { //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_0019: 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_0023: Invalid comparison between Unknown and I4 //IL_005d: 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_002b: Invalid comparison between Unknown and I4 if ((Object)(object)t == (Object)null) { return; } Vector3 localEulerAngles = t.localEulerAngles; if ((int)axis != 0) { if ((int)axis != 1) { if ((int)axis == 2) { localEulerAngles.z = rot; } } else { localEulerAngles.y = rot; } } else { localEulerAngles.x = rot; } t.localEulerAngles = localEulerAngles; } } public class TripwireMine : FVRPhysicalObject { [Header("Tripwire Settings")] public float TripwireMaxRange = 5f; public Material TripwireValidMat; public LineRenderer TripwireLineTemplate; [Header("Parts")] public GameObject DeployVisual; [Header("Explosion/Smoke")] public List SpawnOnTrigger; public SmokeSolidEmitter SmokeEmitter; [Header("Audio")] public AudioEvent TriggerSound; public AudioEvent PlantMineSound; [Header("Deployment")] public LayerMask DeployLayerMask = LayerMask.op_Implicit(-1); public float DeployCheckDistance = 0.12f; [Header("Jab Settings")] public Transform JabOrigin; public Vector3 JabDirection = Vector3.down; public float JabSinkDepth = 0.05f; [Header("Wire/Laser Settings")] public List WireOrigins = new List(); public List WireDirections = new List { Vector3.forward }; public LayerMask TripwireTriggerLayerMask = LayerMask.op_Implicit(-1); public LayerMask WireStopLayerMask = LayerMask.op_Implicit(-1); [Header("Wire End")] public GameObject WireEndPrefab; private bool isPlanted = false; private bool isArmed = false; private bool hasDetonated = false; private float cooldown = 0f; private float armingTimer = 0f; public float ArmingDelay = 0.5f; private bool pendingArming = false; private List TripwireLines = new List(); private List hasPlacedWireEnd = new List(); private List spawnedWireEnds = new List(); public override void Awake() { ((FVRPhysicalObject)this).Awake(); } public override void Start() { ((FVRInteractiveObject)this).Start(); TripwireLines.Clear(); hasPlacedWireEnd.Clear(); spawnedWireEnds.Clear(); for (int i = 0; i < WireDirections.Count; i++) { LineRenderer val = null; if ((Object)(object)TripwireLineTemplate != (Object)null) { val = Object.Instantiate(TripwireLineTemplate, ((Component)this).transform); ((Renderer)val).enabled = false; if ((Object)(object)((Renderer)val).material == (Object)null && (Object)(object)TripwireValidMat != (Object)null) { ((Renderer)val).material = TripwireValidMat; } } TripwireLines.Add(val); hasPlacedWireEnd.Add(item: false); spawnedWireEnds.Add(null); } if ((Object)(object)DeployVisual != (Object)null) { DeployVisual.SetActive(false); } } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); cooldown = 0f; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = false; } public override void OnCollisionEnter(Collision col) { ((FVRPhysicalObject)this).OnCollisionEnter(col); if (cooldown > 0.5f && ((FVRInteractiveObject)this).IsHeld && (Object)(object)col.collider.attachedRigidbody == (Object)null) { ((FVRInteractiveObject)this).ForceBreakInteraction(); ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; } } public override void FVRUpdate() { //IL_0077: 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_007c: 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_00af: 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) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0452: 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) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if (cooldown < 1f) { cooldown += Time.deltaTime; } if (!isPlanted && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null) { Vector3 val = ((!Object.op_Implicit((Object)(object)JabOrigin)) ? ((Component)this).transform.position : JabOrigin.position); Vector3 val2 = ((!Object.op_Implicit((Object)(object)JabOrigin)) ? ((Component)this).transform.TransformDirection(JabDirection) : JabOrigin.TransformDirection(JabDirection)); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, val2, ref val3, DeployCheckDistance, LayerMask.op_Implicit(DeployLayerMask), (QueryTriggerInteraction)1)) { ((Component)this).transform.position = ((RaycastHit)(ref val3)).point + ((Vector3)(ref val2)).normalized * JabSinkDepth; Vector3 normal = ((RaycastHit)(ref val3)).normal; Vector3 val4 = Vector3.ProjectOnPlane(((Component)this).transform.forward, normal); if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = Vector3.ProjectOnPlane(((Component)this).transform.right, normal); } ((Component)this).transform.rotation = Quaternion.LookRotation(val4, normal); if (!isPlanted && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null && ((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).ForceBreakInteraction(); } isPlanted = true; isArmed = true; pendingArming = false; armingTimer = 0f; base.IsPickUpLocked = true; if (PlantMineSound != null) { SM.PlayCoreSound((FVRPooledAudioType)0, PlantMineSound, ((Component)this).transform.position); } for (int i = 0; i < TripwireLines.Count; i++) { if ((Object)(object)TripwireLines[i] != (Object)null) { ((Renderer)TripwireLines[i]).enabled = true; Vector3 val5 = ((WireOrigins.Count > i && (Object)(object)WireOrigins[i] != (Object)null) ? WireOrigins[i].position : ((!Object.op_Implicit((Object)(object)JabOrigin)) ? ((Component)this).transform.position : JabOrigin.position)); TripwireLines[i].SetPosition(0, val5); TripwireLines[i].SetPosition(1, val5); if ((Object)(object)((Renderer)TripwireLines[i]).material == (Object)null && (Object)(object)TripwireValidMat != (Object)null) { ((Renderer)TripwireLines[i]).material = TripwireValidMat; } } } if ((Object)(object)DeployVisual != (Object)null) { DeployVisual.SetActive(true); } if (((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).ForceBreakInteraction(); } ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; } } if (isPlanted && pendingArming && !isArmed) { armingTimer += Time.deltaTime; if (armingTimer >= ArmingDelay) { isArmed = true; pendingArming = false; } } if (!isPlanted || !isArmed || hasDetonated) { return; } RaycastHit val8 = default(RaycastHit); for (int j = 0; j < WireDirections.Count; j++) { Transform val6 = ((WireOrigins.Count > j && (Object)(object)WireOrigins[j] != (Object)null) ? WireOrigins[j] : ((!Object.op_Implicit((Object)(object)JabOrigin)) ? ((Component)this).transform : JabOrigin)); Vector3 position = val6.position; Vector3 val7 = val6.TransformDirection(WireDirections[j]); float tripwireMaxRange = TripwireMaxRange; bool flag = Physics.Raycast(position, val7, ref val8, tripwireMaxRange, -1, (QueryTriggerInteraction)2); Vector3 val9 = ((!flag) ? (position + val7 * tripwireMaxRange) : ((RaycastHit)(ref val8)).point); if ((Object)(object)TripwireLines[j] != (Object)null) { TripwireLines[j].SetPosition(0, position); TripwireLines[j].SetPosition(1, val9); } if (!flag && !hasPlacedWireEnd[j] && (Object)(object)WireEndPrefab != (Object)null) { hasPlacedWireEnd[j] = true; spawnedWireEnds[j] = Object.Instantiate(WireEndPrefab, val9, ((Component)this).transform.rotation); } if (flag && (Object)(object)((RaycastHit)(ref val8)).collider.attachedRigidbody != (Object)null && ((Component)((RaycastHit)(ref val8)).collider).gameObject.layer != LayerMask.NameToLayer("Environment") && (Object)(object)((Component)((RaycastHit)(ref val8)).collider).gameObject != (Object)(object)((Component)this).gameObject && !((Component)((RaycastHit)(ref val8)).collider).transform.IsChildOf(((Component)this).transform) && (((LayerMask)(ref TripwireTriggerLayerMask)).value & (1 << ((Component)((RaycastHit)(ref val8)).collider).gameObject.layer)) != 0) { Detonate(); break; } } } private void StickToSurface() { //IL_0027: 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_002c: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((!Object.op_Implicit((Object)(object)JabOrigin)) ? ((Component)this).transform.position : JabOrigin.position); Vector3 val2 = ((!Object.op_Implicit((Object)(object)JabOrigin)) ? ((Component)this).transform.TransformDirection(JabDirection) : JabOrigin.TransformDirection(JabDirection)); Debug.DrawRay(val, val2 * DeployCheckDistance, Color.red, 2f); Rigidbody component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } private void Detonate() { //IL_00e2: 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) hasDetonated = true; for (int i = 0; i < spawnedWireEnds.Count; i++) { if ((Object)(object)spawnedWireEnds[i] != (Object)null) { Object.Destroy((Object)(object)spawnedWireEnds[i]); } } if (SpawnOnTrigger != null) { foreach (GameObject item in SpawnOnTrigger) { Object.Instantiate(item, ((Component)this).transform.position, Quaternion.identity); } } if ((Object)(object)SmokeEmitter != (Object)null) { SmokeEmitter.Engaged = true; } if (TriggerSound != null) { SM.PlayCoreSound((FVRPooledAudioType)0, TriggerSound, ((Component)this).transform.position); } Object.Destroy((Object)(object)((Component)this).gameObject); } } 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(); } } } } namespace VolksScripts { public class PortRadar : FVRPhysicalObject { [Serializable] public class DeployablePart { public Transform Part; [Tooltip("Local position when fully deployed.")] public Vector3 DeployedLocalPosition; [Tooltip("Local euler angles when fully deployed.")] public Vector3 DeployedLocalEulers; [Tooltip("Animation speed (0→1 per second). 2 = deployed in 0.5s.")] public float AnimSpeed = 2f; [HideInInspector] public Vector3 OriginalLocalPosition; [HideInInspector] public Vector3 OriginalLocalEulers; [HideInInspector] public float LerpValue = 0f; } [Header("Placement")] [Tooltip("Layers that trigger deployment when the radar touches them (e.g. Default + Environment).")] public LayerMask PlacementLayerMask; [Header("Deployable Parts")] [Tooltip("Parts that animate from their original position/rotation to a deployed state on placement.")] public List DeployableParts = new List(); [Header("Detection")] [Tooltip("Radius of the proximity detection sphere.")] public float DetectionRadius = 10f; [Tooltip("Layer mask for Sosig detection (set to the Sosig layer).")] public LayerMask DetectionLayerMask; [Tooltip("How often (seconds) the sphere scan runs. Lower = more responsive but more expensive.")] public float ScanInterval = 0.5f; [Header("Audio — Hum")] [Tooltip("Looping AudioSource that plays while the radar is deployed.")] public AudioSource HumAudioSource; [Header("Audio — Enemy Beep")] [Tooltip("AudioSource (short one-shot clip) for the enemy-detected beep.")] public AudioSource BeepAudioSource; [Tooltip("Beep pitch when one enemy is nearby.")] public float BeepPitchMin = 1f; [Tooltip("Beep pitch at maximum enemy count (scales between min and max).")] public float BeepPitchMax = 2f; [Tooltip("How often (seconds) the beep fires while enemies are present.")] public float BeepInterval = 0.5f; [Header("Lifetime")] [Tooltip("Seconds before the radar destroys itself after deployment. 0 = never.")] public float Lifetime = 60f; [Header("Debug")] public bool EnableDebug = false; private bool m_isArmed = false; private bool m_isDeployed = false; private float m_lifetimeTimer = 0f; private float m_scanTimer = 0f; private float m_beepTimer = 0f; private int m_lastEnemyCount = 0; public override void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((FVRPhysicalObject)this).Awake(); for (int i = 0; i < DeployableParts.Count; i++) { DeployablePart deployablePart = DeployableParts[i]; if (!((Object)(object)deployablePart.Part == (Object)null)) { deployablePart.OriginalLocalPosition = deployablePart.Part.localPosition; deployablePart.OriginalLocalEulers = deployablePart.Part.localEulerAngles; deployablePart.LerpValue = 0f; } } if ((Object)(object)HumAudioSource != (Object)null) { HumAudioSource.Stop(); } if ((Object)(object)BeepAudioSource != (Object)null) { BeepAudioSource.Stop(); } } public void ArmRadar() { if (!m_isDeployed) { m_isArmed = !m_isArmed; DebugLog("Armed: " + m_isArmed); } } public override void OnCollisionEnter(Collision col) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).OnCollisionEnter(col); if (m_isArmed && !m_isDeployed && !((FVRInteractiveObject)this).IsHeld && ((1 << col.gameObject.layer) & LayerMask.op_Implicit(PlacementLayerMask)) != 0) { Deploy(); } } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); UpdateDeployableParts(); if (!m_isDeployed) { return; } m_scanTimer -= Time.deltaTime; if (m_scanTimer <= 0f) { m_scanTimer = ScanInterval; m_lastEnemyCount = ScanForEnemies(); } if (m_lastEnemyCount > 0 && (Object)(object)BeepAudioSource != (Object)null && (Object)(object)BeepAudioSource.clip != (Object)null) { m_beepTimer -= Time.deltaTime; if (m_beepTimer <= 0f) { m_beepTimer = BeepInterval; float num = Mathf.Clamp01((float)(m_lastEnemyCount - 1) / 5f); BeepAudioSource.pitch = Mathf.Lerp(BeepPitchMin, BeepPitchMax, num); BeepAudioSource.Play(); } } if (Lifetime > 0f) { m_lifetimeTimer -= Time.deltaTime; if (m_lifetimeTimer <= 0f) { DebugLog("Lifetime expired."); SelfDestruct(); } } } private void Deploy() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) m_isDeployed = true; m_isArmed = false; if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; ((FVRPhysicalObject)this).RootRigidbody.velocity = Vector3.zero; ((FVRPhysicalObject)this).RootRigidbody.angularVelocity = Vector3.zero; } if ((Object)(object)HumAudioSource != (Object)null) { HumAudioSource.loop = true; HumAudioSource.Play(); } if (Lifetime > 0f) { m_lifetimeTimer = Lifetime; } m_scanTimer = 0f; m_beepTimer = 0f; DebugLog("Deployed. Lifetime: " + Lifetime + "s"); } private void UpdateDeployableParts() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) float num = ((!m_isDeployed) ? 0f : 1f); for (int i = 0; i < DeployableParts.Count; i++) { DeployablePart deployablePart = DeployableParts[i]; if (!((Object)(object)deployablePart.Part == (Object)null)) { deployablePart.LerpValue = Mathf.MoveTowards(deployablePart.LerpValue, num, deployablePart.AnimSpeed * Time.deltaTime); float lerpValue = deployablePart.LerpValue; deployablePart.Part.localPosition = Vector3.Lerp(deployablePart.OriginalLocalPosition, deployablePart.DeployedLocalPosition, lerpValue); deployablePart.Part.localEulerAngles = new Vector3(Mathf.LerpAngle(deployablePart.OriginalLocalEulers.x, deployablePart.DeployedLocalEulers.x, lerpValue), Mathf.LerpAngle(deployablePart.OriginalLocalEulers.y, deployablePart.DeployedLocalEulers.y, lerpValue), Mathf.LerpAngle(deployablePart.OriginalLocalEulers.z, deployablePart.DeployedLocalEulers.z, lerpValue)); } } } private int ScanForEnemies() { //IL_0007: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, DetectionRadius, LayerMask.op_Implicit(DetectionLayerMask)); HashSet hashSet = new HashSet(); for (int i = 0; i < array.Length; i++) { Rigidbody attachedRigidbody = array[i].attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)null)) { SosigLink component = ((Component)attachedRigidbody).GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.S == (Object)null) && (int)component.S.BodyState != 3) { hashSet.Add(component.S); } } } int count = hashSet.Count; if (count > 0) { DebugLog("Enemies in range: " + count); } return count; } private void SelfDestruct() { if ((Object)(object)HumAudioSource != (Object)null) { HumAudioSource.Stop(); } if ((Object)(object)BeepAudioSource != (Object)null) { BeepAudioSource.Stop(); } Object.Destroy((Object)(object)((Component)this).gameObject); } private void DebugLog(string msg) { if (EnableDebug) { Debug.Log((object)("[PortRadar] " + msg)); } } } public class PortRadarButton : FVRInteractiveObject { [Header("Port Radar Button")] public PortRadar Radar; [Tooltip("Minimum time (seconds) between presses.")] public float PressCooldown = 0.3f; [Header("Press Animation")] [Tooltip("The transform to animate on press.")] public Transform ButtonVisual; public Vector3 RestLocalPos = Vector3.zero; public Vector3 RestLocalRot = Vector3.zero; public Vector3 PressedLocalPos = new Vector3(0f, -0.002f, 0f); public Vector3 PressedLocalRot = Vector3.zero; public float PressDuration = 0.05f; public float ReturnDuration = 0.1f; private float m_lastPressTime = -1f; private bool m_isAnimating = false; private bool m_isReturning = false; private float m_animLerp = 0f; public override void SimpleInteraction(FVRViveHand hand) { if (!((Object)(object)Radar == (Object)null) && !(Time.time - m_lastPressTime < PressCooldown) && !m_isAnimating) { m_lastPressTime = Time.time; ((FVRInteractiveObject)this).SimpleInteraction(hand); Radar.ArmRadar(); if ((Object)(object)ButtonVisual != (Object)null) { m_isAnimating = true; m_isReturning = false; m_animLerp = 0f; } } } public override void FVRUpdate() { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!m_isAnimating || (Object)(object)ButtonVisual == (Object)null) { return; } float num = ((!m_isReturning) ? PressDuration : ReturnDuration); m_animLerp += Time.deltaTime / num; if (m_animLerp >= 1f) { m_animLerp = 1f; if (m_isReturning) { m_isAnimating = false; m_animLerp = 0f; ButtonVisual.localPosition = RestLocalPos; ButtonVisual.localEulerAngles = RestLocalRot; return; } m_isReturning = true; m_animLerp = 0f; } if (m_isReturning) { ButtonVisual.localPosition = Vector3.Lerp(PressedLocalPos, RestLocalPos, m_animLerp); ButtonVisual.localEulerAngles = Vector3.Lerp(PressedLocalRot, RestLocalRot, m_animLerp); } else { ButtonVisual.localPosition = Vector3.Lerp(RestLocalPos, PressedLocalPos, m_animLerp); ButtonVisual.localEulerAngles = Vector3.Lerp(RestLocalRot, PressedLocalRot, m_animLerp); } } } public class PropaneBombBody : FVRPhysicalObject, IFVRDamageable { [Header("Bomb Parts")] public GameObject BombHead; public Transform HeadAttachPoint; public Collider StrikeArea; [Header("Ignition")] public int MinStrikesToIgnite = 2; public int MaxStrikesToIgnite = 5; public float StrikeCooldown = 0.2f; [Header("Strike Force")] public float MinStrikeSpeed = 1.2f; [Header("Strike Timing")] public float StrikeArmDelay = 0.2f; [Header("Return")] public float ReturnHeadDelay = 2f; [Header("Strike Effects")] public ParticleSystem StrikeParticles; public int StrikeParticlesPerHit = 1; public AudioSource StrikeSound; [Header("Fuse Settings")] public float MinFuseTime = 2f; public float MaxFuseTime = 6f; [Header("Fuse Tick Audio")] [Tooltip("Looping AudioSource on this GameObject for the fuse tick. Pitch ramps up over the fuse duration.")] public AudioSource FuseTickAudioSource; public float FuseTickPitchStart = 1f; public float FuseTickPitchEnd = 2f; [Header("Fuse Effects")] public ParticleSystem FuseTickParticles; public int FuseTickParticlesPerTick = 2; public GameObject FuseEffectsRoot; public Light FuseLight; public AudioSource IgniteSound; [Header("Shot Explosion")] [Tooltip("If true, the bomb explodes immediately when hit by a bullet, even if not primed.")] public bool ExplodeOnShot = true; public float ShotDamageThreshold = 10f; [Header("Explosion")] public List SpawnOnExplode = new List(); public int IFF; [Header("Debug")] public bool EnableDebug = false; private int m_strikeCount = 0; private int m_strikesRequired = 3; private bool m_isHeadAttached = true; private bool m_isIgnited = false; private bool m_hasExploded = false; private float m_lastStrikeTime = -1f; private float m_nextStrikeAllowedTime = 0f; private Coroutine m_returnCoroutine; private float m_fuseTime; private float m_startFuseTime; private bool m_isFused = false; private List m_headColliders = new List(); private bool[] m_headOrigIsTrigger; private Rigidbody m_headRigidbody; private Vector3 m_lastHeadPos; private float m_lastHeadTime; public override void Awake() { ((FVRPhysicalObject)this).Awake(); AttachHead(); ForceStopParticles(StrikeParticles); ForceStopParticles(FuseTickParticles); if ((Object)(object)FuseEffectsRoot != (Object)null) { FuseEffectsRoot.SetActive(false); } else if ((Object)(object)FuseLight != (Object)null) { ((Behaviour)FuseLight).enabled = false; } if ((Object)(object)FuseTickAudioSource != (Object)null) { FuseTickAudioSource.Stop(); } int num = Mathf.Min(MinStrikesToIgnite, MaxStrikesToIgnite); int num2 = Mathf.Max(MinStrikesToIgnite, MaxStrikesToIgnite); m_strikesRequired = Random.Range(num, num2 + 1); } public override void FVRUpdate() { //IL_0030: 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) ((FVRPhysicalObject)this).FVRUpdate(); if (!m_isHeadAttached && (Object)(object)BombHead != (Object)null) { m_lastHeadPos = BombHead.transform.position; m_lastHeadTime = Time.time; } if (m_isFused && !m_hasExploded) { m_fuseTime -= Time.deltaTime; float num = Mathf.Clamp01(1f - m_fuseTime / m_startFuseTime); num = Mathf.Pow(num, 2f); if ((Object)(object)FuseTickAudioSource != (Object)null && FuseTickAudioSource.isPlaying) { FuseTickAudioSource.pitch = Mathf.Lerp(FuseTickPitchStart, FuseTickPitchEnd, num); } if ((Object)(object)FuseTickParticles != (Object)null) { ((Component)FuseTickParticles).gameObject.SetActive(true); FuseTickParticles.Emit(Mathf.Max(1, FuseTickParticlesPerTick)); } if (m_fuseTime <= 0.05f) { Explode(); } } } public void Damage(Damage d) { if (!m_hasExploded && ExplodeOnShot && d.Dam_TotalKinetic >= ShotDamageThreshold) { DebugLog("Shot detected! Damage: " + d.Dam_TotalKinetic.ToString("F2") + " — exploding immediately."); Explode(); } } public void DetachHead() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!m_isHeadAttached) { return; } m_isHeadAttached = false; CacheHeadComponents(); SetHeadStrikeCollision(ignore: false); if ((Object)(object)BombHead != (Object)null) { BombHead.transform.parent = null; if ((Object)(object)m_headRigidbody != (Object)null) { m_headRigidbody.isKinematic = false; } m_lastHeadPos = BombHead.transform.position; m_lastHeadTime = Time.time; } m_nextStrikeAllowedTime = Time.time + StrikeArmDelay; StartReturnTimer(); } public void AttachHead() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) m_isHeadAttached = true; if (m_returnCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_returnCoroutine); m_returnCoroutine = null; } if ((Object)(object)BombHead != (Object)null && (Object)(object)HeadAttachPoint != (Object)null) { CacheHeadComponents(); if ((Object)(object)m_headRigidbody != (Object)null) { m_headRigidbody.isKinematic = true; m_headRigidbody.velocity = Vector3.zero; m_headRigidbody.angularVelocity = Vector3.zero; } SetHeadStrikeCollision(ignore: true); BombHead.transform.parent = HeadAttachPoint; BombHead.transform.localPosition = Vector3.zero; BombHead.transform.localRotation = Quaternion.identity; PropaneBombHead component = BombHead.GetComponent(); if ((Object)(object)component != (Object)null) { component.Body = this; } } } private void StartReturnTimer() { if (m_returnCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_returnCoroutine); } m_returnCoroutine = ((MonoBehaviour)this).StartCoroutine(ReturnHeadCoroutine()); } private IEnumerator ReturnHeadCoroutine() { yield return (object)new WaitForSeconds(ReturnHeadDelay); if (m_isIgnited || (Object)(object)BombHead == (Object)null || m_isHeadAttached) { yield break; } PropaneBombHead head = BombHead.GetComponent(); if ((Object)(object)head == (Object)null) { yield break; } while (((FVRInteractiveObject)head).IsHeld) { if (m_isIgnited || (Object)(object)BombHead == (Object)null || m_isHeadAttached) { yield break; } yield return null; } head.ReturnToBody(); } public void TryStrikeFromHead(Collider headStrikeCollider, Collision col) { //IL_0091: 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_00f5: 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_012a: 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_0112: Unknown result type (might be due to invalid IL or missing references) if (m_isIgnited || m_isHeadAttached) { DebugLog("Blocked: ignited/head attached."); return; } if (Time.time < m_nextStrikeAllowedTime) { DebugLog("Strike gated by arm delay."); return; } if ((Object)(object)StrikeArea == (Object)null || (Object)(object)headStrikeCollider == (Object)null || col == null) { DebugLog("Missing strike refs."); return; } for (int i = 0; i < col.contacts.Length; i++) { ContactPoint val = col.contacts[i]; bool flag = (Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)headStrikeCollider || (Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)(object)headStrikeCollider; bool flag2 = (Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)StrikeArea || (Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)(object)StrikeArea; if (flag && flag2) { Vector3 relativeVelocity = col.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude >= MinStrikeSpeed) { Strike(((ContactPoint)(ref val)).point); return; } Vector3 relativeVelocity2 = col.relativeVelocity; DebugLog("Speed too low: " + ((Vector3)(ref relativeVelocity2)).magnitude.ToString("F2")); return; } } DebugLog("No valid head/body strike in contacts."); } public void TryStrikeFromHead(Collider headStrikeCollider, Collider other) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (m_isIgnited || m_isHeadAttached) { DebugLog("Blocked: ignited/head attached."); } else if (Time.time < m_nextStrikeAllowedTime) { DebugLog("Strike gated by arm delay."); } else if ((Object)(object)StrikeArea == (Object)null || (Object)(object)headStrikeCollider == (Object)null || (Object)(object)other == (Object)null) { DebugLog("Missing strike refs."); } else if ((Object)(object)other == (Object)(object)StrikeArea) { float triggerStrikeSpeed = GetTriggerStrikeSpeed(other); if (triggerStrikeSpeed >= MinStrikeSpeed) { Vector3 impactPoint = other.ClosestPoint(((Component)headStrikeCollider).transform.position); Strike(impactPoint); } else { DebugLog("Trigger speed too low: " + triggerStrikeSpeed.ToString("F2")); } } } private float GetTriggerStrikeSpeed(Collider other) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) Rigidbody attachedRigidbody = other.attachedRigidbody; Vector3 val = ((!((Object)(object)attachedRigidbody != (Object)null)) ? Vector3.zero : attachedRigidbody.velocity); Vector3 headVelocity = GetHeadVelocity(); Vector3 val2 = headVelocity - val; return ((Vector3)(ref val2)).magnitude; } private Vector3 GetHeadVelocity() { //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_004b: 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_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_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_0083: 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_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_008a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)BombHead == (Object)null) { return Vector3.zero; } float num = Time.time - m_lastHeadTime; if (num <= 0f) { return Vector3.zero; } Vector3 result = (BombHead.transform.position - m_lastHeadPos) / num; m_lastHeadPos = BombHead.transform.position; m_lastHeadTime = Time.time; return result; } private void Strike(Vector3 impactPoint) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - m_lastStrikeTime < StrikeCooldown)) { m_lastStrikeTime = Time.time; m_strikeCount++; PlayStrikeParticles(impactPoint); if ((Object)(object)StrikeSound != (Object)null) { ((Component)StrikeSound).gameObject.SetActive(true); StrikeSound.Play(); } if (m_strikeCount >= m_strikesRequired) { Ignite(); } } } private void PlayStrikeParticles(Vector3 impactPoint) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)StrikeParticles == (Object)null)) { ((Component)StrikeParticles).gameObject.SetActive(true); ((Component)StrikeParticles).transform.position = impactPoint; StrikeParticles.Clear(true); int num = Mathf.Max(1, StrikeParticlesPerHit); StrikeParticles.Emit(num); } } private void Ignite() { m_isIgnited = true; m_isFused = true; float num = Mathf.Min(MinFuseTime, MaxFuseTime); float num2 = Mathf.Max(MinFuseTime, MaxFuseTime); m_startFuseTime = Random.Range(num, num2); m_fuseTime = m_startFuseTime; if ((Object)(object)FuseEffectsRoot != (Object)null) { FuseEffectsRoot.SetActive(true); } else if ((Object)(object)FuseLight != (Object)null) { ((Component)FuseLight).gameObject.SetActive(true); ((Behaviour)FuseLight).enabled = true; } if ((Object)(object)IgniteSound != (Object)null) { ((Component)IgniteSound).gameObject.SetActive(true); IgniteSound.Play(); } if ((Object)(object)FuseTickAudioSource != (Object)null && (Object)(object)FuseTickAudioSource.clip != (Object)null) { FuseTickAudioSource.loop = true; FuseTickAudioSource.pitch = FuseTickPitchStart; FuseTickAudioSource.Play(); } if ((Object)(object)BombHead != (Object)null) { Object.Destroy((Object)(object)BombHead); } DebugLog("Ignited! Fuse time: " + m_startFuseTime.ToString("F2") + "s"); } private void Explode() { //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) if (m_hasExploded) { return; } m_hasExploded = true; m_isFused = false; if ((Object)(object)IgniteSound != (Object)null) { IgniteSound.Stop(); } if ((Object)(object)FuseTickAudioSource != (Object)null) { FuseTickAudioSource.Stop(); } DebugLog("Exploding!"); for (int i = 0; i < SpawnOnExplode.Count; i++) { GameObject val = Object.Instantiate(SpawnOnExplode[i], ((Component)this).transform.position, Quaternion.identity); Explosion component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.IFF = IFF; } ExplosionSound component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.IFF = IFF; } GrenadeExplosion component3 = val.GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.IFF = IFF; } } if (((FVRInteractiveObject)this).IsHeld) { FVRViveHand hand = ((FVRInteractiveObject)this).m_hand; ((FVRInteractiveObject)this).m_hand.ForceSetInteractable((FVRInteractiveObject)null); ((FVRInteractiveObject)this).EndInteraction(hand); } Object.Destroy((Object)(object)((Component)this).gameObject); } private void ForceStopParticles(ParticleSystem ps) { if (!((Object)(object)ps == (Object)null)) { ps.Stop(true, (ParticleSystemStopBehavior)0); } } private void CacheHeadComponents() { m_headColliders.Clear(); if ((Object)(object)BombHead == (Object)null) { m_headRigidbody = null; m_headOrigIsTrigger = null; return; } m_headColliders.AddRange(BombHead.GetComponentsInChildren(true)); m_headRigidbody = BombHead.GetComponent(); if (m_headOrigIsTrigger != null && m_headOrigIsTrigger.Length == m_headColliders.Count) { return; } if (m_headColliders.Count > 0) { m_headOrigIsTrigger = new bool[m_headColliders.Count]; for (int i = 0; i < m_headColliders.Count; i++) { Collider val = m_headColliders[i]; m_headOrigIsTrigger[i] = (Object)(object)val != (Object)null && val.isTrigger; } } else { m_headOrigIsTrigger = null; } } private void SetHeadStrikeCollision(bool ignore) { if (m_headColliders == null || m_headColliders.Count == 0) { return; } for (int i = 0; i < m_headColliders.Count; i++) { Collider val = m_headColliders[i]; if (!((Object)(object)val == (Object)null)) { if ((Object)(object)StrikeArea != (Object)null) { Physics.IgnoreCollision(val, StrikeArea, ignore); } if (ignore) { val.isTrigger = true; } else if (m_headOrigIsTrigger != null && i < m_headOrigIsTrigger.Length) { val.isTrigger = m_headOrigIsTrigger[i]; } } } } private void DebugLog(string msg) { if (EnableDebug) { Debug.Log((object)("[PropaneBombBody] " + msg)); } } } public class PropaneBombHead : FVRPhysicalObject { [Header("Owner")] public PropaneBombBody Body; [Header("Strike Collider")] public Collider StrikeCollider; public override void Awake() { ((FVRPhysicalObject)this).Awake(); } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); if ((Object)(object)Body != (Object)null) { Body.DetachHead(); } } public void ReturnToBody() { if (!((Object)(object)Body == (Object)null) && !((FVRInteractiveObject)this).IsHeld) { Body.AttachHead(); } } private void OnTransformParentChanged() { if ((Object)(object)Body != (Object)null && (Object)(object)((Component)this).transform.parent == (Object)null) { Body.DetachHead(); } } public override void OnCollisionEnter(Collision col) { ((FVRPhysicalObject)this).OnCollisionEnter(col); if ((Object)(object)Body != (Object)null && (Object)(object)StrikeCollider != (Object)null) { Body.TryStrikeFromHead(StrikeCollider, col); } } private void OnTriggerEnter(Collider other) { if ((Object)(object)Body != (Object)null && (Object)(object)StrikeCollider != (Object)null) { Body.TryStrikeFromHead(StrikeCollider, other); } } } } namespace ShermanJumbo { public class ChamberShellInsertEject : FVRInteractiveObject { public enum ChamberSlideState { In, Middle, Out } public FVRFireArmChamber Chamber; public bool IsCaseless = false; public AudioEvent AudEvent_ShellInStart; public AudioEvent AudEvent_ShellIn; public AudioEvent AudEvent_ShellOutStart; public AudioEvent AudEvent_ShellOut; public Transform ChamberPoint_Back; public Transform ChamberPoint_Forward; public ChamberSlideState CSState = (ChamberSlideState)2; private float m_curZ; private float m_tarZ; public float ZThreshold = 0.02f; private float m_timeHeld; private BreakActionWeapon BOWeapon; private bool BOWeaponHingeOpen = false; public void OnDestroy() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((FVRInteractiveObject)this).OnDestroy(); GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(ShotFired); } private void ShotFired(FVRFireArm firearm) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00a2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)firearm == (Object)(object)Chamber.Firearm && IsCaseless) { ((Component)Chamber).transform.localPosition = new Vector3(((Component)Chamber).transform.localPosition.x, ((Component)Chamber).transform.localPosition.y, ChamberPoint_Back.localPosition.z); m_curZ = ChamberPoint_Back.localPosition.z; m_tarZ = m_curZ; CSState = (ChamberSlideState)2; } } public override void Awake() { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ((FVRInteractiveObject)this).Awake(); m_curZ = ChamberPoint_Back.localPosition.z; m_tarZ = m_curZ; GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(ShotFired); ref BreakActionWeapon bOWeapon = ref BOWeapon; FVRFireArm firearm = Chamber.Firearm; bOWeapon = (BreakActionWeapon)(object)((firearm is BreakActionWeapon) ? firearm : null); } public override bool IsInteractable() { return Chamber.IsFull && (BOWeaponHingeOpen || (Object)(object)BOWeapon == (Object)null); } public override void UpdateInteraction(FVRViveHand hand) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); float tarZ = Mathf.Clamp(((Component)Chamber.Firearm).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z, ChamberPoint_Back.localPosition.z, ChamberPoint_Forward.localPosition.z); m_tarZ = tarZ; } public override void EndInteraction(FVRViveHand hand) { //IL_0014: 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_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_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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).EndInteraction(hand); float num = Mathf.Abs(m_curZ - ChamberPoint_Back.localPosition.z); float num2 = Mathf.Abs(m_curZ - ChamberPoint_Forward.localPosition.z); if (num < ZThreshold * 2f) { m_tarZ = ChamberPoint_Back.localPosition.z; } else if (num2 < ZThreshold * 2f) { m_tarZ = ChamberPoint_Forward.localPosition.z; } } public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); m_timeHeld = 0f; } public override void FVRUpdate() { //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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Invalid comparison between Unknown and I4 //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Invalid comparison between Unknown and I4 //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Invalid comparison between Unknown and I4 //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Invalid comparison between Unknown and I4 //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Invalid comparison between Unknown and I4 //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); m_timeHeld += Time.deltaTime; if (!(Mathf.Abs(m_curZ - m_tarZ) > 0.001f)) { return; } m_curZ = Mathf.MoveTowards(m_curZ, m_tarZ, Time.deltaTime * 1f); ((Component)Chamber).transform.localPosition = new Vector3(((Component)Chamber).transform.localPosition.x, ((Component)Chamber).transform.localPosition.y, m_curZ); float num = Mathf.Abs(m_curZ - ChamberPoint_Back.localPosition.z); float num2 = Mathf.Abs(m_curZ - ChamberPoint_Forward.localPosition.z); ChamberSlideState cSState = CSState; if (num < ZThreshold) { CSState = (ChamberSlideState)2; } else if (num2 < ZThreshold) { CSState = (ChamberSlideState)0; } else { CSState = (ChamberSlideState)1; } if ((int)CSState == 2 && (int)cSState != 2) { SM.PlayGenericSound(AudEvent_ShellOut, ((Component)this).transform.position); if (m_timeHeld > 0.2f) { FVRFireArmRound val = Chamber.EjectRound(((Component)ChamberPoint_Back).transform.position, ChamberPoint_Back.forward * 0.1f, Vector3.zero, false); if (((FVRInteractiveObject)this).IsHeld) { FVRViveHand hand = base.m_hand; hand.ForceSetInteractable((FVRInteractiveObject)(object)val); ((FVRInteractiveObject)val).BeginInteraction(hand); } } } else if ((int)CSState == 0 && (int)cSState != 0) { SM.PlayGenericSound(AudEvent_ShellIn, ((Component)this).transform.position); ((FVRInteractiveObject)this).ForceBreakInteraction(); } else if ((int)CSState == 1 && (int)cSState == 0) { SM.PlayGenericSound(AudEvent_ShellOutStart, ((Component)this).transform.position); } else if ((int)CSState == 1 && (int)cSState == 2) { SM.PlayGenericSound(AudEvent_ShellInStart, ((Component)this).transform.position); } if ((Object)(object)BOWeapon != (Object)null) { if (!BOWeapon.m_isLatched) { BOWeaponHingeOpen = true; } else { BOWeaponHingeOpen = false; } } } } } namespace VolksScripts { public class Puntgun : FVRFireArm { public enum ForeGripFailDirectionMode { MuzzleBackward, MuzzleForward, Up, MuzzleUp, PlayerForward, CustomVector } public enum HingeState { Closed, Closing, Open, Opening } private FVRViveHand m_lastHand; [Header("Flaregun Params")] public Renderer[] GunUndamaged; public Renderer[] GunDamaged; public FVRFireArmChamber Chamber; public bool AutoEject = true; public Axis HingeAxis; public Transform Hinge; public float RotOut = 35f; public bool CanUnlatch = true; private float m_hingeLerp; private HingeState m_hingeState; public bool CanFlick = true; public bool IsHighPressureTolerant; private bool m_isHammerCocked; private bool m_isTriggerReset = true; private bool m_isDestroyed; private float TriggerFloat; public Transform Hammer; public bool HasVisibleHammer = true; public bool CanCockHammer = true; public bool CocksOnOpen; private float m_hammerXRot; public Axis HammerAxis; public InterpStyle HammerInterp = (InterpStyle)1; public float HammerMinRot; public float HammerMaxRot = -70f; public Transform Trigger; public Vector2 TriggerForwardBackRots; public Transform Muzzle; public ParticleSystem SmokePSystem; public ParticleSystem DestroyPSystem; public bool DeletesCartridgeOnFire; public bool IsFallingBlock; public Transform FallingBlock; public Vector3 FallingBlockPos_Up; public Vector3 FallingBlockPos_Down; [Header("Shell Slide (optional)")] public ChamberShellInsertEject ShellSlide; [Header("Hammer Fan")] public Transform HammerFanDir; [Header("ForeGrip Safety (optional)")] public bool RequireForeGripToPreventFlyOff = false; public float ForeGripFailForce = 6f; public AudioEvent ForeGripFailSound; [Header("ForeGrip Flyoff Tuning")] public ForeGripFailDirectionMode ForeGripFailMode = ForeGripFailDirectionMode.MuzzleBackward; public Vector3 ForeGripFailCustomDirection = Vector3.back; [Tooltip("Cone half-angle (deg) to randomly vary the fly-off direction.")] public float ForeGripFailConeAngleDeg = 12f; [Tooltip("Additional random impulse magnitude applied (multiplicative of ForeGripFailForce).")] public float ForeGripFailRandomJitter = 0.5f; public override void Awake() { ((FVRFireArm)this).Awake(); base.FChambers.Add(Chamber); if (CanUnlatch) { Chamber.IsAccessible = false; } else { Chamber.IsAccessible = true; } } public override void FVRUpdate() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).FVRUpdate(); if (m_hingeState == HingeState.Opening) { m_hingeLerp += Time.deltaTime * Mathf.Lerp(4f, 30f, m_hingeLerp * m_hingeLerp); if (m_hingeLerp >= 1f) { m_hingeState = HingeState.Open; m_hingeLerp = 1f; } ((FVRPhysicalObject)this).SetAnimatedComponent(Hinge, Mathf.Lerp(0f, RotOut, m_hingeLerp), (InterpStyle)1, HingeAxis); } else if (m_hingeState == HingeState.Closing) { m_hingeLerp -= Time.deltaTime * Mathf.Lerp(3f, 25f, (m_hingeLerp - 1f) * (m_hingeLerp - 1f)); if (m_hingeLerp <= 0f) { m_hingeState = HingeState.Closed; m_hingeLerp = 0f; } ((FVRPhysicalObject)this).SetAnimatedComponent(Hinge, Mathf.Lerp(0f, RotOut, m_hingeLerp), (InterpStyle)1, HingeAxis); } if (m_hingeState == HingeState.Open && AutoEject && Vector3.Angle(Vector3.up, ((Component)Chamber).transform.forward) < 70f && Chamber.IsFull && Chamber.IsSpent) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); Chamber.EjectRound(((Component)Chamber).transform.position + ((Component)Chamber).transform.forward * -0.08f, ((Component)Chamber).transform.forward * -0.3f, Vector3.right, false); } } public override void UpdateInteraction(FVRViveHand hand) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0066: 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_0070: 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_002d: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) m_lastHand = hand; ((FVRPhysicalObject)this).UpdateInteraction(hand); float num = 0f; Axis hingeAxis = HingeAxis; if ((int)hingeAxis != 0) { if ((int)hingeAxis != 1) { if ((int)hingeAxis == 2) { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).z; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).y; } } else { num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).x; } if (num > 15f && CanUnlatch && !m_isHammerCocked && CanFlick) { Unlatch(); } else if (num < -15f && CanUnlatch && CanFlick) { Latch(); } bool flag = false; bool flag2 = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && CanUnlatch) { flag2 = true; } if (hand.Input.AXButtonDown) { flag = true; } } else if (hand.Input.TouchpadDown) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) < 45f && CanCockHammer) { CockHammer(); } else if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && (Vector2.Angle(touchpadAxes, Vector2.left) < 45f || Vector2.Angle(touchpadAxes, Vector2.right) < 45f) && CanUnlatch) { ToggleLatchState(); } } } if (flag) { CockHammer(); } if (flag2) { ToggleLatchState(); } if (m_isDestroyed) { return; } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld) { TriggerFloat = hand.Input.TriggerFloat; } else { TriggerFloat = 0f; } float num2 = Mathf.Lerp(TriggerForwardBackRots.x, TriggerForwardBackRots.y, TriggerFloat); Trigger.localEulerAngles = new Vector3(num2, 0f, 0f); if ((Object)(object)HammerFanDir != (Object)null && ((FVRInteractiveObject)this).IsHeld && !m_isHammerCocked && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null) { Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; float num3 = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position); if (num3 < 0.15f && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f) { CockHammer(); } } if (TriggerFloat > 0.7f) { if (m_isTriggerReset && m_isHammerCocked) { m_isTriggerReset = false; SetHammerCocked(b: false); if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMinRot, HammerInterp, HammerAxis); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); Fire(); } } else if (TriggerFloat < 0.2f && !m_isTriggerReset) { m_isTriggerReset = true; } } private void Fire() { //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_005e: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) if (m_hingeState != 0) { return; } if ((Object)(object)ShellSlide != (Object)null) { float z = ((Component)Chamber).transform.localPosition.z; float num = ((!((Object)(object)ShellSlide.ChamberPoint_Forward != (Object)null)) ? z : ShellSlide.ChamberPoint_Forward.localPosition.z); float num2 = Mathf.Abs(z - num); if (num2 > ShellSlide.ZThreshold) { SM.PlayGenericSound(ShellSlide.AudEvent_ShellOutStart, ((Component)this).transform.position); return; } } if (Chamber.Fire()) { ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); if (Chamber.GetRound().IsHighPressure && !IsHighPressureTolerant) { HandleForeGripFail(flag, flag2); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); Destroy(); } else if (Chamber.GetRound().IsHighPressure && IsHighPressureTolerant) { HandleForeGripFail(flag, flag2); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); } else { HandleForeGripFail(flag, flag2); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); } ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { Chamber.IsSpent = false; Chamber.UpdateProxyDisplay(); } else if (Chamber.GetRound().IsCaseless) { Chamber.SetRound((FVRFireArmRound)null, false); } if (DeletesCartridgeOnFire) { Chamber.SetRound((FVRFireArmRound)null, false); } } } private void Latch() { //IL_00fa: 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_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) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (m_hingeState != HingeState.Open) { return; } if ((Object)(object)ShellSlide != (Object)null && Chamber.IsFull) { float z = ((Component)Chamber).transform.localPosition.z; float num = ((!((Object)(object)ShellSlide.ChamberPoint_Forward != (Object)null)) ? z : ShellSlide.ChamberPoint_Forward.localPosition.z); float num2 = Mathf.Abs(z - num); if (num2 > ShellSlide.ZThreshold) { SM.PlayGenericSound(ShellSlide.AudEvent_ShellOutStart, ((Component)this).transform.position); return; } } m_hingeState = HingeState.Closing; m_hingeLerp = 1f; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); Chamber.IsAccessible = false; if (IsFallingBlock) { FallingBlock.localPosition = FallingBlockPos_Up; } } private void Unlatch() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (m_hingeState == HingeState.Closed) { m_hingeState = HingeState.Opening; m_hingeLerp = 0f; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); Chamber.IsAccessible = true; if (CocksOnOpen) { CockHammer(); } if (IsFallingBlock) { FallingBlock.localPosition = FallingBlockPos_Down; } } } private void CockHammer() { //IL_0040: 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) if (!m_isHammerCocked) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); m_isHammerCocked = true; if ((Object)(object)Hammer != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerMaxRot, HammerInterp, HammerAxis); } } } private void Destroy() { if (!m_isDestroyed) { m_isDestroyed = true; DestroyPSystem.Emit(25); for (int i = 0; i < GunUndamaged.Length; i++) { GunUndamaged[i].enabled = false; GunDamaged[i].enabled = true; } } } private void HandleForeGripFail(bool twoHand, bool altGripHeld) { //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00c7: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: 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_028a: Unknown result type (might be due to invalid IL or missing references) if (!RequireForeGripToPreventFlyOff || ((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).IsHeld) || ((FVRFireArm)this).IsTwoHandStabilized() || !((FVRInteractiveObject)this).IsHeld) { return; } if (ForeGripFailSound != null) { SM.PlayGenericSound(ForeGripFailSound, ((Component)this).transform.position); } try { ((FVRInteractiveObject)this).ForceBreakInteraction(); } catch (Exception) { } Vector3 val = (Vector3)(ForeGripFailMode switch { ForeGripFailDirectionMode.MuzzleForward => ((FVRFireArm)this).GetMuzzle().forward, ForeGripFailDirectionMode.Up => ((Component)this).transform.up, ForeGripFailDirectionMode.MuzzleUp => ((Component)this).transform.up, ForeGripFailDirectionMode.PlayerForward => (!((Object)(object)GM.CurrentPlayerBody != (Object)null)) ? (-((FVRFireArm)this).GetMuzzle().forward) : ((Component)GM.CurrentPlayerBody).transform.forward, ForeGripFailDirectionMode.CustomVector => ((Component)this).transform.TransformDirection(((Vector3)(ref ForeGripFailCustomDirection)).normalized), _ => -((FVRFireArm)this).GetMuzzle().forward, }); Vector3 val2 = RandomDirectionInCone(((Vector3)(ref val)).normalized, ForeGripFailConeAngleDeg); Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = normalized * ForeGripFailForce; val3 += Random.onUnitSphere * ForeGripFailRandomJitter; if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.AddForce(val3, (ForceMode)1); Vector3 val4; if (ForeGripFailMode == ForeGripFailDirectionMode.MuzzleUp) { val4 = ((Component)this).transform.right * (ForeGripFailForce * 1.5f); val4 += (Vector3.up * Random.Range(-0.3f, 0.3f) + ((Component)this).transform.forward * Random.Range(-0.2f, 0.2f)) * ForeGripFailForce; } else { Vector3 val5 = Vector3.up * Random.Range(-1f, 1f) + Vector3.right * Random.Range(-1f, 1f); val4 = val5 * (ForeGripFailForce * 0.25f); } ((FVRPhysicalObject)this).RootRigidbody.AddTorque(val4, (ForceMode)1); } } private static Vector3 RandomDirectionInCone(Vector3 dir, float angleDeg) { //IL_008e: 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_009a: 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_00a1: 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_00a5: 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_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_00b0: Unknown result type (might be due to invalid IL or missing references) if (angleDeg <= 0f) { return ((Vector3)(ref dir)).normalized; } float num = (float)Math.PI / 180f * Mathf.Clamp(angleDeg, 0f, 179f); float num2 = Mathf.Cos(num); float num3 = Mathf.Lerp(num2, 1f, Random.value); float num4 = Mathf.Acos(num3); float num5 = Random.value * 2f * (float)Math.PI; float num6 = Mathf.Sin(num4); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num6 * Mathf.Cos(num5), num6 * Mathf.Sin(num5), Mathf.Cos(num4)); Quaternion val2 = Quaternion.FromToRotation(Vector3.forward, ((Vector3)(ref dir)).normalized); return val2 * val; } public override List GetChamberRoundList() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (Chamber.IsFull && !Chamber.IsSpent) { List list = new List(); list.Add(Chamber.GetRound().RoundClass); return list; } return null; } public override void SetLoadedChambers(List rounds) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } } public override void ConfigureFromFlagDic(Dictionary f) { string empty = string.Empty; string empty2 = string.Empty; empty = "HammerState"; if (f.ContainsKey(empty)) { empty2 = f[empty]; if (empty2 == "Cocked") { m_isHammerCocked = true; } } ((FVRFireArm)this).ConfigureFromFlagDic(f); } public override Dictionary GetFlagDic() { Dictionary flagDic = ((FVRFireArm)this).GetFlagDic(); string key = "HammerState"; string value = "Uncocked"; if (m_isHammerCocked) { value = "Cocked"; } flagDic.Add(key, value); return flagDic; } public void SetHammerCocked(bool b) { m_isHammerCocked = b; } public void ToggleLatchState() { if (m_hingeState == HingeState.Closed) { Unlatch(); } else if (m_hingeState == HingeState.Open) { Latch(); } } } } 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(); } 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); } } } namespace VolksScripts { public class ClackerMaterial : BangerSwitch { [Header("Object Toggle")] [Tooltip("GameObjects to enable when switched ON and disable when switched OFF.")] public List OnObjects = new List(); [Tooltip("GameObjects to enable when switched OFF and disable when switched ON.")] public List OffObjects = new List(); private bool m_myIsOn = false; public override void Awake() { ((FVRInteractiveObject)this).Awake(); ApplyState(); } public override void SimpleInteraction(FVRViveHand hand) { //IL_001e: 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_004c: Unknown result type (might be due to invalid IL or missing references) m_myIsOn = !m_myIsOn; SM.PlayCoreSound((FVRPooledAudioType)10, base.AudEven_Switch, ((Component)this).transform.position); if ((Object)(object)base.SwitchPiece != (Object)null) { base.SwitchPiece.localEulerAngles = ((!m_myIsOn) ? base.Eulers_Off : base.Eulers_On); } if ((Object)(object)base.Banger != (Object)null) { if (m_myIsOn) { base.Banger.Arm(); } else { base.Banger.DeArm(); } } if ((Object)(object)base.C4 != (Object)null) { base.C4.SetArmed(m_myIsOn); } ApplyState(); } private void ApplyState() { for (int i = 0; i < OnObjects.Count; i++) { if ((Object)(object)OnObjects[i] != (Object)null) { OnObjects[i].SetActive(m_myIsOn); } } for (int j = 0; j < OffObjects.Count; j++) { if ((Object)(object)OffObjects[j] != (Object)null) { OffObjects[j].SetActive(!m_myIsOn); } } } } } public class WinterTrigger : FVRInteractiveObject { [Header("Deploy")] public Transform Pivot; public Vector3 StowedLocalEuler; public Vector3 DeployedLocalEuler; public float DeploySpeed = 6f; [Header("Trigger Follow")] public ClosedBoltWeapon Weapon; public Transform WeaponTrigger; public Transform WinterTriggerTransform; public bool FollowRotation = true; public Vector3 RotationOffset; public bool FollowTranslation; public Vector3 PositionOffset; private bool m_isDeployed; private float m_deployLerp; private Quaternion m_stowedTriggerRotation; private Vector3 m_stowedTriggerPosition; private bool m_hasStowedTriggerPose; public override void Awake() { ((FVRInteractiveObject)this).Awake(); CacheWeaponTrigger(); CacheStowedTriggerPose(); SetPivotPose(0f); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); m_isDeployed = !m_isDeployed; } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); CacheWeaponTrigger(); float num = ((!m_isDeployed) ? 0f : 1f); m_deployLerp = Mathf.MoveTowards(m_deployLerp, num, DeploySpeed * Time.deltaTime); SetPivotPose(m_deployLerp); if (m_isDeployed) { ApplyTriggerFollow(); } else { RestoreStowedTriggerPose(); } } private void CacheWeaponTrigger() { if ((Object)(object)WeaponTrigger == (Object)null && (Object)(object)Weapon != (Object)null) { WeaponTrigger = Weapon.Trigger; } } private void CacheStowedTriggerPose() { //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_0030: 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) if (!((Object)(object)WinterTriggerTransform == (Object)null)) { m_stowedTriggerRotation = WinterTriggerTransform.localRotation; m_stowedTriggerPosition = WinterTriggerTransform.localPosition; m_hasStowedTriggerPose = true; } } private void SetPivotPose(float t) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Pivot == (Object)null)) { Quaternion val = Quaternion.Euler(StowedLocalEuler); Quaternion val2 = Quaternion.Euler(DeployedLocalEuler); Pivot.localRotation = Quaternion.Slerp(val, val2, t); } } private void ApplyTriggerFollow() { //IL_0041: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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) if (!((Object)(object)WinterTriggerTransform == (Object)null) && !((Object)(object)WeaponTrigger == (Object)null)) { if (FollowRotation) { WinterTriggerTransform.localRotation = WeaponTrigger.localRotation * Quaternion.Euler(RotationOffset); } if (FollowTranslation) { WinterTriggerTransform.localPosition = WeaponTrigger.localPosition + PositionOffset; } } } private void RestoreStowedTriggerPose() { //IL_002a: 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) if (m_hasStowedTriggerPose && !((Object)(object)WinterTriggerTransform == (Object)null)) { WinterTriggerTransform.localRotation = m_stowedTriggerRotation; WinterTriggerTransform.localPosition = m_stowedTriggerPosition; } } } 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().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().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; } } public class Landmine : FVRPhysicalObject, IFVRDamageable { [Header("Fuse Socket")] public Transform FuseSocket; public Collider FuseSocketTrigger; [Header("Fuse Settings")] public bool RequiresFuse = true; public string FuseID = "TM62"; [Header("Arming")] [Tooltip("Seconds after being placed/dropped before the mine arms.")] public float ArmingDelay = 1.5f; [Tooltip("Minimum damage required to cook off the mine when armed.")] public float CookOffDamageThreshold = 1f; [Header("Placement")] public Transform PlacementRayPoint; public LayerMask LM_Placement; public float SinkDepth = 0.02f; public float PlacementCheckDist = 0.15f; [Header("Proximity Detection")] public float ProximityRange = 1.5f; public LayerMask LM_Trigger; public float ProxCheckInterval = 0.1f; [Header("Explosion")] public List SpawnOnDetonate; [Header("Audio")] public AudioEvent AudEvent_FuseInserted; public AudioEvent AudEvent_FuseRemoved; public AudioEvent AudEvent_Armed; public AudioEvent AudEvent_Planted; public AudioEvent AudEvent_Triggered; [Header("Visuals")] public GameObject FuseVisual; [Header("Behavior")] public bool AutoPlantOnImpact = true; private bool m_isFuseInserted; private bool m_isArmed; private bool m_isPlanted; private bool m_isDetonated; private bool m_isArmingPending; private float m_armingTimer; private float m_proxTimer; private float m_insertCooldown; private LandmineFuse m_insertedFuse; private RaycastHit m_hit; private bool IsReadyToPlant => !RequiresFuse || m_isFuseInserted; public override void Awake() { ((FVRPhysicalObject)this).Awake(); if ((Object)(object)FuseVisual != (Object)null) { FuseVisual.SetActive(false); } if (!RequiresFuse) { m_isFuseInserted = true; if ((Object)(object)FuseVisual != (Object)null) { FuseVisual.SetActive(true); } } } private void OnTriggerEnter(Collider other) { if (RequiresFuse && !m_isFuseInserted && !m_isDetonated && !((Object)(object)FuseSocket == (Object)null) && !((Object)(object)m_insertedFuse != (Object)null) && !(m_insertCooldown > 0f)) { LandmineFuse componentInParent = ((Component)other).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && ((FVRInteractiveObject)componentInParent).IsHeld && !componentInParent.IsInserted && (string.IsNullOrEmpty(FuseID) || !(componentInParent.FuseID != FuseID))) { InsertFuse(componentInParent); } } } private void InsertFuse(LandmineFuse fuse) { //IL_003f: 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_0071: Unknown result type (might be due to invalid IL or missing references) m_insertedFuse = fuse; m_isFuseInserted = true; m_armingTimer = 0f; m_isArmingPending = false; ((FVRInteractiveObject)fuse).ForceBreakInteraction(); ((FVRPhysicalObject)fuse).StoreAndDestroyRigidbody(); ((FVRPhysicalObject)fuse).SetParentage(FuseSocket); ((Component)fuse).transform.localPosition = Vector3.zero; ((Component)fuse).transform.localRotation = Quaternion.identity; ((FVRInteractiveObject)fuse).SetAllCollidersToLayer(false, "NoCol"); SM.PlayGenericSound(AudEvent_FuseInserted, FuseSocket.position); if ((Object)(object)FuseVisual != (Object)null) { FuseVisual.SetActive(true); } fuse.OnInserted(this); } public void ReleaseFuse() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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) if (!((Object)(object)m_insertedFuse == (Object)null)) { LandmineFuse insertedFuse = m_insertedFuse; m_insertedFuse = null; m_isFuseInserted = false; m_isArmed = false; m_isArmingPending = false; m_armingTimer = 0f; m_insertCooldown = 0.5f; ((FVRPhysicalObject)insertedFuse).SetParentage((Transform)null); ((FVRPhysicalObject)insertedFuse).RecoverRigidbody(); ((FVRInteractiveObject)insertedFuse).SetAllCollidersToLayer(false, "Default"); if ((Object)(object)FuseSocket != (Object)null) { ((Component)insertedFuse).transform.position = FuseSocket.position + FuseSocket.up * 0.1f; ((Component)insertedFuse).transform.rotation = FuseSocket.rotation; } if ((Object)(object)FuseVisual != (Object)null) { FuseVisual.SetActive(false); } SM.PlayGenericSound(AudEvent_FuseRemoved, FuseSocket.position); insertedFuse.OnRemoved(); } } public override void FVRUpdate() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if (m_isDetonated) { return; } if (m_insertCooldown > 0f) { m_insertCooldown -= Time.deltaTime; } if (m_isFuseInserted && m_isArmingPending && !m_isArmed) { m_armingTimer += Time.deltaTime; if (m_armingTimer >= ArmingDelay) { m_isArmed = true; SM.PlayGenericSound(AudEvent_Armed, ((Component)this).transform.position); } } if (m_isArmed && m_isPlanted) { m_proxTimer += Time.deltaTime; if (m_proxTimer >= ProxCheckInterval) { m_proxTimer = 0f; CheckProximity(); } } } void IFVRDamageable.Damage(Damage d) { if (!m_isDetonated) { if (m_isArmed && d.Dam_TotalKinetic + d.Dam_TotalEnergetic >= CookOffDamageThreshold) { Detonate(); } else if (m_isFuseInserted && d.Dam_TotalKinetic + d.Dam_TotalEnergetic >= CookOffDamageThreshold * 5f) { Detonate(); } } } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); if (m_isPlanted) { m_isPlanted = false; m_isArmed = false; m_isArmingPending = false; m_armingTimer = 0f; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = false; } } public override void EndInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).EndInteraction(hand); if (IsReadyToPlant && !m_isDetonated) { if (m_isFuseInserted && !m_isArmed) { m_isArmingPending = true; m_armingTimer = 0f; } TryPlant(); } } public override void EndInteractionIntoInventorySlot(FVRViveHand hand, FVRQuickBeltSlot slot) { m_isPlanted = false; m_isArmed = false; m_isArmingPending = false; m_armingTimer = 0f; ((FVRPhysicalObject)this).EndInteractionIntoInventorySlot(hand, slot); } public override bool IsDistantGrabbable() { return !m_isPlanted && ((FVRPhysicalObject)this).IsDistantGrabbable(); } private void OnCollisionEnter(Collision col) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_00b0: 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_00d8: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) if (!AutoPlantOnImpact || ((FVRInteractiveObject)this).IsHeld || !IsReadyToPlant || m_isPlanted || m_isDetonated) { return; } ContactPoint val = (ContactPoint)((col.contacts.Length <= 0) ? default(ContactPoint) : col.contacts[0]); if ((Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)null) { return; } int layer = ((Component)((ContactPoint)(ref val)).otherCollider).gameObject.layer; if ((((LayerMask)(ref LM_Placement)).value & (1 << layer)) != 0 && !(Vector3.Angle(Vector3.up, ((ContactPoint)(ref val)).normal) > 60f)) { ((Component)this).transform.position = ((ContactPoint)(ref val)).point - ((Component)this).transform.up * SinkDepth; Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.forward, ((ContactPoint)(ref val)).normal); if (((Vector3)(ref val2)).sqrMagnitude < 0.001f) { val2 = Vector3.ProjectOnPlane(((Component)this).transform.right, ((ContactPoint)(ref val)).normal); } ((Component)this).transform.rotation = Quaternion.LookRotation(val2, ((ContactPoint)(ref val)).normal); m_isPlanted = true; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; SM.PlayGenericSound(AudEvent_Planted, ((Component)this).transform.position); if (m_isFuseInserted && !m_isArmed) { m_isArmingPending = true; m_armingTimer = 0f; } } } private void TryPlant() { //IL_001d: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)PlacementRayPoint == (Object)null) && Physics.Raycast(PlacementRayPoint.position, -((Component)this).transform.up, ref m_hit, PlacementCheckDist, LayerMask.op_Implicit(LM_Placement), (QueryTriggerInteraction)1) && !((Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null) && !(Vector3.Angle(Vector3.up, ((RaycastHit)(ref m_hit)).normal) > 60f)) { ((Component)this).transform.position = ((RaycastHit)(ref m_hit)).point - ((Component)this).transform.up * SinkDepth; Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.forward, ((RaycastHit)(ref m_hit)).normal); if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.ProjectOnPlane(((Component)this).transform.right, ((RaycastHit)(ref m_hit)).normal); } ((Component)this).transform.rotation = Quaternion.LookRotation(val, ((RaycastHit)(ref m_hit)).normal); m_isPlanted = true; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; SM.PlayGenericSound(AudEvent_Planted, ((Component)this).transform.position); if (m_isFuseInserted && !m_isArmed) { m_isArmingPending = true; m_armingTimer = 0f; } } } private void CheckProximity() { //IL_0007: 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) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, ProximityRange, LayerMask.op_Implicit(LM_Trigger), (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)((Component)array[i]).gameObject == (Object)(object)((Component)this).gameObject) && !((Component)array[i]).transform.IsChildOf(((Component)this).transform) && !((Object)(object)array[i].attachedRigidbody == (Object)null)) { Detonate(); break; } } } private void Detonate() { //IL_0024: 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_005e: Unknown result type (might be due to invalid IL or missing references) if (m_isDetonated) { return; } m_isDetonated = true; SM.PlayGenericSound(AudEvent_Triggered, ((Component)this).transform.position); if (SpawnOnDetonate != null) { for (int i = 0; i < SpawnOnDetonate.Count; i++) { Object.Instantiate(SpawnOnDetonate[i], ((Component)this).transform.position, ((Component)this).transform.rotation); } } 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_0031: 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_0022: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.yellow; if ((Object)(object)FuseSocket != (Object)null) { Gizmos.DrawWireSphere(FuseSocket.position, 0.04f); } Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position, ProximityRange); } } public class LandmineFuse : FVRPhysicalObject { [Header("Fuse Identity")] public string FuseID = "TM62"; [HideInInspector] public Landmine TargetMine; [HideInInspector] public bool IsInserted; public override bool IsInteractable() { return true; } public void OnInserted(Landmine mine) { TargetMine = mine; IsInserted = true; } public void OnRemoved() { TargetMine = null; IsInserted = false; } public override void BeginInteraction(FVRViveHand hand) { if (IsInserted && (Object)(object)TargetMine != (Object)null) { TargetMine.ReleaseFuse(); } ((FVRPhysicalObject)this).BeginInteraction(hand); } } public class PIPScopeControllerLadder : PIPScopeController { [Header("Ladder Sight")] public Transform Ladder; public List LadderRots; private int _lastZeroDistanceIndex = -1; public override void Start() { ((PIPScopeController)this).Start(); UpdateLadderSight(); _lastZeroDistanceIndex = base.ZeroDistanceIndex; } private void Update() { if (base.ZeroDistanceIndex != _lastZeroDistanceIndex) { UpdateLadderSight(); _lastZeroDistanceIndex = base.ZeroDistanceIndex; } } private void UpdateLadderSight() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Ladder != (Object)null && LadderRots != null && base.ZeroDistanceIndex >= 0 && base.ZeroDistanceIndex < LadderRots.Count) { Ladder.localEulerAngles = new Vector3(LadderRots[base.ZeroDistanceIndex], 0f, 0f); } } }