Decompiled source of ModulARLMG v1.0.0
ModulARLMG.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using H3VRUtils; using HarmonyLib; using ModularWorkshop; using OpenScripts2; using OtherLoader; using Sodalite.Api; 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 ForwardAssist : FVRInteractiveObject { [Header("Animation Settings")] public Transform TargetTransform; public Vector3 StartPosition; public Vector3 EndPosition; public Vector3 StartRotation; public Vector3 EndRotation; public float MoveSpeed = 10f; public float ResetDelay = 0.2f; [Header("Audio Settings")] public AudioEvent PokeAudioEvent; public FVRPooledAudioType AudioType = (FVRPooledAudioType)0; private float m_animFloat = 0f; private bool m_isPoked = false; private float m_resetTimer = 0f; protected void Awake() { //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_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((FVRInteractiveObject)this).Awake(); if ((Object)(object)TargetTransform == (Object)null) { TargetTransform = ((Component)this).transform; } if (StartPosition == Vector3.zero) { StartPosition = TargetTransform.localPosition; } if (StartRotation == Vector3.zero) { StartRotation = TargetTransform.localEulerAngles; } } public override void Poke(FVRViveHand hand) { //IL_000e: 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) if (PokeAudioEvent != null) { SM.PlayCoreSound(AudioType, PokeAudioEvent, ((Component)this).transform.position); } m_isPoked = true; m_resetTimer = ResetDelay; } private void Update() { //IL_009d: 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_00ae: 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_00c5: 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) if (m_isPoked) { m_animFloat = Mathf.MoveTowards(m_animFloat, 1f, Time.deltaTime * MoveSpeed); m_resetTimer -= Time.deltaTime; if (m_resetTimer <= 0f) { m_isPoked = false; } } else { m_animFloat = Mathf.MoveTowards(m_animFloat, 0f, Time.deltaTime * MoveSpeed); } if ((Object)(object)TargetTransform != (Object)null) { TargetTransform.localPosition = Vector3.Lerp(StartPosition, EndPosition, m_animFloat); TargetTransform.localEulerAngles = Vector3.Lerp(StartRotation, EndRotation, m_animFloat); } } } public class AudioConsistencyEnforcer : MonoBehaviour { [Header("Audio Profiles")] public FVRFirearmAudioSet BaseHandlingAudioProfile; private FVRFireArm _firearm; private FVRFirearmAudioSet _lastAudioClipSet; private void Awake() { _firearm = ((Component)this).GetComponent<FVRFireArm>(); if ((Object)(object)_firearm != (Object)null && (Object)(object)_firearm.AudioClipSet != (Object)null) { _lastAudioClipSet = _firearm.AudioClipSet; BaseHandlingAudioProfile = ScriptableObject.CreateInstance<FVRFirearmAudioSet>(); SaveBaseHandlingAudio(_lastAudioClipSet); } } private void LateUpdate() { if ((Object)(object)_firearm == (Object)null) { return; } FVRFirearmAudioSet audioClipSet = _firearm.AudioClipSet; if (!((Object)(object)audioClipSet == (Object)null)) { if ((Object)(object)audioClipSet != (Object)(object)_lastAudioClipSet) { _lastAudioClipSet = audioClipSet; } EnforceHandlingSounds(audioClipSet); } } private void SaveBaseHandlingAudio(FVRFirearmAudioSet source) { BaseHandlingAudioProfile.BoltRelease = source.BoltRelease; BaseHandlingAudioProfile.BoltSlideBack = source.BoltSlideBack; BaseHandlingAudioProfile.BoltSlideForward = source.BoltSlideForward; BaseHandlingAudioProfile.BoltSlideBackHeld = source.BoltSlideBackHeld; BaseHandlingAudioProfile.BoltSlideBackLocked = source.BoltSlideBackLocked; BaseHandlingAudioProfile.BreachOpen = source.BreachOpen; BaseHandlingAudioProfile.BreachClose = source.BreachClose; BaseHandlingAudioProfile.CatchOnSear = source.CatchOnSear; BaseHandlingAudioProfile.ChamberManual = source.ChamberManual; BaseHandlingAudioProfile.FireSelector = source.FireSelector; BaseHandlingAudioProfile.HammerHit = source.HammerHit; BaseHandlingAudioProfile.HandleBack = source.HandleBack; BaseHandlingAudioProfile.HandleBackEmpty = source.HandleBackEmpty; BaseHandlingAudioProfile.HandleForward = source.HandleForward; BaseHandlingAudioProfile.HandleForwardEmpty = source.HandleForwardEmpty; BaseHandlingAudioProfile.HandleUp = source.HandleUp; BaseHandlingAudioProfile.HandleDown = source.HandleDown; BaseHandlingAudioProfile.HandleGrab = source.HandleGrab; BaseHandlingAudioProfile.Prefire = source.Prefire; BaseHandlingAudioProfile.Safety = source.Safety; BaseHandlingAudioProfile.TriggerReset = source.TriggerReset; BaseHandlingAudioProfile.TopCoverRelease = source.TopCoverRelease; BaseHandlingAudioProfile.TopCoverUp = source.TopCoverUp; BaseHandlingAudioProfile.TopCoverDown = source.TopCoverDown; BaseHandlingAudioProfile.StockOpen = source.StockOpen; BaseHandlingAudioProfile.StockClosed = source.StockClosed; BaseHandlingAudioProfile.BipodOpen = source.BipodOpen; BaseHandlingAudioProfile.BipodClosed = source.BipodClosed; BaseHandlingAudioProfile.BeltGrab = source.BeltGrab; BaseHandlingAudioProfile.BeltRelease = source.BeltRelease; BaseHandlingAudioProfile.BeltSeat = source.BeltSeat; BaseHandlingAudioProfile.BeltSettle = source.BeltSettle; } private void EnforceHandlingSounds(FVRFirearmAudioSet targetProfile) { targetProfile.BoltRelease = BaseHandlingAudioProfile.BoltRelease; targetProfile.BoltSlideBack = BaseHandlingAudioProfile.BoltSlideBack; targetProfile.BoltSlideForward = BaseHandlingAudioProfile.BoltSlideForward; targetProfile.BoltSlideBackHeld = BaseHandlingAudioProfile.BoltSlideBackHeld; targetProfile.BoltSlideBackLocked = BaseHandlingAudioProfile.BoltSlideBackLocked; targetProfile.BreachOpen = BaseHandlingAudioProfile.BreachOpen; targetProfile.BreachClose = BaseHandlingAudioProfile.BreachClose; targetProfile.CatchOnSear = BaseHandlingAudioProfile.CatchOnSear; targetProfile.ChamberManual = BaseHandlingAudioProfile.ChamberManual; targetProfile.FireSelector = BaseHandlingAudioProfile.FireSelector; targetProfile.HammerHit = BaseHandlingAudioProfile.HammerHit; targetProfile.HandleBack = BaseHandlingAudioProfile.HandleBack; targetProfile.HandleBackEmpty = BaseHandlingAudioProfile.HandleBackEmpty; targetProfile.HandleForward = BaseHandlingAudioProfile.HandleForward; targetProfile.HandleForwardEmpty = BaseHandlingAudioProfile.HandleForwardEmpty; targetProfile.HandleUp = BaseHandlingAudioProfile.HandleUp; targetProfile.HandleDown = BaseHandlingAudioProfile.HandleDown; targetProfile.HandleGrab = BaseHandlingAudioProfile.HandleGrab; targetProfile.Prefire = BaseHandlingAudioProfile.Prefire; targetProfile.Safety = BaseHandlingAudioProfile.Safety; targetProfile.TriggerReset = BaseHandlingAudioProfile.TriggerReset; targetProfile.TopCoverRelease = BaseHandlingAudioProfile.TopCoverRelease; targetProfile.TopCoverUp = BaseHandlingAudioProfile.TopCoverUp; targetProfile.TopCoverDown = BaseHandlingAudioProfile.TopCoverDown; targetProfile.StockOpen = BaseHandlingAudioProfile.StockOpen; targetProfile.StockClosed = BaseHandlingAudioProfile.StockClosed; targetProfile.BipodOpen = BaseHandlingAudioProfile.BipodOpen; targetProfile.BipodClosed = BaseHandlingAudioProfile.BipodClosed; targetProfile.BeltGrab = BaseHandlingAudioProfile.BeltGrab; targetProfile.BeltRelease = BaseHandlingAudioProfile.BeltRelease; targetProfile.BeltSeat = BaseHandlingAudioProfile.BeltSeat; targetProfile.BeltSettle = BaseHandlingAudioProfile.BeltSettle; } } public class SecondaryMagSupport : ModularBarrelExtension { [Header("Secondary Magazine Configuration")] public bool ChangesSecondaryMagazine = false; public FireArmMagazineType SecondaryMagazineType; public Transform CustomSecondaryMagMountPoint; public Transform CustomSecondaryMagEjectPoint; private FVRFireArm _firearm; private Transform _origSecMagMountPos; private Transform _origSecMagEjectPos; private FireArmMagazineType _origSecondaryMagazineType; private bool _hasCachedOriginals = false; public override void EnablePart() { ((ModularBarrelExtension)this).EnablePart(); if (UnityEngineExtensions.TryGetComponentInParent<FVRFireArm>((Component)(object)((Component)this).transform, ref _firearm) && ChangesSecondaryMagazine) { CacheOriginalSecondaryMagSettings(_firearm); UpdateSecondaryMagazine(_firearm); } else { Debug.LogWarning((object)"SecondaryMagSupport: Firearm not found or ChangesSecondaryMagazine is false!"); } } public override void DisablePart() { ((ModularBarrelExtension)this).DisablePart(); if ((Object)(object)_firearm != (Object)null && ChangesSecondaryMagazine) { ResetSecondaryMagazine(_firearm); } } private void CacheOriginalSecondaryMagSettings(FVRFireArm firearm) { //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 (!_hasCachedOriginals && firearm.SecondaryMagazineSlots.Length != 0) { _origSecMagMountPos = firearm.SecondaryMagazineSlots[0].MagazineMountPos; _origSecMagEjectPos = firearm.SecondaryMagazineSlots[0].MagazineEjectPos; if ((Object)(object)firearm.SecondaryMagazineSlots[0].Magazine != (Object)null) { _origSecondaryMagazineType = firearm.SecondaryMagazineSlots[0].Magazine.MagazineType; } _hasCachedOriginals = true; } } private void UpdateSecondaryMagazine(FVRFireArm firearm) { //IL_0060: 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) if (firearm.SecondaryMagazineSlots.Length != 0) { firearm.SecondaryMagazineSlots[0].MagazineMountPos = CustomSecondaryMagMountPoint; firearm.SecondaryMagazineSlots[0].MagazineEjectPos = CustomSecondaryMagEjectPoint; if ((Object)(object)firearm.SecondaryMagazineSlots[0].Magazine != (Object)null) { firearm.SecondaryMagazineSlots[0].Magazine.MagazineType = SecondaryMagazineType; } Debug.Log((object)"SecondaryMagSupport: Secondary magazine settings updated."); } } private void ResetSecondaryMagazine(FVRFireArm firearm) { //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) if (_hasCachedOriginals && firearm.SecondaryMagazineSlots.Length != 0) { firearm.SecondaryMagazineSlots[0].MagazineMountPos = _origSecMagMountPos; firearm.SecondaryMagazineSlots[0].MagazineEjectPos = _origSecMagEjectPos; if ((Object)(object)firearm.SecondaryMagazineSlots[0].Magazine != (Object)null) { firearm.SecondaryMagazineSlots[0].Magazine.MagazineType = _origSecondaryMagazineType; } Debug.Log((object)"SecondaryMagSupport: Secondary magazine settings reset."); } } } public class HeatEffectToggleObject : FirearmHeatingEffect { [Header("Explosion Spawn")] public GameObject PrefabToSpawn; public Transform SpawnPoint; public float ToggleHeatThreshold = 0.95f; private bool hasSpawned = false; public void Update() { //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_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) ((FirearmHeatingEffect)this).Update(); if (hasSpawned || !(base.Heat >= ToggleHeatThreshold)) { return; } if ((Object)(object)PrefabToSpawn != (Object)null) { if ((Object)(object)SpawnPoint != (Object)null) { Object.Instantiate<GameObject>(PrefabToSpawn, SpawnPoint.position, SpawnPoint.rotation); } else { Object.Instantiate<GameObject>(PrefabToSpawn, ((Component)this).transform.position, ((Component)this).transform.rotation); } } hasSpawned = true; } } public class MGBarrel : MuzzleDevice { [Header("MGBarrel Lock Settings")] public float CatchRot; public bool IsLocked = false; public AudioSource AudSourceLock; public AudioClip AudClipLock; public Vector3 LockedLocalPosition; public Vector3 LockedLocalEulerAngles; public float LockAngle = 90f; public bool HasPlayedLockSound = false; [Header("Loose Barrel Settings")] public int ShotsUntilFallOff = 3; [HideInInspector] public int ShotsFiredWhileLoose = 0; protected void Awake() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).Awake(); ((FVRFireArmAttachment)this).Type = (FVRFireArmAttachementMountType)2; } public override void AttachToMount(FVRFireArmAttachmentMount m, bool playSound) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArmAttachment)this).AttachToMount(m, playSound); ((Component)this).transform.localEulerAngles = new Vector3(0f, 0f, CatchRot); } public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!IsLocked && (Object)(object)((FVRFireArmAttachment)this).curMount != (Object)null) { ShotsFiredWhileLoose++; if (ShotsFiredWhileLoose >= ShotsUntilFallOff) { ((FVRFireArmAttachment)this).DetachFromMount(); } } else { ShotsFiredWhileLoose = 0; } ((MuzzleDevice)this).OnShot(f, tailClass); } } public class MGBarrelInterface : MuzzleDeviceInterface { private MGBarrel tempBarrel; private Vector3 lastHandForward = Vector3.zero; private Vector3 lastMountForward = Vector3.zero; public AudioClip AudClipUnlock; public AudioSource AudSourceUnlock; private const float lockThreshold = 2f; private const float unlockThreshold = 2f; private float lockCooldownTime = 0f; private float lockCooldownTimer = 0f; public float LockSnapBuffer = 3f; public float LockedPreventDetachTime = 0.35f; private float lockedGraceTimer = 0f; public float UnlockAllowDetachTime = 0.5f; private float canBePulledTimer = 0f; private Vector3 mountedLocalPosition = Vector3.zero; private bool mountedLocalPositionRecorded = false; public float DetachDistanceThreshold = 0.08f; private bool m_isInSnappingMode = false; private bool hasPlayedUnlockSoundThisUnlock = false; public float IgnoreDetachOnGrabTime = 0.12f; private float ignoreDetachTimer = 0f; public override void Awake() { ((FVRFireArmAttachmentInterface)this).Awake(); tempBarrel = ((FVRFireArmAttachmentInterface)this).Attachment as MGBarrel; } public override void OnAttach() { //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_0082: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDeviceInterface)this).OnAttach(); tempBarrel = ((FVRFireArmAttachmentInterface)this).Attachment as MGBarrel; if ((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null) { mountedLocalPosition = ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localPosition; mountedLocalPositionRecorded = true; ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localEulerAngles = new Vector3(0f, 0f, (!((Object)(object)tempBarrel != (Object)null)) ? 0f : tempBarrel.CatchRot); } if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount != (Object)null) { SetSnapping(b: true); lastHandForward = ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Up; lastMountForward = ((Component)((FVRFireArmAttachmentInterface)this).Attachment.curMount).transform.up; lockCooldownTimer = 0f; lockedGraceTimer = 0f; canBePulledTimer = 0f; hasPlayedUnlockSoundThisUnlock = false; TryLockImmediateOnAttach(); } } private void TryLockImmediateOnAttach() { if ((Object)(object)tempBarrel == (Object)null || (Object)(object)((FVRFireArmAttachmentInterface)this).Attachment == (Object)null || (Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount == (Object)null) { return; } float lockAngle = tempBarrel.LockAngle; float num = 2f + LockSnapBuffer; if (tempBarrel.IsLocked) { return; } if (lockAngle >= 0f) { if (tempBarrel.CatchRot >= lockAngle - num) { DoLock(lockAngle); } } else if (tempBarrel.CatchRot <= lockAngle + num) { DoLock(lockAngle); } } private void DoLock(float target) { //IL_0080: 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_0090: 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_0054: 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_00b1: Unknown result type (might be due to invalid IL or missing references) tempBarrel.CatchRot = target; tempBarrel.IsLocked = true; lockedGraceTimer = LockedPreventDetachTime; lockCooldownTimer = lockCooldownTime; if (mountedLocalPositionRecorded) { ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localPosition = mountedLocalPosition + tempBarrel.LockedLocalPosition; } else { ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localPosition = ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localPosition + tempBarrel.LockedLocalPosition; } ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localEulerAngles = new Vector3(0f, 0f, target); if (!tempBarrel.HasPlayedLockSound && (Object)(object)tempBarrel.AudSourceLock != (Object)null && (Object)(object)tempBarrel.AudClipLock != (Object)null) { tempBarrel.AudSourceLock.PlayOneShot(tempBarrel.AudClipLock); tempBarrel.HasPlayedLockSound = true; } canBePulledTimer = 0f; hasPlayedUnlockSoundThisUnlock = false; } private void DoUnlock() { //IL_0043: 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) tempBarrel.IsLocked = false; tempBarrel.HasPlayedLockSound = false; tempBarrel.CatchRot = 0f; ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localEulerAngles = new Vector3(0f, 0f, 0f); if (mountedLocalPositionRecorded) { ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localPosition = mountedLocalPosition; } canBePulledTimer = UnlockAllowDetachTime; if (!hasPlayedUnlockSoundThisUnlock && (Object)(object)AudSourceUnlock != (Object)null && (Object)(object)AudClipUnlock != (Object)null) { AudSourceUnlock.PlayOneShot(AudClipUnlock); hasPlayedUnlockSoundThisUnlock = true; } } public override void OnDetach() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tempBarrel != (Object)null && mountedLocalPositionRecorded && (Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null) { ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localPosition = mountedLocalPosition; } if ((Object)(object)tempBarrel != (Object)null) { tempBarrel.IsLocked = false; tempBarrel.HasPlayedLockSound = false; tempBarrel.CatchRot = 0f; } ((MuzzleDeviceInterface)this).OnDetach(); mountedLocalPositionRecorded = false; canBePulledTimer = 0f; hasPlayedUnlockSoundThisUnlock = false; } public override void BeginInteraction(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_0060: 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_0056: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).BeginInteraction(hand); lastHandForward = ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Up; lastMountForward = ((!((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null) || !((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount != (Object)null)) ? Vector3.up : ((Component)((FVRFireArmAttachmentInterface)this).Attachment.curMount).transform.up); lockCooldownTimer = 0f; lockedGraceTimer = 0f; canBePulledTimer = 0f; hasPlayedUnlockSoundThisUnlock = false; ignoreDetachTimer = IgnoreDetachOnGrabTime; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand); if (lockedGraceTimer > 0f) { lockedGraceTimer -= Time.deltaTime; if (lockedGraceTimer < 0f) { lockedGraceTimer = 0f; } } if (lockCooldownTimer > 0f) { lockCooldownTimer -= Time.deltaTime; if (lockCooldownTimer < 0f) { lockCooldownTimer = 0f; } } if (canBePulledTimer > 0f) { canBePulledTimer -= Time.deltaTime; if (canBePulledTimer <= 0f) { canBePulledTimer = 0f; } } if (ignoreDetachTimer > 0f) { ignoreDetachTimer -= Time.deltaTime; if (ignoreDetachTimer < 0f) { ignoreDetachTimer = 0f; } } UpdateSnappingBasedOnDistance(); if (((FVRInteractiveObject)this).IsHeld && (Object)(object)tempBarrel != (Object)null) { ((Component)((FVRFireArmAttachmentInterface)this).Attachment).transform.localEulerAngles = new Vector3(0f, 0f, tempBarrel.CatchRot); } if ((Object)(object)tempBarrel == (Object)null) { return; } float lockAngle = tempBarrel.LockAngle; float num = 2f + LockSnapBuffer; if (!tempBarrel.IsLocked) { if (lockAngle >= 0f) { if (tempBarrel.CatchRot >= lockAngle - num) { DoLock(lockAngle); } } else if (tempBarrel.CatchRot <= lockAngle + num) { DoLock(lockAngle); } } else if (Mathf.Abs(tempBarrel.CatchRot) <= 2f && lockedGraceTimer <= 0f) { DoUnlock(); } if (tempBarrel.IsLocked || !((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null) || !((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount != (Object)null)) { return; } FVRFireArmAttachmentMount rootMount = ((FVRFireArmAttachmentInterface)this).Attachment.curMount.GetRootMount(); Transform val = ((!((Object)(object)rootMount != (Object)null) || !(rootMount.MyObject is FVRFireArm)) ? null : ((FVRFireArm)rootMount.MyObject).MuzzlePos); if (!((Object)(object)val != (Object)null)) { return; } Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(((FVRFireArmAttachmentInterface)this).Attachment.curMount.Point_Front.position, val.position, ((Component)this).transform.position); float num2 = Vector3.Distance(((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos, closestValidPoint); if (canBePulledTimer > 0f) { if (num2 > DetachDistanceThreshold) { canBePulledTimer = 0f; ((FVRInteractiveObject)this).EndInteraction(hand); hand.ForceSetInteractable((FVRInteractiveObject)(object)((FVRFireArmAttachmentInterface)this).Attachment); ((FVRInteractiveObject)((FVRFireArmAttachmentInterface)this).Attachment).BeginInteraction(hand); } } else if (ignoreDetachTimer <= 0f && num2 > DetachDistanceThreshold) { ((FVRInteractiveObject)this).EndInteraction(hand); hand.ForceSetInteractable((FVRInteractiveObject)(object)((FVRFireArmAttachmentInterface)this).Attachment); ((FVRInteractiveObject)((FVRFireArmAttachmentInterface)this).Attachment).BeginInteraction(hand); } } public override void FVRFixedUpdate() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_009a: 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_00a5: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_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_011f: 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_012c: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tempBarrel == (Object)null) { ((FVRInteractiveObject)this).FVRFixedUpdate(); return; } if (((FVRInteractiveObject)this).IsHeld && m_isInSnappingMode && lockCooldownTimer <= 0f && lockedGraceTimer <= 0f) { Vector3 val = Vector3.ProjectOnPlane(((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Up, ((Component)this).transform.forward); Vector3 val2 = Vector3.ProjectOnPlane(lastHandForward, ((Component)this).transform.forward); float num = Mathf.Atan2(Vector3.Dot(((Component)this).transform.forward, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f; Vector3 val3 = Vector3.ProjectOnPlane((!((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null) || !((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount != (Object)null)) ? Vector3.up : ((Component)((FVRFireArmAttachmentInterface)this).Attachment.curMount).transform.up, ((Component)this).transform.forward); Vector3 val4 = Vector3.ProjectOnPlane(lastMountForward, ((Component)this).transform.forward); float num2 = Mathf.Atan2(Vector3.Dot(((Component)this).transform.forward, Vector3.Cross(val3, val4)), Vector3.Dot(val3, val4)) * 57.29578f; tempBarrel.CatchRot -= num; tempBarrel.CatchRot += num2; float lockAngle = tempBarrel.LockAngle; float num3 = Mathf.Min(0f, lockAngle); float num4 = Mathf.Max(0f, lockAngle); tempBarrel.CatchRot = Mathf.Clamp(tempBarrel.CatchRot, num3, num4); lastHandForward = ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Up; lastMountForward = ((!((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null) || !((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount != (Object)null)) ? lastMountForward : ((Component)((FVRFireArmAttachmentInterface)this).Attachment.curMount).transform.up); } ((FVRInteractiveObject)this).FVRFixedUpdate(); } public override void EndInteraction(FVRViveHand hand) { if (!tempBarrel.IsLocked && Mathf.Abs(tempBarrel.CatchRot) <= 2f && lockedGraceTimer <= 0f) { ((FVRInteractiveObject)this).EndInteraction(hand); } } private void UpdateSnappingBasedOnDistance() { //IL_005e: 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_007e: 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_0088: 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_0090: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment == (Object)null || (Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount == (Object)null) { SetSnapping(b: false); return; } if (((FVRInteractiveObject)this).IsHeld) { SetSnapping(b: true); return; } Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(((FVRFireArmAttachmentInterface)this).Attachment.curMount.Point_Front.position, ((FVRFireArmAttachmentInterface)this).Attachment.curMount.Point_Rear.position, ((Component)this).transform.position); if (Vector3.Distance(closestValidPoint, ((Component)this).transform.position) < DetachDistanceThreshold || ((Object)(object)tempBarrel != (Object)null && Mathf.Abs(tempBarrel.CatchRot) > 1f)) { SetSnapping(b: true); } else { SetSnapping(b: false); } } private void SetSnapping(bool b) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (m_isInSnappingMode == b) { return; } m_isInSnappingMode = b; if (m_isInSnappingMode) { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, "NoCol"); if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { lastHandForward = ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Up; } if ((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment != (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)this).Attachment.curMount != (Object)null) { lastMountForward = ((Component)((FVRFireArmAttachmentInterface)this).Attachment.curMount).transform.up; } } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, "Default"); } } } namespace Volks.ModulARLMG; [BepInPlugin("Volks.ModulARLMG", "ModulARLMG", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] [BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")] [BepInDependency("nrgill28.Sodalite", "1.4.2")] public class ModulARLMGPlugin : 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.ModulARLMG"); OtherLoader.RegisterDirectLoad(BasePath, "Volks.ModulARLMG", "", "", "modularlmg", ""); GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modularlmg")); } } [RequireComponent(typeof(FVRFireArmMagazine))] public class BeltMagazinePhysics : MonoBehaviour { [Header("Debugging")] [Tooltip("Enable to print diagnostic logs to the BepInEx / Unity developer console.")] public bool EnableDebug = false; [Header("Compatibility")] [Tooltip("If checked, the belt will bypass all magazine type checks and attempt to load into ANY belt-fed gun.")] public bool BypassTypeMatching = false; [Tooltip("Allows this belt to load into weapons of specific MagazineType enums (e.g. base-game M249 types).")] public FireArmMagazineType[] CompatibleMagazineTypes; [Header("Belt Chain")] [Tooltip("The point where the belt exits the magazine when NOT loaded. Its forward axis defines the exit direction.")] public Transform BeltExitPoint; [Tooltip("Number of physics nodes rigidly locked along the anchor's exit axis before free simulation begins. Increase this to prevent sagging into the gun.")] public int PinnedNodes = 3; [Tooltip("Total number of simulation nodes in the chain. More = smoother but more expensive.")] public int ChainNodeCount = 8; [Tooltip("Distance between each chain node in metres. Set this to match your link spacing (e.g., 0.018 to 0.02 for 5.56 ammo).")] public float NodeDistance = 0.02f; [Tooltip("Velocity damping per frame when NOT loaded. Lower values (e.g. 0.90) make the belt stiffer and reduce swinging.")] [Range(0f, 1f)] public float Damping = 0.95f; [Tooltip("Gravity scale applied to chain nodes.")] public float GravityScale = 1f; [Tooltip("Number of constraint solving iterations per frame. More = more stable.")] public int ConstraintIterations = 3; [Header("Loaded Physics Override")] [Range(0f, 1f)] [Tooltip("How rigid the belt becomes when loaded into the gun. 0 = fully floppy world physics, 1 = completely frozen straight. Adjust this to eliminate physics jitter when moving with the gun.")] public float LoadedRigidity = 0.5f; [Range(0f, 1f)] [Tooltip("Damping applied strictly when the belt is loaded into the gun. Lower values (e.g. 0.80) heavily slow down the swinging and absorb movement jitter.")] public float LoadedDamping = 0.9f; [Header("Bending Stiffness")] [Range(0f, 1f)] [Tooltip("How much the belt resists folding/bending. Higher values (e.g. 0.7) make the belt hang like a heavy, rigid metal belt rather than floppy cloth. Prevents wild swinging with zero jitter.")] public float BendingStiffness = 0.6f; [Header("Bullet Orientation & Constraints")] [Tooltip("Euler rotation offset applied strictly to the flat bullets sitting on the gun's feed tray.")] public Vector3 FeedTrayRotationOffset = Vector3.zero; [Tooltip("Euler rotation offset applied strictly to the dangling/simulated bullets hanging down.")] public Vector3 HangingRotationOffset = Vector3.zero; [Tooltip("The name of the child GameObject inside your bullet prefab that represents the metal link (case-insensitive). If found, only the link will bend, while the cartridge stays parallel.")] public string LinkChildName = "link"; [Tooltip("The local direction of the gun's proxy round that the hanging belt should flow out from.")] public Vector3 LoadedExitDirection = new Vector3(-1f, 0f, 0f); [Tooltip("The local direction the belt exits from when NOT loaded (held in hand). Lies on the local X-Y plane to prevent squashing.")] public Vector3 UnloadedExitDirection = new Vector3(0f, -1f, 0f); [Header("Snapped Feed Tray Rounds")] [Tooltip("How many bullets sit rigidly flat on the gun's top feed tray cover before the belt hangs down dynamically. (Usually 3 to 5 on an M249).")] public int SnappedFeedTrayRounds = 4; [Header("Loading")] [Tooltip("Detection radius around BeltExitPoint for feed tray detection.")] public float LoadDetectionRadius = 0.12f; [Tooltip("After ejecting or removing the belt, how many seconds to wait before it can be loaded again. Prevents instant re-insertion.")] public float ReinsertCooldown = 1f; private FVRFireArmMagazine _magazine; private Vector3[] _positions; private Vector3[] _prevPositions; private bool _chainInitialized = false; private bool _wasLoadedLastFrame = false; private FVRFireArm _lastLoadedFireArm = null; private float _cooldownTimer = 0f; private Vector3 _physicsAnchorPosition; private void Awake() { _magazine = ((Component)this).GetComponent<FVRFireArmMagazine>(); if (EnableDebug) { Debug.Log((object)"[BeltPhysicsDebug] Awake called on custom belt."); } _magazine.HidesAllDisplayBulletsWhenGrabbed = false; FVRFireArmReloadTriggerMag[] componentsInChildren = ((Component)this).GetComponentsInChildren<FVRFireArmReloadTriggerMag>(); if (EnableDebug) { Debug.Log((object)("[BeltPhysicsDebug] Found " + componentsInChildren.Length + " FVRFireArmReloadTriggerMag components to disable.")); } FVRFireArmReloadTriggerMag[] array = componentsInChildren; foreach (FVRFireArmReloadTriggerMag val in array) { if (!((Object)(object)val != (Object)null)) { continue; } ((Behaviour)val).enabled = false; Collider component = ((Component)val).GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { component.enabled = false; if (EnableDebug) { Debug.Log((object)("[BeltPhysicsDebug] Successfully disabled trigger well collider on sub-object: " + ((Object)val).name)); } } } } private void Start() { InitChain(); } private void OnEnable() { if (_chainInitialized) { InitChain(); } } private void FixedUpdate() { if (_cooldownTimer > 0f) { _cooldownTimer -= Time.fixedDeltaTime; } else { _cooldownTimer = 0f; } if (_cooldownTimer <= 0f) { HandleFeedTrayDetection(); } if ((Object)(object)_magazine.FireArm != (Object)null) { _magazine.FireArm.ConnectedToBox = true; _magazine.FireArm.HasBelt = true; } if (_chainInitialized) { UpdateChain(); } } private void Update() { if ((Object)(object)_magazine != (Object)null && (Object)(object)_magazine.FireArm != (Object)null) { _magazine.FireArm.ConnectedToBox = true; _magazine.FireArm.HasBelt = true; } } private void HandleFeedTrayDetection() { //IL_001c: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_0284: Invalid comparison between Unknown and I4 //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)_magazine).IsHeld || (int)_magazine.State != 0 || (Object)(object)BeltExitPoint == (Object)null) { return; } float num = 0.25f; Collider[] array = Physics.OverlapSphere(BeltExitPoint.position, num, -1, (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val in array2) { FVRFireArm componentInParent = ((Component)val).GetComponentInParent<FVRFireArm>(); if ((Object)(object)componentInParent == (Object)null || !componentInParent.UsesBelts || (Object)(object)componentInParent.BeltDD == (Object)null || (Object)(object)componentInParent.Magazine != (Object)null) { continue; } bool flag = !componentInParent.UsesTopCover || componentInParent.IsTopCoverUp; if (componentInParent.UsesTopCover && !flag) { FVRFireArmTopCover componentInChildren = ((Component)componentInParent).GetComponentInChildren<FVRFireArmTopCover>(true); if ((Object)(object)componentInChildren != (Object)null) { float num2 = ((Component)componentInChildren).transform.localEulerAngles.x; if (num2 > 180f) { num2 -= 360f; } if (Mathf.Abs(num2) > 15f || ((FVRInteractiveObject)componentInChildren).IsHeld) { flag = true; } } else { flag = true; if (EnableDebug) { Debug.Log((object)"[BeltPhysicsDebug] Gun uses top cover, but FVRFireArmTopCover component was not found in hierarchy. Defaulting to Open."); } } } if (!flag) { if (EnableDebug) { Debug.Log((object)("[BeltPhysicsDebug] Found gun " + ((Object)componentInParent).name + ", but top cover is closed. Cannot load.")); } continue; } FireArmMagazineType val2 = componentInParent.MagazineType; FVRFireArmReloadTriggerWell[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<FVRFireArmReloadTriggerWell>(true); FVRFireArmReloadTriggerWell[] array3 = componentsInChildren; foreach (FVRFireArmReloadTriggerWell val3 in array3) { if ((Object)(object)val3 != (Object)null && ((_magazine.IsBeltBox && val3.IsBeltBox) || (val3.UsesTypeOverride && val3.TypeOverride == _magazine.MagazineType))) { val2 = val3.TypeOverride; break; } } bool flag2 = BypassTypeMatching || val2 == _magazine.MagazineType; if (!flag2 && CompatibleMagazineTypes != null) { for (int k = 0; k < CompatibleMagazineTypes.Length; k++) { if ((int)val2 == (int)CompatibleMagazineTypes[k]) { flag2 = true; break; } } } if (!flag2) { if (EnableDebug) { Debug.Log((object)string.Concat("[BeltPhysicsDebug] Type Mismatch! Gun expects: ", val2, ", but this belt is: ", _magazine.MagazineType, ".")); } } else { if (componentInParent.EjectDelay > 0f && (Object)(object)_magazine == (Object)(object)componentInParent.LastEjectedMag) { continue; } Vector3 val4 = Vector3.zero; bool flag3 = false; List<Transform> proxyRounds = componentInParent.BeltDD.ProxyRounds; if (proxyRounds != null && proxyRounds.Count > 0 && (Object)(object)proxyRounds[0] != (Object)null) { val4 = proxyRounds[0].position; flag3 = true; } else { FVRFireArmBeltRemovalTrigger componentInChildren2 = ((Component)componentInParent).GetComponentInChildren<FVRFireArmBeltRemovalTrigger>(true); if ((Object)(object)componentInChildren2 != (Object)null) { val4 = ((Component)componentInChildren2).transform.position; flag3 = true; } } if (!flag3) { FVRFireArmTopCover componentInChildren3 = ((Component)componentInParent).GetComponentInChildren<FVRFireArmTopCover>(true); if ((Object)(object)componentInChildren3 != (Object)null) { val4 = ((Component)componentInChildren3).transform.position; flag3 = true; } } if (!flag3) { continue; } float num3 = Vector3.Distance(BeltExitPoint.position, val4); if (EnableDebug) { Debug.Log((object)("[BeltPhysicsDebug] Found Compatible Gun: " + ((Object)componentInParent).name + " | Distance to Feed Tray Trigger: " + num3 + "m")); } if (num3 <= LoadDetectionRadius) { if (EnableDebug) { Debug.Log((object)("[BeltPhysicsDebug] Loading belt directly into feed tray trigger of " + ((Object)componentInParent).name + "!")); } _magazine.Load(componentInParent); break; } } } } private void LateUpdate() { //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) if (!_chainInitialized) { return; } bool flag = (Object)(object)_magazine.FireArm != (Object)null; int num = _magazine.m_numRounds; if (flag && (Object)(object)_magazine.FireArm.BeltDD != (Object)null) { num += _magazine.FireArm.BeltDD.BeltRounds.Count; } if (flag && num == 0) { if (EnableDebug) { Debug.Log((object)"[BeltPhysicsDebug] Belt is completely empty. Auto-ejecting and deleting empty belt GameObject!"); } FVRFireArm fireArm = _magazine.FireArm; SetGunProxyRenderersEnabled(enabled: true, fireArm); if ((Object)(object)fireArm.BeltDD != (Object)null) { fireArm.ConnectedToBox = false; fireArm.HasBelt = false; fireArm.BeltDD.PullPushBelt((FVRFireArmMagazine)null, 0); } fireArm.EjectMag(true); Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (flag) { FVRFireArm fireArm2 = _magazine.FireArm; SetGunProxyRenderersEnabled(enabled: false, fireArm2); if (!_wasLoadedLastFrame) { if (EnableDebug) { Debug.Log((object)"[BeltPhysicsDebug] Belt just loaded into weapon. Bypassing ForceMount bug and setting colliders to 'NoCol'."); } if ((Object)(object)fireArm2.BeltDD != (Object)null) { fireArm2.ConnectedToBox = true; fireArm2.HasBelt = true; fireArm2.BeltDD.PullPushBelt(_magazine, fireArm2.BeltDD.BeltCapacity); } ((FVRInteractiveObject)_magazine).SetAllCollidersToLayer(false, "NoCol"); _lastLoadedFireArm = fireArm2; _wasLoadedLastFrame = true; } } else if (!flag && _wasLoadedLastFrame) { if (EnableDebug) { Debug.Log((object)"[BeltPhysicsDebug] Belt just removed from weapon. Re-enabling static proxies and restoring colliders to 'Default'."); } if ((Object)(object)_lastLoadedFireArm != (Object)null && (Object)(object)_lastLoadedFireArm.BeltDD != (Object)null) { _lastLoadedFireArm.BeltDD.PullPushBelt(_magazine, 0); _lastLoadedFireArm.ConnectedToBox = false; _lastLoadedFireArm.HasBelt = false; _lastLoadedFireArm.BeltDD.PullPushBelt((FVRFireArmMagazine)null, 0); } _lastLoadedFireArm = null; ((FVRInteractiveObject)_magazine).SetAllCollidersToLayer(false, "Default"); _wasLoadedLastFrame = false; } if (flag && (Object)(object)_magazine.BeltGrabTrigger != (Object)null && ((FVRInteractiveObject)_magazine.BeltGrabTrigger).IsHeld) { if (EnableDebug) { Debug.Log((object)"[BeltPhysicsDebug] Hand grab detected on BeltGrabTrigger! Ejecting belt cleanly."); } FVRViveHand hand = ((FVRInteractiveObject)_magazine.BeltGrabTrigger).m_hand; if ((Object)(object)hand != (Object)null) { FVRFireArm fireArm3 = _magazine.FireArm; if ((Object)(object)fireArm3.BeltDD != (Object)null) { fireArm3.BeltDD.PullPushBelt(_magazine, 0); } fireArm3.EjectMag(false); ((FVRInteractiveObject)_magazine.BeltGrabTrigger).ForceBreakInteraction(); hand.ForceSetInteractable((FVRInteractiveObject)(object)_magazine); ((FVRInteractiveObject)_magazine).BeginInteraction(hand); flag = false; } } if (flag && (Object)(object)_magazine.FireArm != (Object)null) { _magazine.FireArm.ConnectedToBox = true; _magazine.FireArm.HasBelt = true; } if (flag) { Transform anchorTransform = GetAnchorTransform(); if ((Object)(object)anchorTransform != (Object)null) { ((Component)this).transform.position = anchorTransform.position; ((Component)this).transform.rotation = ((Component)_magazine.FireArm).transform.rotation; } } PositionBullets(); } private void InitChain() { //IL_006a: 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_006f: 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_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_00a1: 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_00b7: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (_positions == null || _positions.Length != ChainNodeCount) { _positions = (Vector3[])(object)new Vector3[ChainNodeCount]; _prevPositions = (Vector3[])(object)new Vector3[ChainNodeCount]; } Vector3 val = ((!((Object)(object)BeltExitPoint != (Object)null)) ? ((Component)this).transform.position : BeltExitPoint.position); Vector3 val2 = ((!((Object)(object)BeltExitPoint != (Object)null)) ? Vector3.down : BeltExitPoint.TransformDirection(((Vector3)(ref UnloadedExitDirection)).normalized)); for (int i = 0; i < ChainNodeCount; i++) { ref Vector3 reference = ref _positions[i]; reference = val + val2 * (NodeDistance * (float)i); ref Vector3 reference2 = ref _prevPositions[i]; reference2 = _positions[i]; } _physicsAnchorPosition = val; _chainInitialized = true; if (EnableDebug) { Debug.Log((object)("[BeltPhysicsDebug] Verlet Chain initialized with " + ChainNodeCount + " nodes.")); } } private void UpdateChain() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0645: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: 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_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: 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_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) Transform anchorTransform = GetAnchorTransform(); if ((Object)(object)anchorTransform == (Object)null) { return; } bool flag = (Object)(object)((FVRPhysicalObject)_magazine).QuickbeltSlot != (Object)null; Vector3 position = anchorTransform.position; Vector3 val = ((!((Object)(object)_magazine.FireArm != (Object)null)) ? anchorTransform.TransformDirection(((Vector3)(ref UnloadedExitDirection)).normalized) : anchorTransform.TransformDirection(((Vector3)(ref LoadedExitDirection)).normalized)); int num = Mathf.Clamp(PinnedNodes, 1, ChainNodeCount); if (flag) { for (int i = 0; i < ChainNodeCount; i++) { ref Vector3 reference = ref _positions[i]; reference = position + val * (NodeDistance * (float)i); ref Vector3 reference2 = ref _prevPositions[i]; reference2 = _positions[i]; } _physicsAnchorPosition = anchorTransform.position; return; } for (int j = 0; j < num; j++) { ref Vector3 reference3 = ref _positions[j]; reference3 = position + val * (NodeDistance * (float)j); ref Vector3 reference4 = ref _prevPositions[j]; reference4 = _positions[j]; } float num2 = ((!((Object)(object)_magazine.FireArm != (Object)null)) ? Damping : LoadedDamping); float fixedDeltaTime = Time.fixedDeltaTime; for (int k = num; k < ChainNodeCount; k++) { Vector3 val2 = (_positions[k] - _prevPositions[k]) * num2; ref Vector3 reference5 = ref _prevPositions[k]; reference5 = _positions[k]; ref Vector3 reference6 = ref _positions[k]; reference6 += val2 + Physics.gravity * GravityScale * fixedDeltaTime * fixedDeltaTime; } for (int l = 0; l < ConstraintIterations; l++) { for (int m = 0; m < num; m++) { ref Vector3 reference7 = ref _positions[m]; reference7 = position + val * (NodeDistance * (float)m); } for (int n = 0; n < ChainNodeCount - 1; n++) { if (n + 1 < num) { continue; } Vector3 val3 = _positions[n + 1] - _positions[n]; float magnitude = ((Vector3)(ref val3)).magnitude; if (!(magnitude < 0.0001f)) { float num3 = (magnitude - NodeDistance) / magnitude; if (n < num) { ref Vector3 reference8 = ref _positions[n + 1]; reference8 -= val3 * num3; continue; } ref Vector3 reference9 = ref _positions[n]; reference9 += val3 * num3 * 0.5f; ref Vector3 reference10 = ref _positions[n + 1]; reference10 -= val3 * num3 * 0.5f; } } for (int num4 = num; num4 < ChainNodeCount; num4++) { Vector3 val4 = anchorTransform.InverseTransformPoint(_positions[num4]); val4.z = 0f; ref Vector3 reference11 = ref _positions[num4]; reference11 = anchorTransform.TransformPoint(val4); } for (int num5 = 0; num5 < ChainNodeCount - 2; num5++) { if (num5 + 2 < num) { continue; } Vector3 val5 = _positions[num5 + 2] - _positions[num5]; float magnitude2 = ((Vector3)(ref val5)).magnitude; float num6 = NodeDistance * 2f; if (!(magnitude2 < 0.0001f)) { float num7 = (magnitude2 - num6) / magnitude2; if (num5 < num) { ref Vector3 reference12 = ref _positions[num5 + 2]; reference12 -= val5 * num7 * BendingStiffness; continue; } ref Vector3 reference13 = ref _positions[num5]; reference13 += val5 * num7 * BendingStiffness * 0.5f; ref Vector3 reference14 = ref _positions[num5 + 2]; reference14 -= val5 * num7 * BendingStiffness * 0.5f; } } } if ((Object)(object)_magazine.FireArm != (Object)null && LoadedRigidity > 0f) { for (int num8 = num; num8 < ChainNodeCount; num8++) { Vector3 val6 = position + val * (NodeDistance * (float)num8); Vector3 val7 = Vector3.Lerp(_positions[num8], val6, LoadedRigidity); Vector3 val8 = val7 - _positions[num8]; _positions[num8] = val7; ref Vector3 reference15 = ref _prevPositions[num8]; reference15 += val8; } } _physicsAnchorPosition = anchorTransform.position; } private Transform GetLinkChild(Transform bulletParent) { if ((Object)(object)bulletParent == (Object)null || string.IsNullOrEmpty(LinkChildName)) { return null; } for (int i = 0; i < bulletParent.childCount; i++) { Transform child = bulletParent.GetChild(i); if ((Object)(object)child != (Object)null && ((Object)child).name.ToLower().Contains(LinkChildName.ToLower())) { return child; } } return null; } private void PositionBullets() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: 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_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_0069: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0435: 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_0447: Unknown result type (might be due to invalid IL or missing references) if (_magazine.DisplayBullets == null || _magazine.DisplayBullets.Length == 0) { return; } Quaternion val = Quaternion.Euler(FeedTrayRotationOffset); Quaternion val2 = Quaternion.Euler(HangingRotationOffset); Transform anchorTransform = GetAnchorTransform(); if ((Object)(object)anchorTransform == (Object)null) { return; } Vector3 val3 = anchorTransform.position - _physicsAnchorPosition; Vector3 val4 = ((!((Object)(object)_magazine.FireArm != (Object)null)) ? anchorTransform.TransformDirection(((Vector3)(ref UnloadedExitDirection)).normalized) : anchorTransform.TransformDirection(((Vector3)(ref LoadedExitDirection)).normalized)); List<Transform> list = ((!((Object)(object)_magazine.FireArm != (Object)null) || !((Object)(object)_magazine.FireArm.BeltDD != (Object)null)) ? null : _magazine.FireArm.BeltDD.ProxyRounds); int num = 0; if ((Object)(object)_magazine.FireArm != (Object)null && list != null) { num = Mathf.Min(new int[3] { SnappedFeedTrayRounds, _magazine.FireArm.BeltDD.BeltRounds.Count, list.Count }); } int num2 = _magazine.m_numRounds; if ((Object)(object)_magazine.FireArm != (Object)null && (Object)(object)_magazine.FireArm.BeltDD != (Object)null) { num2 += _magazine.FireArm.BeltDD.BeltRounds.Count; } int num3 = 0; Quaternion val5 = ((Component)_magazine).transform.rotation * val2; for (int i = 0; i < _magazine.DisplayBullets.Length; i++) { if ((Object)(object)_magazine.DisplayBullets[i] == (Object)null) { continue; } bool flag = num3 < num2; _magazine.DisplayBullets[i].SetActive(flag); if (!flag) { continue; } if (num3 < num && list != null && num3 < list.Count && (Object)(object)list[num3] != (Object)null) { Transform val6 = list[num3]; _magazine.DisplayBullets[i].transform.position = val6.position; _magazine.DisplayBullets[i].transform.rotation = val6.rotation * val; Transform linkChild = GetLinkChild(_magazine.DisplayBullets[i].transform); if ((Object)(object)linkChild != (Object)null) { linkChild.localRotation = Quaternion.identity; } } else { int num4 = num3 - num; if (num4 >= ChainNodeCount) { num4 = ChainNodeCount - 1; } _magazine.DisplayBullets[i].transform.position = _positions[num4] + val3; Transform linkChild2 = GetLinkChild(_magazine.DisplayBullets[i].transform); Vector3 normalized; if (num4 < ChainNodeCount - 1) { Vector3 val7 = _positions[num4 + 1] - _positions[num4]; normalized = ((Vector3)(ref val7)).normalized; } else { Vector3 val8 = _positions[num4] - _positions[Mathf.Max(num4 - 1, 0)]; normalized = ((Vector3)(ref val8)).normalized; } Quaternion val9 = Quaternion.FromToRotation(val4, normalized); Quaternion val10 = val9 * val5; if ((Object)(object)linkChild2 != (Object)null) { _magazine.DisplayBullets[i].transform.localRotation = val2; if (normalized != Vector3.zero) { Quaternion val11 = Quaternion.Inverse(val5) * val10; linkChild2.localRotation = Quaternion.Slerp(linkChild2.localRotation, val11, Time.deltaTime * 20f); } } else if (normalized != Vector3.zero) { Quaternion val12 = Quaternion.Inverse(((Component)_magazine).transform.rotation) * val10; _magazine.DisplayBullets[i].transform.localRotation = Quaternion.Slerp(_magazine.DisplayBullets[i].transform.localRotation, val12, Time.deltaTime * 20f); } } num3++; } } private Transform GetAnchorTransform() { if ((Object)(object)_magazine.FireArm != (Object)null && (Object)(object)_magazine.FireArm.BeltDD != (Object)null && _magazine.FireArm.BeltDD.ProxyRounds != null) { List<Transform> proxyRounds = _magazine.FireArm.BeltDD.ProxyRounds; int num = Mathf.Clamp(SnappedFeedTrayRounds - 1, 0, proxyRounds.Count - 1); if (num >= 0 && num < proxyRounds.Count && (Object)(object)proxyRounds[num] != (Object)null) { return proxyRounds[num]; } } return BeltExitPoint; } private void SetGunProxyRenderersEnabled(bool enabled, FVRFireArm gunContext) { if ((Object)(object)gunContext == (Object)null || (Object)(object)gunContext.BeltDD == (Object)null || gunContext.BeltDD.ProxyRounds == null) { return; } List<Transform> proxyRounds = gunContext.BeltDD.ProxyRounds; for (int i = 0; i < proxyRounds.Count; i++) { if (!((Object)(object)proxyRounds[i] != (Object)null)) { continue; } Renderer[] componentsInChildren = ((Component)proxyRounds[i]).GetComponentsInChildren<Renderer>(); for (int j = 0; j < componentsInChildren.Length; j++) { if ((Object)(object)componentsInChildren[j] != (Object)null) { componentsInChildren[j].enabled = enabled; } } } } [ContextMenu("Reset Chain")] public void ResetChain() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: 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_0083: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)BeltExitPoint == (Object)null) && _positions != null) { Vector3 forward = BeltExitPoint.forward; for (int i = 0; i < ChainNodeCount; i++) { ref Vector3 reference = ref _positions[i]; reference = BeltExitPoint.position + forward * (NodeDistance * (float)i); ref Vector3 reference2 = ref _prevPositions[i]; reference2 = _positions[i]; } } } private void OnDrawGizmos() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_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) //IL_00cf: 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_00d4: 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_00de: 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_00f4: 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_0103: 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_0123: 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) if (!((Object)(object)BeltExitPoint == (Object)null)) { Vector3 position = BeltExitPoint.position; Vector3 forward = BeltExitPoint.forward; bool flag = _chainInitialized && Application.isPlaying; int num = Mathf.Clamp(PinnedNodes, 1, ChainNodeCount); Gizmos.color = Color.green; Gizmos.DrawSphere(position, 0.01f); Gizmos.color = new Color(0f, 1f, 0f, 0.15f); Gizmos.DrawSphere(position, LoadDetectionRadius); Vector3 val = position; for (int i = 1; i < ChainNodeCount; i++) { Vector3 val2 = ((!flag) ? (position + forward * (NodeDistance * (float)i)) : _positions[i]); Gizmos.color = ((i >= num) ? Color.yellow : Color.green); Gizmos.DrawLine(val, val2); Gizmos.color = ((i >= num) ? Color.cyan : Color.green); Gizmos.DrawSphere(val2, 0.005f); val = val2; } Gizmos.color = Color.red; Gizmos.DrawSphere(val, 0.008f); } } } public class MagazineLoadToggle : MonoBehaviour { [Header("Target")] public GameObject TargetObject; [Header("Specific Trigger Well")] public FVRFireArmReloadTriggerWell ReloadTriggerWell; private bool _lastMagLoaded; private void Update() { if (!((Object)(object)ReloadTriggerWell == (Object)null) && !((Object)(object)TargetObject == (Object)null)) { bool flag = (Object)(object)ReloadTriggerWell.FireArm != (Object)null && (Object)(object)ReloadTriggerWell.FireArm.Magazine != (Object)null; if (flag != _lastMagLoaded) { TargetObject.SetActive(!flag); _lastMagLoaded = flag; } } } } public class PartRecoilImpulse : MonoBehaviour { public enum ImpulseMode { Rotation, Translation } public enum ImpulseAxis { X, Y, Z } [Serializable] public class RecoilPart { public Transform Piece; public ImpulseMode Mode = ImpulseMode.Rotation; public ImpulseAxis Axis = ImpulseAxis.X; public Vector2 Range = new Vector2(0f, 45f); public float ReturnSpeed = 5f; public float ImpulseStrength = 1f; [NonSerialized] public float CurrentLerp = 0f; } [Header("Parts")] public List<RecoilPart> Parts = new List<RecoilPart>(); private FVRFireArm m_firearm; private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired); } private void OnDestroy() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if ((Object)(object)GM.CurrentSceneSettings != (Object)null) { GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired); } } private void Start() { m_firearm = ((Component)this).GetComponentInParent<FVRFireArm>(); if ((Object)(object)m_firearm == (Object)null) { Debug.LogWarning((object)"[PartRecoilImpulse] No FVRFireArm found in parent hierarchy.", (Object)(object)this); } for (int i = 0; i < Parts.Count; i++) { ApplyToPart(Parts[i]); } } private void OnShotFired(FVRFireArm firearm) { if (!((Object)(object)firearm != (Object)(object)m_firearm)) { for (int i = 0; i < Parts.Count; i++) { Parts[i].CurrentLerp = Mathf.Clamp01(Parts[i].ImpulseStrength); ApplyToPart(Parts[i]); } } } private void Update() { for (int i = 0; i < Parts.Count; i++) { RecoilPart recoilPart = Parts[i]; if (recoilPart.CurrentLerp > 0f) { recoilPart.CurrentLerp = Mathf.MoveTowards(recoilPart.CurrentLerp, 0f, Time.deltaTime * recoilPart.ReturnSpeed); ApplyToPart(recoilPart); } } } private void ApplyToPart(RecoilPart part) { //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_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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)part.Piece == (Object)null) { return; } float num = Mathf.Lerp(part.Range.x, part.Range.y, part.CurrentLerp); if (part.Mode == ImpulseMode.Rotation) { Vector3 localEulerAngles = part.Piece.localEulerAngles; if (part.Axis == ImpulseAxis.X) { localEulerAngles.x = num; } else if (part.Axis == ImpulseAxis.Y) { localEulerAngles.y = num; } else { localEulerAngles.z = num; } part.Piece.localEulerAngles = localEulerAngles; } else { Vector3 localPosition = part.Piece.localPosition; if (part.Axis == ImpulseAxis.X) { localPosition.x = num; } else if (part.Axis == ImpulseAxis.Y) { localPosition.y = num; } else { localPosition.z = num; } part.Piece.localPosition = localPosition; } } } public class AttachableMeleeStock : FVRFireArmAttachmentInterface { public Transform Point_Stock; public override void OnAttach() { ((FVRFireArmAttachmentInterface)this).OnAttach(); FVRFireArmAttachmentMount val = ((!((Object)(object)base.Attachment != (Object)null)) ? null : base.Attachment.curMount); if ((Object)(object)val == (Object)null) { return; } FVRFireArmAttachmentMount rootMount = val.GetRootMount(); FVRPhysicalObject obj = ((!((Object)(object)rootMount != (Object)null)) ? val.Parent : rootMount.Parent); FVRFireArm val2 = (FVRFireArm)(object)((obj is FVRFireArm) ? obj : null); if (!((Object)(object)val2 == (Object)null)) { FVRFireArmAttachment attachment = base.Attachment; AttachableMeleeWeapon val3 = (AttachableMeleeWeapon)(object)((attachment is AttachableMeleeWeapon) ? attachment : null); if ((Object)(object)val3 != (Object)null) { val2.RegisterAttachedMeleeWeapon(val3); } if ((Object)(object)Point_Stock != (Object)null) { val2.StockPos = Point_Stock; val2.HasActiveShoulderStock = true; } } } public override void OnDetach() { FVRFireArmAttachmentMount val = ((!((Object)(object)base.Attachment != (Object)null)) ? null : base.Attachment.curMount); if ((Object)(object)val != (Object)null) { FVRFireArmAttachmentMount rootMount = val.GetRootMount(); FVRPhysicalObject obj = ((!((Object)(object)rootMount != (Object)null)) ? val.Parent : rootMount.Parent); FVRFireArm val2 = (FVRFireArm)(object)((obj is FVRFireArm) ? obj : null); if ((Object)(object)val2 != (Object)null) { if (base.Attachment is AttachableMeleeWeapon) { val2.RegisterAttachedMeleeWeapon((AttachableMeleeWeapon)null); } if ((Object)(object)Point_Stock != (Object)null) { val2.StockPos = null; val2.HasActiveShoulderStock = false; } } } ((FVRFireArmAttachmentInterface)this).OnDetach(); } } public class ExpandedAmmoDisplay : MonoBehaviour { [Header("Ammo Counter Settings")] [Tooltip("Text to display ammo left in the gun.")] public Text UItext; [Tooltip("Text to display maximum ammo.")] public Text MaxAmmoText; [Tooltip("Text to display the type of ammo.")] public Text ammoTypeText; [Tooltip("Adds a minimum character count. See tooltip for MinCharLength for more.")] public bool AddMinCharLength; [Tooltip("i.e if MinCharLength is 2 and the amount of rounds left is 5, it will display 05 instead of 5.")] public int MinCharLength; [Tooltip("Will not instantly be the correct amount of rounds, but will tick up/down until it is.")] public bool enableDispLerp; [Tooltip("MaxAmmo will also lerp according to the DispLerpAmt")] public bool enableLerpForMaxAmmo; [Tooltip("EnabledObjects will also lerp according to the DispLerpAmt")] public bool enableLerpForEnabledObjects; [Tooltip("From 0-1. The % amount moved towards its correct amount every 50th of a second.")] [Range(0f, 0.2f)] public float DispLerpAmt; [Header("Alternate Displays")] [Tooltip("Enables enabling/disabling objects based on rounds left in mag.")] public bool EnabledObjects; [Tooltip("Object enabled when there is no magazine.")] public GameObject ObjectWhenEmpty; [Tooltip("Element no. corresponds to rounds left. 0 means no rounds, 1 means one round. Enables the 5th object if there are 5 rounds, and so on.")] public List<GameObject> Objects; [Tooltip("Enables all objects under the round count. Enables the 0th, 1st, 2nd, 3rd objects if there are 3 rounds left, and so on.")] public bool EnableAllUnderAmount; [Tooltip("Overrides Objects. #0 means Objects' #0 displays from 0% to #0%, #1 means Objects' #1 displays from #0% to #1%, etc- written normally, not mathmatically (e.g 57.32)")] public bool EnableBasedOnPercentage; public List<float> ObjectPercentages; [Header("Fire Mode Display")] [Tooltip("Text to display the fire mode (e.g., Safe, Single, FullAuto, Burst).")] public Text fireModeText; [Tooltip("Image to display fire mode visually.")] public Image fireModeImage; [Tooltip("Sprites for each fire mode: 0=Safe, 1=Single, 2=FullAuto, 3=Burst, 4=Other.")] public Sprite[] fireModeSprites; [Header("Low Ammo Warning")] [Tooltip("Enable sound and blink effects when ammo drops to a percentage of max.")] public bool enableLowAmmoWarning; [Tooltip("Percentage of max ammo at which the warning triggers (e.g. 25 means 25%).")] [Range(0f, 100f)] public float lowAmmoThresholdPercent = 25f; [Tooltip("AudioSource used to play warning sounds.")] public AudioSource warningAudioSource; [Tooltip("Sound played once when ammo drops to or below the low ammo threshold.")] public AudioClip lowAmmoClip; [Tooltip("Sound played once when ammo is fully depleted (0 rounds).")] public AudioClip depletedAmmoClip; [Tooltip("Enable blinking on the ammo text when at or below the low ammo threshold.")] public bool enableLowAmmoBlink; [Tooltip("How many times per second the text blinks on/off.")] public float blinkRate = 4f; [Header("Chamber Indicator (optional)")] [Tooltip("Enable a visual/text indicator when there is a round in the chamber.")] public bool showChamberIndicator = false; [Tooltip("If true the indicator will use an Image; otherwise it will use Text.")] public bool chamberIndicatorUseImage = true; [Tooltip("Image used to indicate a round is chambered. Assign only if using image mode.")] public Image chamberIndicatorImage; [Tooltip("Text used to indicate a round is chambered. Assign only if using text mode.")] public Text chamberIndicatorText; [Tooltip("Text shown when a round is chambered (used when chamberIndicatorUseImage == false).")] public string chamberIndicatorString = "CH"; private FVRFireArm _fa; private FVRFireArmMagazine _mag; private FVRFirearmMovingProxyRound[] proxies; private FVRFireArmChamber[] chambers; private int lastAmountOfBullets; private int lastAmountOfMaxBullets; private int lastAmountOfBulletsForEnableObjects; private bool _hasPlayedLowAmmoSound; private bool _hasPlayedDepletedSound; private bool _isBlinking; private float _blinkTimer; private int _previousAmmoCount = -1; private bool _hadMagLastFrame; private bool _isChamberIndicatorImageNotNull; private bool _isChamberIndicatorTextNotNull; private bool _isUItextNotNull; private bool _isMaxAmmoTextNotNull; private bool _isammoTypeTextNotNull; private bool _isfireModeTextNotNull; private bool _isfireModeImageNotNull; private void Start() { NullCheck(); } private void GetFirearmAndMag() { _fa = ((Component)this).GetComponent<FVRFireArm>() ?? ((Component)this).GetComponentInParent<FVRFireArm>(); if ((Object)(object)_fa != (Object)null) { _mag = _fa.Magazine; if (chambers == null) { chambers = GetFireArmDeets.GetFireArmChamber(_fa); } proxies = GetFireArmDeets.GetFireArmProxySwitch(_fa, false); } else { _mag = null; chambers = null; proxies = null; } } private void Update() { GetFirearmAndMag(); int ammoCount = GetAmmoCount(); int maxAmmoCount = GetMaxAmmoCount(); bool flag = (Object)(object)_mag != (Object)null; if (_isUItextNotNull) { string text = CalculateAmmoCounterAmount(ammoCount, ref lastAmountOfBullets, enableDispLerp, DispLerpAmt, AddMinCharLength, MinCharLength); UItext.text = text; } if (_isMaxAmmoTextNotNull) { string text2 = CalculateAmmoCounterAmount(maxAmmoCount, ref lastAmountOfMaxBullets, enableLerpForMaxAmmo, DispLerpAmt, AddMinCharLength, MinCharLength); MaxAmmoText.text = text2; } if (_isammoTypeTextNotNull) { ammoTypeText.text = GetAmmoType(); } if (_isfireModeTextNotNull || _isfireModeImageNotNull) { string fireMode = GetFireMode(); if (_isfireModeTextNotNull) { fireModeText.text = fireMode; } if (_isfireModeImageNotNull && fireModeSprites != null && fireModeSprites.Length > 0) { int spriteIndexForMode = GetSpriteIndexForMode(fireMode); if (spriteIndexForMode >= 0 && spriteIndexForMode < fireModeSprites.Length) { fireModeImage.sprite = fireModeSprites[spriteIndexForMode]; } } } if (EnabledObjects) { int num = int.Parse(CalculateAmmoCounterAmount(ammoCount, ref lastAmountOfBulletsForEnableObjects, enableLerpForEnabledObjects, DispLerpAmt)); if (EnableBasedOnPercentage) { SetEnabledObjectsPercentage(num); } else { SetEnabledObjects(num); } } if (enableLowAmmoWarning) { UpdateLowAmmoWarning(ammoCount, maxAmmoCount, flag); } else { ResetWarningState(); } if (showChamberIndicator) { int num2 = 0; if (chambers != null) { num2 = chambers.Count((FVRFireArmChamber chamber) => chamber.IsFull && !chamber.IsSpent); } bool flag2 = num2 > 0; if (chamberIndicatorUseImage) { if (_isChamberIndicatorImageNotNull && (Object)(object)chamberIndicatorImage != (Object)null) { ((Component)chamberIndicatorImage).gameObject.SetActive(flag2); } } else if (_isChamberIndicatorTextNotNull && (Object)(object)chamberIndicatorText != (Object)null) { ((Component)chamberIndicatorText).gameObject.SetActive(flag2); if (flag2) { chamberIndicatorText.text = chamberIndicatorString; } } } else { if (_isChamberIndicatorImageNotNull && (Object)(object)chamberIndicatorImage != (Object)null) { ((Component)chamberIndicatorImage).gameObject.SetActive(false); } if (_isChamberIndicatorTextNotNull && (Object)(object)chamberIndicatorText != (Object)null) { ((Component)chamberIndicatorText).gameObject.SetActive(false); } } _previousAmmoCount = ammoCount; _hadMagLastFrame = flag; } private void UpdateLowAmmoWarning(int currentAmmo, int maxAmmo, bool hasMag) { if (!hasMag) { ResetWarningState(); return; } bool flag = hasMag && !_hadMagLastFrame; bool flag2 = false; bool flag3 = false; if (maxAmmo > 0) { if (currentAmmo > 0) { float num = (float)currentAmmo / (float)maxAmmo * 100f; flag2 = num <= lowAmmoThresholdPercent; } if (_previousAmmoCount > 0) { float num2 = (float)_previousAmmoCount / (float)maxAmmo * 100f; flag3 = num2 <= lowAmmoThresholdPercent; } } if (flag2 && (!flag3 || flag)) { PlayWarningClip(lowAmmoClip); } if (currentAmmo <= 0) { bool flag4 = _previousAmmoCount > 0; bool flag5 = flag; if ((flag4 || flag5) && !_hasPlayedDepletedSound) { PlayWarningClip(depletedAmmoClip); _hasPlayedDepletedSound = true; } } if (maxAmmo > 0 && currentAmmo > 0) { float num3 = (float)currentAmmo / (float)maxAmmo * 100f; if (num3 > lowAmmoThresholdPercent) { _hasPlayedDepletedSound = false; } } if (enableLowAmmoBlink && _isUItextNotNull && (flag2 || _hasPlayedDepletedSound)) { _isBlinking = true; _blinkTimer += Time.deltaTime; float num4 = ((!(blinkRate > 0f)) ? 1f : (1f / blinkRate)); bool enabled = _blinkTimer % num4 < num4 * 0.5f; ((Behaviour)UItext).enabled = enabled; } else if (_isBlinking) { _isBlinking = false; _blinkTimer = 0f; if (_isUItextNotNull) { ((Behaviour)UItext).enabled = true; } } } private void ResetWarningState() { if (_isBlinking) { _isBlinking = false; _blinkTimer = 0f; if (_isUItextNotNull) { ((Behaviour)UItext).enabled = true; } } _hasPlayedLowAmmoSound = false; _hasPlayedDepletedSound = false; } private void PlayWarningClip(AudioClip clip) { if ((Object)(object)clip != (Object)null && (Object)(object)warningAudioSource != (Object)null) { warningAudioSource.PlayOneShot(clip); } } private int GetAmmoCount() { if ((Object)(object)_mag != (Object)null) { return _mag.m_numRounds; } int num = 0; if ((Object)(object)_fa != (Object)null) { if (chambers != null) { num += chambers.Count((FVRFireArmChamber chamber) => chamber.IsFull && !chamber.IsSpent); } if (proxies != null) { FVRFirearmMovingProxyRound[] array = proxies; foreach (FVRFirearmMovingProxyRound val in array) { if (val.IsFull) { num++; } } } if ((Object)(object)_fa.BeltDD != (Object)null) { num += _fa.BeltDD.m_roundsOnBelt; } } return num; } private int GetMaxAmmoCount() { if ((Object)(object)_mag != (Object)null) { return _mag.m_capacity; } if ((Object)(object)_fa != (Object)null && !_fa.UsesMagazines) { return (chambers != null) ? chambers.Length : 0; } return 0; } private string GetAmmoType() { //IL_00d5: 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_0037: 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_0080: 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) if ((Object)(object)_fa != (Object)null) { List<FireArmRoundClass> chamberRoundList = _fa.GetChamberRoundList(); if (chamberRoundList != null && chamberRoundList.Count > 0) { return AM.GetFullRoundName(_fa.RoundType, chamberRoundList[0]); } if ((Object)(object)_fa.BeltDD != (Object)null && _fa.BeltDD.m_roundsOnBelt > 0) { return AM.GetFullRoundName(_fa.RoundType, _fa.BeltDD.BeltRounds[0].LR_Class); } } if ((Object)(object)_mag != (Object)null && _mag.m_numRounds > 0) { return AM.GetFullRoundName(_mag.RoundType, _mag.LoadedRounds[0].LR_Class); } return string.Empty; } private string GetFireMode() { if ((Object)(object)_fa == (Object)null) { return "N/A"; } FVRFireArm fa = _fa; Handgun val = (Handgun)(object)((fa is Handgun) ? fa : null); if ((Object)(object)val == (Object)null) { return "N/A"; } if (val.IsSafetyEngaged) { return "Safe"; } if (val.FireSelectorModes != null && val.FireSelectorModes.Length > 0) { FireSelectorMode val2 = val.FireSelectorModes[val.FireSelectorModeIndex]; return ((object)Unsafe.As<FireSelectorModeType, FireSelectorModeType>(ref val2.ModeType)/*cast due to .constrained prefix*/).ToString(); } return "N/A"; } private int GetSpriteIndexForMode(string mode) { return mode switch { "Safe" => 0, "Single" => 1, "FullAuto" => 2, "Burst" => 3, _ => 4, }; } public static string CalculateAmmoCounterAmount(int currentammo, ref int lastammo, bool lerp = false, float lerpAmt = 0f, bool pad = false, int padAmt = 0) { if (lerp) { currentammo = LerpInt(lastammo, currentammo, lerpAmt); } string text = currentammo.ToString(); if (pad) { text = PadStringNumberToAmt(text, padAmt); } lastammo = currentammo; return text; } public stati