using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using OtherLoader; using UnityEngine; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace BitWizrd.Hunt1865CarbineSilencer { [BepInPlugin("BitWizrd.Hunt1865CarbineSilencer", "Hunt1865CarbineSilencer", "1.0.2")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class Hunt1865CarbineSilencerPlugin : 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(), "BitWizrd.Hunt1865CarbineSilencer"); OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.Hunt1865CarbineSilencer", "", "1865carbinesilencer", "", ""); } } } public class BloodBondSR : MonoBehaviour { private void Awake() { string name = "Ammo_69_CashMoney_D100(Clone)"; ((Object)((Component)this).gameObject).name = name; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).name = name; } } } namespace BitWizrd.Carbine1865 { public enum ZPos { Forward, Middle, Rear } [Serializable] public class LeverActuatedPiece { public Transform Piece; public Vector3 PosBack; public Vector3 PosForward; public InterpStyle InterpStyle; public ActuationType ActuationType; } public enum ActuationType { Lever, Hammer } public class Carbine65 : FVRFireArm { [Header("LeverAction Config")] public FVRFireArmChamber Chamber; public Transform Lever; public Transform LeverRoot; public Transform Hammer; public Transform LoadingGate; public Transform Trigger; public Vector2 TriggerRotRange; public FVRAlternateGrip ForeGrip; public Vector2 LeverAngleRange = new Vector2(-68f, 0f); public Vector2 HammerAngleRange = new Vector2(-36f, 0f); public Vector2 LoadingGateAngleRange = new Vector2(-24f, 0f); public Vector3 EjectionDir = new Vector3(0f, 2f, 0f); public Vector3 EjectionSpin = new Vector3(80f, 0f, 0f); private bool m_isLeverReleasePressed; private float m_curLeverRot; private float m_tarLeverRot; private float m_leverRotSpeed = 700f; private bool m_isActionMovingForward; private ZPos m_curLeverPos = ZPos.Rear; private ZPos m_lastLeverPos = ZPos.Rear; private FVRFirearmMovingProxyRound m_proxy; [Header("Round Positions Config")] public Transform ReceiverLowerPathForward; public Transform ReceiverLowerPathRearward; public Transform ReceiverUpperPathForward; public Transform ReceiverUpperPathRearward; public Transform ReceiverEjectionPathForward; public Transform ReceiverEjectionPathRearward; public Transform ReceiverEjectionPoint; public bool GrabsRoundFromMagOnBoltForward; private bool m_isHammerCocked; [Header("Spinning Config")] public Transform PoseSpinHolder; public bool CanSpin; private bool m_isSpinning; [Header("65Carbine Specific")] public LeverActuatedPiece[] ActuatedPieces; public bool RequiresHammerCockedForLever = true; private bool useLinearRacking = true; private float baseDistance = 1f; private float BaseAngleOffset; private bool m_wasLeverLocked; private Vector3 m_baseSpinPosition = Vector3.zero; private float curDistanceBetweenGrips = 1f; private float lastDistanceBetweenGrips = -1f; private float m_rackingDisplacement; private float xSpinRot; private float xSpinVel; private bool m_isPlayerActuatingLever = false; private bool m_wasHammerCockedLastFrame = false; private Vector3 m_initialHandLocalPos; [Header("Hammer Swipe Cocking")] public bool CanSwipeCockHammer = false; [Header("Magazine Rod System")] public bool HasMagazineRod = false; public Carbine65MagazineRodPseudo MagazineRod; private bool m_magazineRodInserted = false; [Header("Magazine Dumping")] private bool m_hasCheckedMagazineDump = false; public bool IsDummyMagazineActive => false; public FVRFireArmMagazine StoredRealMagazine => base.Magazine; public bool IsHammerCocked => m_isHammerCocked; public override void Awake() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).Awake(); base.FChambers.Add(Chamber); GameObject val = new GameObject("m_proxyRound"); m_proxy = val.AddComponent(); m_proxy.Init(((Component)this).transform); m_baseSpinPosition = PoseSpinHolder.localPosition; if (HasMagazineRod && (Object)(object)MagazineRod != (Object)null) { m_magazineRodInserted = !MagazineRod.IsDetached; } } public override Transform GetMuzzle() { return ((FVRFireArm)this).GetMuzzle(); } public override void BeginInteraction(FVRViveHand hand) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).BeginInteraction(hand); m_initialHandLocalPos = LeverRoot.InverseTransformPoint(hand.PalmTransform.position); SetBaseHandAngle(hand); } private void SetBaseHandAngle(FVRViveHand hand) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(((FVRInteractiveObject)this).m_hand.PoseOverride.forward, LeverRoot.right); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 forward = LeverRoot.forward; float baseAngleOffset = Mathf.Atan2(Vector3.Dot(LeverRoot.right, Vector3.Cross(forward, normalized)), Vector3.Dot(forward, normalized)) * 57.29578f; BaseAngleOffset = baseAngleOffset; } public override void FVRFixedUpdate() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).FVRFixedUpdate(); m_curLeverRot = Mathf.MoveTowards(m_curLeverRot, m_tarLeverRot, m_leverRotSpeed * Time.deltaTime); Lever.localEulerAngles = new Vector3(m_curLeverRot, 0f, 0f); UpdateSpinning(); } private void UpdateLever() { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_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_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039d: 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_0be3: Unknown result type (might be due to invalid IL or missing references) //IL_0b18: Unknown result type (might be due to invalid IL or missing references) //IL_0b23: Unknown result type (might be due to invalid IL or missing references) //IL_0b2a: Unknown result type (might be due to invalid IL or missing references) //IL_0b45: Unknown result type (might be due to invalid IL or missing references) //IL_0b50: Unknown result type (might be due to invalid IL or missing references) //IL_0b57: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Unknown result type (might be due to invalid IL or missing references) //IL_0a8a: Unknown result type (might be due to invalid IL or missing references) //IL_0a91: Unknown result type (might be due to invalid IL or missing references) //IL_0aac: Unknown result type (might be due to invalid IL or missing references) //IL_0ab7: Unknown result type (might be due to invalid IL or missing references) //IL_0abe: Unknown result type (might be due to invalid IL or missing references) //IL_07b8: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07ee: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_07fe: Unknown result type (might be due to invalid IL or missing references) //IL_080e: Unknown result type (might be due to invalid IL or missing references) //IL_0813: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_082e: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_084e: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0879: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Unknown result type (might be due to invalid IL or missing references) //IL_0c10: Unknown result type (might be due to invalid IL or missing references) //IL_0c1b: Unknown result type (might be due to invalid IL or missing references) //IL_0c22: Unknown result type (might be due to invalid IL or missing references) //IL_0c3d: Unknown result type (might be due to invalid IL or missing references) //IL_0c48: Unknown result type (might be due to invalid IL or missing references) //IL_0c4f: Unknown result type (might be due to invalid IL or missing references) //IL_0b8e: Unknown result type (might be due to invalid IL or missing references) //IL_0af5: Unknown result type (might be due to invalid IL or missing references) //IL_0cb8: Unknown result type (might be due to invalid IL or missing references) //IL_0d08: Unknown result type (might be due to invalid IL or missing references) //IL_0d0e: Invalid comparison between Unknown and I4 //IL_0cda: Unknown result type (might be due to invalid IL or missing references) //IL_0ce8: Unknown result type (might be due to invalid IL or missing references) //IL_0cef: Unknown result type (might be due to invalid IL or missing references) //IL_0d2b: Unknown result type (might be due to invalid IL or missing references) //IL_0d39: Unknown result type (might be due to invalid IL or missing references) //IL_0d40: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool flag2 = false; if (((FVRInteractiveObject)this).IsHeld) { if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode) { flag = ((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed; flag2 = ((FVRInteractiveObject)this).m_hand.Input.BYButtonUp; } else { flag = ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed; flag2 = ((FVRInteractiveObject)this).m_hand.Input.TouchpadUp; } } m_isLeverReleasePressed = false; bool flag3 = false; if (!((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRInteractiveObject)ForeGrip).m_hand != (Object)null) { if (((FVRInteractiveObject)ForeGrip).m_hand.Input.TriggerPressed && ((FVRInteractiveObject)ForeGrip).m_hasTriggeredUpSinceBegin && (int)GM.Options.ControlOptions.LongGunSnipingAssist != 1) { flag3 = true; } m_isLeverReleasePressed = true; curDistanceBetweenGrips = Vector3.Distance(((FVRInteractiveObject)this).m_hand.PalmTransform.position, ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position); if (lastDistanceBetweenGrips < 0f) { lastDistanceBetweenGrips = curDistanceBetweenGrips; } } else { lastDistanceBetweenGrips = -1f; } m_isSpinning = false; if (!((FVRPhysicalObject)this).IsAltHeld && CanSpin && flag) { m_isSpinning = true; } if (m_curLeverPos == ZPos.Rear) { m_hasCheckedMagazineDump = false; } bool flag4 = false; if (RequiresHammerCockedForLever && !m_isHammerCocked) { flag4 = true; } bool flag5 = Chamber.IsFull && !Chamber.IsSpent; bool flag6 = m_curLeverPos == ZPos.Rear; if (flag5 && flag6) { flag4 = true; } if ((Object)(object)((FVRPhysicalObject)this).AltGrip == (Object)null && !((FVRPhysicalObject)this).IsAltHeld) { flag4 = true; } if (flag3) { flag4 = false; } if (flag) { flag4 = false; } if (flag4 && useLinearRacking) { SetBaseHandAngle(((FVRInteractiveObject)this).m_hand); } m_wasLeverLocked = flag4; if (flag2) { m_tarLeverRot = 0f; PoseSpinHolder.localPosition = m_baseSpinPosition; lastDistanceBetweenGrips = curDistanceBetweenGrips; m_rackingDisplacement = 0f; } else if (m_isLeverReleasePressed && !flag4) { if (useLinearRacking) { curDistanceBetweenGrips = Vector3.Distance(((FVRInteractiveObject)this).m_hand.PalmTransform.position, ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position); float num = 0f; if (curDistanceBetweenGrips < lastDistanceBetweenGrips) { num = lastDistanceBetweenGrips - curDistanceBetweenGrips; m_rackingDisplacement += num; } else { num = curDistanceBetweenGrips - lastDistanceBetweenGrips; m_rackingDisplacement -= num; } m_rackingDisplacement = Mathf.Clamp(m_rackingDisplacement, 0f, 0.04f); if (m_rackingDisplacement < 0.005f) { m_rackingDisplacement = 0f; } if (m_rackingDisplacement > 0.035f) { m_rackingDisplacement = 0.04f; } PoseSpinHolder.localPosition = m_baseSpinPosition + Vector3.forward * m_rackingDisplacement * 2f; m_tarLeverRot = Mathf.Lerp(LeverAngleRange.y, LeverAngleRange.x, m_rackingDisplacement * 25f); lastDistanceBetweenGrips = curDistanceBetweenGrips; } else { Vector3 val = Vector3.ProjectOnPlane(((FVRInteractiveObject)this).m_hand.PoseOverride.forward, LeverRoot.right); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 forward = LeverRoot.forward; float num2 = Mathf.Atan2(Vector3.Dot(LeverRoot.right, Vector3.Cross(forward, normalized)), Vector3.Dot(forward, normalized)) * 57.29578f; num2 -= BaseAngleOffset; num2 *= 3f; num2 = Mathf.Clamp(num2, LeverAngleRange.x, LeverAngleRange.y); m_tarLeverRot = num2; } } else if (m_isSpinning) { float num3 = Mathf.Clamp(((Vector3)(ref ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld)).magnitude - 1f, 0f, 3f); float num4 = num3 * 120f; float num5 = Mathf.Repeat(Mathf.Abs(xSpinRot), 360f); num4 = Mathf.Clamp(num4, 0f, num5 * 0.5f); m_tarLeverRot = Mathf.Clamp(0f - num4, LeverAngleRange.x, LeverAngleRange.y); PoseSpinHolder.localPosition = m_baseSpinPosition; } if (Mathf.Abs(m_curLeverRot - LeverAngleRange.y) < 1f) { if (m_lastLeverPos == ZPos.Forward) { m_curLeverPos = ZPos.Middle; } else { m_curLeverPos = ZPos.Rear; base.IsBreachOpenForGasOut = false; } } else if (Mathf.Abs(m_curLeverRot - LeverAngleRange.x) < 1f) { if (m_lastLeverPos == ZPos.Rear) { m_curLeverPos = ZPos.Middle; } else { m_curLeverPos = ZPos.Forward; base.IsBreachOpenForGasOut = true; } } else { m_curLeverPos = ZPos.Middle; base.IsBreachOpenForGasOut = true; } if (m_curLeverPos == ZPos.Rear && m_lastLeverPos != ZPos.Rear) { m_tarLeverRot = LeverAngleRange.y; m_curLeverRot = LeverAngleRange.y; if (m_isActionMovingForward && m_proxy.IsFull && !Chamber.IsFull) { ((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_OnHoverInteractive); Chamber.SetRound(m_proxy.Round, false); m_proxy.ClearProxy(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f); } else { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)41, 1f); } m_isActionMovingForward = false; } else if (m_curLeverPos == ZPos.Forward && m_lastLeverPos != ZPos.Forward) { m_tarLeverRot = LeverAngleRange.x; m_curLeverRot = LeverAngleRange.x; if (HasMagazineRod && MagazineRod.IsDetached && !m_hasCheckedMagazineDump && (Object)(object)base.Magazine != (Object)null && base.Magazine.HasARound()) { ((MonoBehaviour)this).StartCoroutine(DumpMagazineSequentially()); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f); m_hasCheckedMagazineDump = true; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); if (!m_isActionMovingForward && Chamber.IsFull) { ((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_OnHoverInteractive); Chamber.EjectRound(ReceiverEjectionPoint.position, ((Component)this).transform.right * EjectionDir.x + ((Component)this).transform.up * EjectionDir.y + ((Component)this).transform.forward * EjectionDir.z, ((Component)this).transform.right * EjectionSpin.x + ((Component)this).transform.up * EjectionSpin.y + ((Component)this).transform.forward * EjectionSpin.z, ReceiverEjectionPoint.position, ReceiverEjectionPoint.rotation, false); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f); } else { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)40, 1f); } m_isActionMovingForward = true; } else if (!GrabsRoundFromMagOnBoltForward && m_curLeverPos == ZPos.Middle && m_lastLeverPos == ZPos.Rear) { if (CanMagazineFeed() && !Chamber.IsFull && (Object)(object)base.Magazine != (Object)null && !m_proxy.IsFull && base.Magazine.HasARound()) { GameObject fromPrefabReference = base.Magazine.RemoveRound(false); m_proxy.SetFromPrefabReference(fromPrefabReference); if (m_proxy.IsFull) { ((Component)m_proxy.ProxyRound).gameObject.SetActive(true); } } } else if (GrabsRoundFromMagOnBoltForward && m_curLeverPos != ZPos.Forward && m_lastLeverPos == ZPos.Forward && CanMagazineFeed() && !Chamber.IsFull && (Object)(object)base.Magazine != (Object)null && !m_proxy.IsFull && base.Magazine.HasARound()) { GameObject fromPrefabReference2 = base.Magazine.RemoveRound(false); m_proxy.SetFromPrefabReference(fromPrefabReference2); if (m_proxy.IsFull) { ((Component)m_proxy.ProxyRound).gameObject.SetActive(true); } } float num6 = Mathf.InverseLerp(LeverAngleRange.y, LeverAngleRange.x, m_curLeverRot); if (m_proxy.IsFull) { if (m_isActionMovingForward) { m_proxy.ProxyRound.position = Vector3.Lerp(ReceiverUpperPathForward.position, ReceiverUpperPathRearward.position, num6); m_proxy.ProxyRound.rotation = Quaternion.Slerp(ReceiverUpperPathForward.rotation, ReceiverUpperPathRearward.rotation, num6); if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.x, 0f, 0f); } } else { m_proxy.ProxyRound.position = Vector3.Lerp(ReceiverLowerPathForward.position, ReceiverLowerPathRearward.position, num6); m_proxy.ProxyRound.rotation = Quaternion.Slerp(ReceiverLowerPathForward.rotation, ReceiverLowerPathRearward.rotation, num6); if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.y, 0f, 0f); } } ((Component)m_proxy.ProxyRound).gameObject.SetActive(true); } else if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.y, 0f, 0f); } if (Chamber.IsFull) { Chamber.ProxyRound.position = Vector3.Lerp(ReceiverEjectionPathForward.position, ReceiverEjectionPathRearward.position, num6); Chamber.ProxyRound.rotation = Quaternion.Slerp(ReceiverEjectionPathForward.rotation, ReceiverEjectionPathRearward.rotation, num6); } Chamber.IsAccessible = m_curLeverPos != ZPos.Rear && !m_proxy.IsFull && ((Object)(object)base.Magazine == (Object)null || !base.Magazine.HasARound()); for (int i = 0; i < ActuatedPieces.Length; i++) { if ((int)ActuatedPieces[i].InterpStyle == 0) { ActuatedPieces[i].Piece.localPosition = Vector3.Lerp(ActuatedPieces[i].PosBack, ActuatedPieces[i].PosForward, num6); } else if ((int)ActuatedPieces[i].InterpStyle == 1) { ActuatedPieces[i].Piece.localEulerAngles = Vector3.Lerp(ActuatedPieces[i].PosBack, ActuatedPieces[i].PosForward, num6); } } m_lastLeverPos = m_curLeverPos; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); UpdateLever(); Trigger.localEulerAngles = new Vector3(Mathf.Lerp(TriggerRotRange.x, TriggerRotRange.y, hand.Input.TriggerFloat), 0f, 0f); bool flag = false; if (((FVRInteractiveObject)this).IsHeld) { if (hand.IsInStreamlinedMode) { flag = hand.Input.AXButtonDown; } else { Vector2 touchpadAxes = hand.Input.TouchpadAxes; flag = hand.Input.TouchpadDown && touchpadAxes.y < -0.1f; } } if (hand.Input.TriggerDown && !((FVRPhysicalObject)this).IsAltHeld && m_curLeverPos == ZPos.Rear && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && m_isHammerCocked) { Fire(); } if (flag && !m_isHammerCocked && ((FVRInteractiveObject)this).IsHeld) { m_isHammerCocked = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerAngleRange.x, 0f, 0f); } } if (CanSwipeCockHammer && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null && (Object)(object)Hammer != (Object)null) { Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; float num = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, Hammer.position); if (num < 0.15f && Vector3.Angle(velLinearWorld, -((Component)this).transform.forward) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f && !m_isHammerCocked) { m_isHammerCocked = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerAngleRange.x, 0f, 0f); } } } if (((FVRInteractiveObject)this).IsHeld && (Object)(object)Hammer != (Object)null) { float num2 = ((!m_isHammerCocked) ? HammerAngleRange.y : HammerAngleRange.x); Hammer.localEulerAngles = new Vector3(Mathf.Lerp(Hammer.localEulerAngles.x, num2, Time.deltaTime * 10f), 0f, 0f); } m_wasHammerCockedLastFrame = m_isHammerCocked; } public override void EndInteraction(FVRViveHand hand) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Trigger.localEulerAngles = new Vector3(0f, 0f, 0f); ((FVRFireArm)this).EndInteraction(hand); } private void Fire() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (!m_isHammerCocked) { return; } m_isHammerCocked = false; if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerAngleRange.y, 0f, 0f); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); bool flag = false; bool flag2 = false; if (Chamber.Fire()) { flag = true; flag2 = true; } if (flag) { Transform val = ((!flag2) ? base.MuzzlePos : ((FVRFireArm)this).GetMuzzle()); if (flag2) { ((FVRFireArm)this).Fire(Chamber, val, true, 1f, -1f); } ((FVRFireArm)this).FireMuzzleSmoke(); bool flag3 = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag4 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag5 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag3, flag4, flag5, (FVRFireArmRecoilProfile)null, 1f); if (flag2) { ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); } } } private void UpdateSpinning() { //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0074: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld || ((FVRPhysicalObject)this).IsAltHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null) { m_isSpinning = false; } if (m_isSpinning) { Vector3 val = Vector3.zero; if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld; } float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)this).transform.up); num = Mathf.Clamp(num, 0f - ((Vector3)(ref val)).magnitude, ((Vector3)(ref val)).magnitude); if (Mathf.Abs(xSpinVel) < 90f) { xSpinVel += num * Time.deltaTime * 600f; } else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel)) { xSpinVel += num * Time.deltaTime * 600f; } if (Mathf.Abs(xSpinVel) < 90f) { if (Vector3.Dot(((Component)this).transform.up, Vector3.down) >= 0f && Mathf.Sign(xSpinVel) == 1f) { xSpinVel += Time.deltaTime * 50f; } if (Vector3.Dot(((Component)this).transform.up, Vector3.down) < 0f && Mathf.Sign(xSpinVel) == -1f) { xSpinVel -= Time.deltaTime * 50f; } } xSpinVel = Mathf.Clamp(xSpinVel, -200f, 200f); xSpinRot += xSpinVel * Time.deltaTime * 5f; PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f); xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f); } else { xSpinRot = 0f; xSpinVel = 0f; PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f); } } public override List GetChamberRoundList() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (Chamber.IsFull && !Chamber.IsSpent) { List list = new List(); list.Add(Chamber.GetRound().RoundClass); return list; } return null; } public override void SetLoadedChambers(List rounds) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } } private bool CanMagazineFeed() { if (HasMagazineRod) { return m_magazineRodInserted && (Object)(object)MagazineRod != (Object)null && MagazineRod.IsLockedInPlace; } return true; } public void OnMagazineRodStateChanged(bool isDetached) { if (HasMagazineRod) { m_magazineRodInserted = !isDetached; } } private IEnumerator DumpMagazineSequentially() { yield return (object)new WaitForSeconds(0.1f); while ((Object)(object)base.Magazine != (Object)null && base.Magazine.HasARound()) { GameObject roundPrefab = base.Magazine.RemoveRound(false); Vector3 ejectionPos = ((!((Object)(object)base.Magazine.RoundEjectionPos != (Object)null)) ? ReceiverEjectionPoint.position : base.Magazine.RoundEjectionPos.position); Quaternion ejectionRot = ((!((Object)(object)base.Magazine.RoundEjectionPos != (Object)null)) ? ReceiverEjectionPoint.rotation : base.Magazine.RoundEjectionPos.rotation); GameObject ejectedRound = Object.Instantiate(roundPrefab, ejectionPos, ejectionRot); Rigidbody roundRB = ejectedRound.GetComponent(); if ((Object)(object)roundRB != (Object)null) { roundRB.velocity = Vector3.zero; roundRB.angularVelocity = Vector3.zero; } FVRFireArmRound roundComponent = ejectedRound.GetComponent(); if ((Object)(object)roundComponent != (Object)null) { ((FVRPhysicalObject)roundComponent).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); } yield return (object)new WaitForSeconds(0.05f); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f); } } public class Carbine65MagazineRod : FVRPhysicalObject { public override void Awake() { ((FVRPhysicalObject)this).Awake(); ((Component)this).gameObject.tag = "flintlock_ramrod"; } } public class Carbine65MagazineRodHolder : MonoBehaviour { public Carbine65 Carbine; public void OnTriggerEnter(Collider other) { if ((Object)(object)other.attachedRigidbody == (Object)null) { return; } GameObject gameObject = ((Component)other.attachedRigidbody).gameObject; if (gameObject.CompareTag("flintlock_ramrod")) { Carbine65MagazineRod component = gameObject.GetComponent(); if (((FVRInteractiveObject)component).IsHeld) { FVRViveHand hand = ((FVRInteractiveObject)component).m_hand; ((FVRInteractiveObject)component).ForceBreakInteraction(); ((Component)Carbine.MagazineRod).gameObject.SetActive(true); Carbine.MagazineRod.MountToInserted(hand); hand.ForceSetInteractable((FVRInteractiveObject)(object)Carbine.MagazineRod); ((FVRInteractiveObject)Carbine.MagazineRod).BeginInteraction(hand); Object.Destroy((Object)(object)((Component)other).gameObject); } } } } public class Carbine65MagazineRodPseudo : FVRInteractiveObject { public Transform Root; public Transform Point_Inserted; public Transform Point_Extracted; private float lastHandZ; private float m_rodZ; private float m_minZ_inserted; private float m_maxZ_inserted; public GameObject RodPrefab; private float m_curHandRodOffsetZ; public Carbine65 ParentCarbine; private Quaternion m_originalRotation; private bool m_isRotationLocked = true; private float m_lastRodZ; private int m_lastClickIndex = -1; [Header("Audio")] public AudioEvent AudEvent_Grab; public AudioEvent AudEvent_ExtractFromCarbine; public AudioEvent AudEvent_InsertToCarbine; public AudioEvent AudEvent_RodUnlock; public AudioEvent AudEvent_RodLock; public AudioEvent AudEvent_BulletClick; public bool IsDetached => !((Component)this).gameObject.activeInHierarchy; public bool IsLockedInPlace => m_isRotationLocked && m_rodZ >= m_maxZ_inserted; public override void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0059: 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) ((FVRInteractiveObject)this).Awake(); m_rodZ = ((Component)this).transform.localPosition.z; m_maxZ_inserted = Point_Inserted.localPosition.z; m_minZ_inserted = Point_Extracted.localPosition.z; m_originalRotation = ((Component)this).transform.localRotation; m_isRotationLocked = true; m_lastRodZ = m_rodZ; } public override void BeginInteraction(FVRViveHand hand) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00b5: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).BeginInteraction(hand); Vector3 zero = Vector3.zero; zero = Root.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos); SM.PlayGenericSound(AudEvent_Grab, ((Component)this).transform.position); lastHandZ = zero.z; m_curHandRodOffsetZ = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z; if (m_isRotationLocked) { ((Component)this).transform.localRotation = m_originalRotation * Quaternion.Euler(0f, 0f, -90f); m_isRotationLocked = false; SM.PlayGenericSound(AudEvent_RodUnlock, ((Component)this).transform.position); if ((Object)(object)ParentCarbine != (Object)null) { ParentCarbine.OnMagazineRodStateChanged(isDetached: true); } } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); Vector3 zero = Vector3.zero; float num = 0f; float z = Root.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z; float num2 = z - lastHandZ; num2 = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z - m_curHandRodOffsetZ; MoveRod(num2, hand); lastHandZ = z; } public void MountToInserted(FVRViveHand h) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.SetParent(Root); m_rodZ = m_minZ_inserted + 0.0002f; SM.PlayGenericSound(AudEvent_InsertToCarbine, ((Component)this).transform.position); ((Component)this).transform.localPosition = new Vector3(Point_Inserted.localPosition.x, Point_Inserted.localPosition.y, m_rodZ); m_isRotationLocked = false; m_lastClickIndex = -1; m_lastRodZ = m_rodZ; if ((Object)(object)h != (Object)null) { m_curHandRodOffsetZ = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref h.Input)).Pos).z; } if ((Object)(object)ParentCarbine != (Object)null) { ParentCarbine.OnMagazineRodStateChanged(isDetached: true); } } private void MoveRod(float delta, FVRViveHand hand) { //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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) float rodZ = m_rodZ; m_rodZ += delta; m_rodZ = Mathf.Clamp(m_rodZ, m_minZ_inserted, m_maxZ_inserted); float num = m_rodZ - rodZ; ((Component)this).transform.localPosition = new Vector3(Point_Inserted.localPosition.x, Point_Inserted.localPosition.y, m_rodZ); bool flag = m_rodZ > m_lastRodZ; if (flag && (Object)(object)ParentCarbine != (Object)null && (Object)(object)((FVRFireArm)ParentCarbine).Magazine != (Object)null) { FVRFireArmMagazine magazine = ((FVRFireArm)ParentCarbine).Magazine; int numRounds = magazine.m_numRounds; int capacity = magazine.m_capacity; if (numRounds > 0 && capacity > 0) { float num2 = m_maxZ_inserted - m_minZ_inserted; float num3 = (m_rodZ - m_minZ_inserted) / num2; float num4 = 0.125f; float num5 = 1f - (float)numRounds / (float)capacity * (1f - num4); num5 = Mathf.Max(num5, num4); if (num3 >= num5) { float num6 = (num3 - num5) / (1f - num5); float num7 = 1f / (float)numRounds; int num8 = Mathf.FloorToInt(num6 / num7); num8 = Mathf.Clamp(num8, 0, numRounds - 1); if (num8 > m_lastClickIndex && num8 < numRounds) { SM.PlayGenericSound(AudEvent_BulletClick, ((Component)this).transform.position); m_lastClickIndex = num8; } } } } if (!flag) { m_lastClickIndex = -1; } m_lastRodZ = m_rodZ; if (m_isRotationLocked && m_rodZ < m_maxZ_inserted) { ((Component)this).transform.localRotation = m_originalRotation * Quaternion.Euler(0f, 0f, -90f); m_isRotationLocked = false; SM.PlayGenericSound(AudEvent_RodUnlock, ((Component)this).transform.position); if ((Object)(object)ParentCarbine != (Object)null) { ParentCarbine.OnMagazineRodStateChanged(isDetached: true); } } if (m_rodZ <= m_minZ_inserted) { GameObject val = Object.Instantiate(RodPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation); ((FVRInteractiveObject)this).ForceBreakInteraction(); Carbine65MagazineRod component = val.GetComponent(); hand.ForceSetInteractable((FVRInteractiveObject)(object)component); ((FVRInteractiveObject)component).BeginInteraction(hand); SM.PlayGenericSound(AudEvent_ExtractFromCarbine, ((Component)this).transform.position); if ((Object)(object)ParentCarbine != (Object)null) { ParentCarbine.OnMagazineRodStateChanged(isDetached: true); } Hide(); } else if (m_rodZ >= m_maxZ_inserted && !m_isRotationLocked) { SM.PlayGenericSound(AudEvent_RodLock, ((Component)this).transform.position); ((Component)this).transform.localRotation = m_originalRotation; m_isRotationLocked = true; if ((Object)(object)ParentCarbine != (Object)null) { ParentCarbine.OnMagazineRodStateChanged(isDetached: false); } } } private void Hide() { ((Component)this).gameObject.SetActive(false); } } } public class CooldownSound : MonoBehaviour { public ClosedBoltWeapon weapon; public AudioClip[] audioClips; public float volume = 1f; public int minShots = 5; public int maxShots = 10; public float minDelay = 0.5f; public float maxDelay = 2f; public float resetTime = 1.5f; private AudioSource audioSource; private int shotCounter = 0; private float lastShotTime; private bool lastRoundSpent; private int nextShotThreshold; private bool isPlayingSound = false; private void Start() { if ((Object)(object)weapon == (Object)null) { weapon = ((Component)this).GetComponent(); } if ((Object)(object)weapon == (Object)null) { Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon."); return; } audioSource = ((Component)weapon).gameObject.GetComponent(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)weapon).gameObject.AddComponent(); } audioSource.spatialBlend = 1f; audioSource.playOnAwake = false; audioSource.rolloffMode = (AudioRolloffMode)0; lastRoundSpent = weapon.Chamber.IsSpent; SetNewShotThreshold(); } private void Update() { DetectFiring(); } private void DetectFiring() { if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent) { OnWeaponFired(); } lastRoundSpent = weapon.Chamber.IsSpent; } private void OnWeaponFired() { float num = Time.time - lastShotTime; if (num > resetTime) { shotCounter = 0; SetNewShotThreshold(); } shotCounter++; lastShotTime = Time.time; if (shotCounter >= nextShotThreshold) { ((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay()); shotCounter = 0; SetNewShotThreshold(); } } private IEnumerator PlaySoundWithDelay() { if (!isPlayingSound) { isPlayingSound = true; float delay = Random.Range(minDelay, maxDelay); yield return (object)new WaitForSeconds(delay); if (audioClips.Length > 0) { int index = Random.Range(0, audioClips.Length); audioSource.clip = audioClips[index]; audioSource.PlayOneShot(audioSource.clip, volume); yield return (object)new WaitForSeconds(audioSource.clip.length); } isPlayingSound = false; } } private void SetNewShotThreshold() { nextShotThreshold = Random.Range(minShots, maxShots + 1); } } public class CustomWaggleJoint : MonoBehaviour { public float distanceLimit = 0.25f; public float angleLimitLeft = 45f; public float angleLimitRight = 45f; public float gravityScale = 1f; public bool useSpring; public float springApproachRate = 0.95f; public float damping; public Transform hingeGraphic; public Vector3 hingeGraphicRotationOffset; public bool invertWaggleAxis; public bool ManualExecution; public float onHitLimitCooldown = 0.05f; public Vector3 waggleAxis = Vector3.up; public Vector3 rotationAxis = Vector3.up; [Header("Gizmo Options")] public bool debugGizmos = false; public bool showRotationExtremes = false; public bool showRotationDirectionArrows = false; private Vector3 particlePos; private Vector3 particleVel; private bool leftCatchState; private bool rightCatchState; private float lastTouchTime = float.MinValue; private Vector3 EffectiveWaggleDir() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis)); } private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax) { if (invertWaggleAxis) { effectiveAngleMin = 0f - angleLimitLeft; effectiveAngleMax = angleLimitRight; } else { effectiveAngleMin = 0f - angleLimitRight; effectiveAngleMax = angleLimitLeft; } } public void ResetParticlePos() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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) particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit; particleVel = Vector3.zero; } private void OnHitLimit(float angularVelocity) { } public void Execute() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0043: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; Transform transform = ((Component)this).transform; Vector3 val = Physics.gravity * gravityScale; Vector3 val2 = particlePos; Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime; Vector3 val4 = val2 + val3 * deltaTime; Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized); Vector3 val6 = EffectiveWaggleDir(); Vector3 position = transform.position; if (useSpring) { val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime)); } GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax); particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax); particleVel = (particlePos - val2) / deltaTime; if ((Object)(object)hingeGraphic != (Object)null) { hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset); } } private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection); num = Mathf.Clamp(num, angleMin, angleMax); Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection; return val * distanceLimit + hingePivot; } private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - hingePivot; Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis); Vector3 normalized = ((Vector3)(ref val2)).normalized; return SignedAngle(hingeDirection, normalized, hingeAxis); } private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(from, to); return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to))); } private void Start() { ResetParticlePos(); } private void Update() { if (!ManualExecution) { Execute(); } } } public class GunStockLace : MonoBehaviour { public float length = 0.5f; public float gravity = 9.81f; public float damping = 0.05f; public float maxDeviationAngle = 45f; public LayerMask collisionMask; public bool showGizmos = false; private Vector3 pendulumDirection; private Vector3 angularVelocity; private Quaternion baseRotation; private Vector3 restDirection; private Vector3 previousPosition; private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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) baseRotation = ((Component)this).transform.rotation; restDirection = baseRotation * -Vector3.up; pendulumDirection = restDirection; previousPosition = ((Component)this).transform.position; } private void FixedUpdate() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - previousPosition; previousPosition = ((Component)this).transform.position; float fixedDeltaTime = Time.fixedDeltaTime; Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length; Vector3 val3 = val * 10f / fixedDeltaTime; angularVelocity += (val2 + val3) * fixedDeltaTime; angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime); Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f); pendulumDirection = val4 * pendulumDirection; HandleCollisionLimits(); ClampToMaxAngle(); ((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation; } private void HandleCollisionLimits() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask))) { Vector3 normal = ((RaycastHit)(ref val)).normal; Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Angle(pendulumDirection, normalized); pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f); angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal); } } private void ClampToMaxAngle() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) float num = Vector3.Angle(restDirection, pendulumDirection); if (num > maxDeviationAngle) { pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f); angularVelocity *= 0.5f; } } private void OnDrawGizmos() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (showGizmos) { Gizmos.color = Color.yellow; Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length); Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f); } } } public class HuntDollarSR : MonoBehaviour { private IEnumerator Start() { yield return (object)new WaitForSeconds(3f); string str = "CharcoalBriquette(Clone)"; ((Object)((Component)this).gameObject).name = str; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Component val = (Component)(object)componentsInChildren[i]; ((Object)val.gameObject).name = str; } } } public class PlayRandomSoundOnSpawn : MonoBehaviour { public AudioClip[] spawnSounds; public float volume = 1f; [Header("Pitch Settings")] public float minPitch = 0.9f; public float maxPitch = 1.1f; private AudioSource audioSource; private void Start() { if (spawnSounds.Length > 0) { audioSource = ((Component)this).gameObject.AddComponent(); audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; audioSource.volume = volume; AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)]; audioSource.pitch = Random.Range(minPitch, maxPitch); audioSource.PlayOneShot(val); } } } public class RandomSpinOnSpawn : MonoBehaviour { public float spinForce = 0.5f; public Vector3 torqueAxis = new Vector3(1f, 0f, 0f); private Rigidbody rb; private void Start() { //IL_003e: 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_005f: Unknown result type (might be due to invalid IL or missing references) rb = ((Component)this).GetComponent(); if ((Object)(object)rb != (Object)null) { ((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1); } } }