Decompiled source of HuntBurgess v1.0.2
HuntBurgess.dll
Decompiled 21 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; 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 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.HuntBurgess { [BepInPlugin("BitWizrd.HuntBurgess", "HuntBurgess", "1.0.2")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntBurgessPlugin : 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() { OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntBurgess", "", "burgess", "", ""); } } } 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<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).name = name; } } } namespace BitWizrd.Shotgun.Burgess { public class BurgessForegrip : FVRAlternateGrip { [NonSerialized] public HingeJoint Hinge; [NonSerialized] public Rigidbody RB; [Header("Unlock Input")] [Tooltip("Touchpad deadzone for the latch in non-streamlined mode: how far the thumb must be displaced from centre before a north press counts as deliberate. The direction itself is handled by the north quadrant test in FoldingShotgun.IsFoldUnlatchHeld, so this is purely a magnitude floor. Unused in streamlined mode, where the latch is the BY button.")] public float UnlockInputThreshold = 0.1f; [Header("Latch Visual")] public Transform Latch; public Vector3 LatchLockedRotation = Vector3.zero; [Tooltip("Local rotation when unlocked (Burgess latch rotates on local Y, negative direction)")] public Vector3 LatchUnlockedRotation = new Vector3(0f, -20f, 0f); [Header("Secondary Lever (moves in unison with the latch)")] public Transform SecondaryLever; public Vector3 SecondaryLeverLockedRotation = Vector3.zero; [Tooltip("Local rotation when unlocked. The lever arm points the OPPOSITE lateral direction from the latch arm (antiparallel), so the SAME local sign swings both tips the same way (up). Keep the signs matched.")] public Vector3 SecondaryLeverUnlockedRotation = new Vector3(0f, -30f, 0f); public float LatchSpeed = 12f; private FoldingShotgun m_weapon; private bool m_isUnlocked; private bool m_wasUnlocked; private float m_latchLerp; private bool m_hasUnlockUpSinceBegin; public bool IsUnlocked => m_isUnlocked; public override void Awake() { ((FVRAlternateGrip)this).Awake(); m_weapon = ((Component)this).GetComponentInParent<FoldingShotgun>(); } public override void BeginInteraction(FVRViveHand hand) { if ((Object)(object)m_weapon != (Object)null && ((FVRPhysicalObject)m_weapon).IsAltHeld && (Object)(object)((FVRInteractiveObject)m_weapon).m_hand != (Object)null && (Object)(object)((FVRInteractiveObject)m_weapon).m_hand != (Object)(object)hand) { ((FVRPhysicalObject)m_weapon).IsAltHeld = false; ((FVRAlternateGrip)this).BeginInteraction(hand); ((FVRPhysicalObject)m_weapon).IsAltHeld = true; } else { ((FVRAlternateGrip)this).BeginInteraction(hand); } m_isUnlocked = false; m_wasUnlocked = false; m_hasUnlockUpSinceBegin = false; } public override void UpdateInteraction(FVRViveHand hand) { ((FVRAlternateGrip)this).UpdateInteraction(hand); ProcessUnlockHand(hand); } public override void PassHandInput(FVRViveHand hand, FVRInteractiveObject o) { ((FVRAlternateGrip)this).PassHandInput(hand, o); if (!((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) || !((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)(object)hand)) { ProcessUnlockHand(hand); } } public void ClearUnlock() { m_isUnlocked = false; m_wasUnlocked = false; m_hasUnlockUpSinceBegin = false; } private void ProcessUnlockHand(FVRViveHand hand) { if (!((Object)(object)m_weapon == (Object)null)) { bool flag = FoldingShotgun.IsFoldUnlatchHeld(hand, UnlockInputThreshold); if (!flag) { m_hasUnlockUpSinceBegin = true; } m_isUnlocked = flag && m_hasUnlockUpSinceBegin; if (m_isUnlocked && !m_wasUnlocked) { ((FVRFireArm)m_weapon).PlayAudioEvent((FirearmAudioEventType)14, 1f); } m_wasUnlocked = m_isUnlocked; m_weapon.IsFoldUnlocked = m_isUnlocked; } } public override void FVRFixedUpdate() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRFixedUpdate(); if (!((Object)(object)m_weapon == (Object)null)) { if ((Object)(object)RB != (Object)null) { RB.mass = ((!((FVRInteractiveObject)m_weapon).IsHeld || !((FVRPhysicalObject)m_weapon).IsAltHeld) ? 0.1f : 0.001f); } float num = ((!m_isUnlocked) ? 0f : 1f); m_latchLerp = Mathf.Lerp(m_latchLerp, num, Time.deltaTime * LatchSpeed); if ((Object)(object)Latch != (Object)null) { Latch.localRotation = Quaternion.Slerp(Quaternion.Euler(LatchLockedRotation), Quaternion.Euler(LatchUnlockedRotation), m_latchLerp); } if ((Object)(object)SecondaryLever != (Object)null) { SecondaryLever.localRotation = Quaternion.Slerp(Quaternion.Euler(SecondaryLeverLockedRotation), Quaternion.Euler(SecondaryLeverUnlockedRotation), m_latchLerp); } } } public override bool IsInteractable() { return true; } public override void EndInteraction(FVRViveHand hand) { m_isUnlocked = false; m_hasUnlockUpSinceBegin = false; if ((Object)(object)m_weapon != (Object)null) { m_weapon.IsFoldUnlocked = false; } ((FVRAlternateGrip)this).EndInteraction(hand); } } } public class ComponentActivateRandomRuntime : MonoBehaviour { public float Probability; public int Group; public float SelectionStart; private static readonly Dictionary<Transform, Dictionary<int, float>> groupRolls = new Dictionary<Transform, Dictionary<int, float>>(); private void Awake() { if (Probability >= 1f) { return; } bool flag; if (Group != 0) { Transform root = ((Component)this).transform.root; if (!groupRolls.TryGetValue(root, out var value)) { value = new Dictionary<int, float>(); groupRolls[root] = value; } if (!value.TryGetValue(Group, out var value2)) { value2 = Random.value; value[Group] = value2; } flag = value2 >= SelectionStart && value2 <= SelectionStart + Probability; } else { flag = Random.value <= Probability; } if (!flag) { ((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<ClosedBoltWeapon>(); } 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<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)weapon).gameObject.AddComponent<AudioSource>(); } 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 FireLightFlicker : MonoBehaviour { public Light Light; public float BaseIntensity = 1f; public float FlickerMin = 1f; public float FlickerMax = 1f; public float FlickerSpeed = 1f; private float noiseOffset; private void Awake() { if ((Object)(object)Light == (Object)null) { Light = ((Component)this).GetComponent<Light>(); } noiseOffset = Random.value * 1000f; } private void Update() { if (!((Object)(object)Light == (Object)null)) { float num = Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f); Light.intensity = BaseIntensity * Mathf.Lerp(FlickerMin, FlickerMax, num); } } } namespace BitWizrd.Shotgun.Burgess { public class FoldingShotgun : BreakActionWeapon { public enum FoldState { Folded, Unfolded } public enum FoldAxis { X, Y, Z } public enum TravelAxis { X, Y, Z } [Header("Burgess Config")] public FVRFireArmChamber LifterChamber; public FVRFireArmChamber Chamber; public BurgessForegrip ForeGrip; [Header("Component Connections")] public FVRFireArmMagazineReloadTrigger MagazineReloadTrigger; [Header("Barrel / Hammer")] public Transform Muzzle; public Transform Hammer; public InterpStyle HammerInterpStyle = (InterpStyle)1; public Axis HammerAxis = (Axis)1; public float HammerUncocked; public float HammerCocked; private bool m_isHammerCocked; private bool m_wasCockButtonHeld; private bool m_cockButtonConsumed; [Header("Folding")] public FoldState CurrentFoldState = FoldState.Folded; public FoldAxis FoldRotationAxis = FoldAxis.Y; public float FoldAngleThreshold = 10f; public float UnfoldAngleThreshold = 35f; [Header("Authored Weld Poses (hinge GO local space under its ORIGINAL parent)")] public Vector3 FoldedLocalPosition = Vector3.zero; public Vector3 FoldedLocalEuler = Vector3.zero; public Vector3 UnfoldedLocalPosition = new Vector3(0.00055f, 0f, 0.00698f); public Vector3 UnfoldedLocalEuler = new Vector3(0f, -168f, 0f); [Header("Fold Drive")] [Tooltip("Hinge spring strength used while a hand is on the foregrip and the barrel is unwelded. Vanilla FVRShotgunForegrip hardcodes 10, tuned for a stubby fore-end swinging ~45 degrees. Burgess swings a whole barrel through 168.5 degrees, so its moment of inertia about the hinge is far larger and the same constant yields proportionally less angular acceleration - the barrel lags the hand. Raise to sharpen, set back to 10 for exact vanilla feel.")] public float ForeGripDriveSpring = 40f; [Tooltip("How much of the barrel's own weight the hand is treated as carrying while it holds the foregrip, 0 = none (raw physics), 1 = all of it. Gravity torque about this hinge is m*g*r*cos(angle): near maximum at BOTH ends of the swing and zero in the middle. At the folded end it is 98% of maximum, which is precisely where you are trying to be delicate - and because the drive spring is proportional, its standing error grows with that load, so the barrel drifts off your hand exactly when you want it most controllable. In reality your hand carries the barrel; here it is never attached to it, so it carries none. 1 restores that. Only applied while the foregrip is held.")] [Range(0f, 1f)] public float ForeGripGravityCompensation = 1f; [Tooltip("Viscous friction in the hinge while nobody is on the foregrip, as a decay rate in 1/seconds - 2 sheds about half the swing speed every 0.35s. Gravity is left fully intact: the barrel SHOULD fall open. The problem this solves is that an unfrictioned barrel is a pendulum, so released at one lock it arrives at the far lock with nearly the energy it started with and completes the fold on its own. Real folding hardware has enough friction that it falls, slows and settles, leaving the player to WHIP energy back in to climb to the far lock. Raise it if the barrel still coasts all the way round, lower it if the drop feels sticky or a good flick can no longer make the trip. 0 is frictionless.")] public float FreeSwingFriction = 2f; [Tooltip("ON: the barrel holds the angle you grabbed it at and tracks your hand 1:1, the way vanilla's pump handle holds its grab offset. A sloppy grab stays sloppy for the whole stroke, and driving the hand past a lock winds up, so the barrel does not move again until the hand comes back - both faithful, both deliberate. OFF: the barrel converges toward the hand instead, which self-corrects a bad grab but is not 1:1. Toggle to compare; neither can reintroduce the wrap seam.")] public bool ForeGripPreserveGrabOffset = true; [Tooltip("How fast, in degrees per second, the barrel is allowed to chase the hand. This is the primary feel control for hand-folding. Vanilla's HandCrankFrankCrank clamps its equivalent to 10 degrees per tick, which is ~600 deg/s at 60Hz, so 720 sits just above that. Lower it for a heavier, more deliberate fold; raise it to track the hand more tightly at the cost of a sharper catch-up when you grab the barrel far from where your hand is. 0 removes the limit entirely.")] public float ForeGripMaxTrackSpeed = 720f; [Tooltip("Damper for that same drive spring, and the knob for ringing. Vanilla uses 0, which is survivable only because its spring is weak and its arc is short - an undamped spring at this strength oscillates around the target instead of settling, which reads as the barrel buzzing or snapping past where you want it. Raise if it overshoots or vibrates, lower if it feels syrupy to push.")] public float ForeGripDriveDamper = 2f; [Tooltip("Amplifies the inertial whip when the gun is flicked with NO hand on the foregrip. PhysX does already transmit the pivot's acceleration through the hinge, but the true response is only about 1.5*a/L and is mass-independent, so for a barrel this long it is real yet far too soft to flick open or shut. This re-applies that same inertial torque, scaled, so the barrel carries like a longer/heavier arm - amplifying physics that is already there rather than inventing a spring the real gun does not have. 0 disables it entirely and leaves the pure PhysX response.")] public float WhipAssistGain = 2f; [Tooltip("Degrees per second of swing added by a decisive flick, on top of the continuous assist above. Size this against the 168.5 degree arc: too little and the barrel stalls before reaching the far lock, which is why whipping it OPEN is harder than whipping it shut. 0 disables the impulse and leaves only the continuous assist.")] public float WhipImpulse = 250f; [Tooltip("Hand speed, in metres/second, below which a flick is ignored entirely. This is the knob that decides WHETHER the barrel whips, as opposed to how hard. Vanilla's slap gestures use 1.0; a deliberate wrist flick is comfortably above 2, while ordinary aiming and walking sit well below 1. Raise it if the barrel still goes off during normal handling, lower it if real flicks get ignored.")] public float WhipFlickSpeed = 2f; [Tooltip("Minimum seconds between impulses, so one flick cannot fire on several consecutive physics ticks and stack into a barrel that slams across the arc.")] public float WhipImpulseCooldown = 0.25f; [Header("Barrel Lock Interface")] [Tooltip("Nudge applied to the hinge's PARENT transform while the barrel is released from its unfolded locking interface - from the moment the latch opens until it relatches unfolded, folded included. Expressed in that parent's own parent space, exactly like its localPosition. The default is the negative of the authored parent offset, so the released pivot lands on that parent's origin and the seated pivot sits where the art has it.")] public Vector3 UnlatchedHingeParentOffset = new Vector3(-0.00055f, 0f, -0.00698f); [Header("Debug")] public bool DebugDisableFolding = false; private bool m_debugWasEnabled; private bool m_wasUnlatchRequested; private bool m_unlatchRequested; private bool m_primaryUnlatchHeld; private bool m_hasUnlatchUpSinceBegin; private bool m_wasForeGripDriving; private float m_foreGripGrabOffset; private bool m_hasForeGripGrabOffset; private bool m_hasLeftStartZoneSinceSeparate; [Header("Ejection")] public Transform EjectionPort; public Vector3 EjectionForce = new Vector3(0.3f, 1f, -0.2f); public Vector3 EjectionTorque = new Vector3(80f, 0f, 30f); public Vector3 FoldEjectionForce = new Vector3(0f, 0.05f, -0.15f); public Vector3 FoldEjectionTorque = Vector3.zero; public float FoldEjectionAngleThreshold = 70f; public bool UsesSimplifiedFoldedChamberAccess = false; public Transform ChamberExtractedPos; [Header("Magazine Follower")] public Transform MagazineFollower; public Vector3 MagazineFollowerEmptyPos = Vector3.zero; public Vector3 MagazineFollowerFullPos = new Vector3(0f, 0f, -0.05f); [Header("Carrier")] public Transform Carrier; public TravelAxis CarrierRotationAxis = TravelAxis.X; public float CarrierDownAngle = 0f; public float CarrierUpAngle = -25f; public float CarrierSnapSpeed = 400f; private bool m_carrierUp; private float m_carrierCurrentAngle; [Header("Pump Configuration")] public TravelAxis PumpTravelAxis = TravelAxis.X; public float Speed_Held = 12f; [Range(0f, 1f)] public float PumpPositionDamping = 0.85f; [Header("Pump Reference Points (REQUIRED)")] public Transform Point_Grip_Forward; public Transform Point_Grip_Rear; [Header("Bolt Reference Points (REQUIRED)")] public Transform Point_Bolt_Forward; public Transform Point_Bolt_LockPoint; public Transform Point_Bolt_Rear; [Header("Pump Visuals")] public Transform Bolt; public TravelAxis BoltTravelAxis = TravelAxis.X; public Transform Sleeve; public Transform SlideBottom; public float SlideBottomForwardAngle = 0f; public float SlideBottomRearAngle = -20f; [Header("Quickbelt Size")] public FVRPhysicalObjectSize FoldedSize = (FVRPhysicalObjectSize)1; public FVRPhysicalObjectSize UnfoldedSize = (FVRPhysicalObjectSize)2; [Tooltip("Optional second quickbelt pose, used instead of the inherited QBPoseOverride while the barrel is folded - a folded Burgess is a different shape and hangs differently. Author it as a child transform posed for the folded silhouette. Leave empty to use the one QBPoseOverride for both states.")] public Transform QBPoseOverride_Folded; private Transform m_qbPoseOverrideDeployed; public bool UsesSlamFireTrigger; private const float TRIGGER_RESET_THRESHOLD = 0.45f; private const float TRIGGER_BREAK_THRESHOLD = 0.85f; private bool m_hasTriggerReset = true; private float m_lastFireTime; private float m_strokeDistance = 0.1f; private float m_directionSign = -1f; private Vector2 m_boltRange = new Vector2(0f, -0.12f); private float m_lockT = 0.5f; private const float REAR_ARRIVAL = 0.95f; private const float FORE_ARRIVAL = 0.05f; private float m_handStartTravel; private float m_grabStartPumpPos; private float m_curPumpPos; private float m_curBoltPos; private bool m_wasPastLock; private bool m_hasReachedRear; private bool m_hasReachedFore = true; private bool m_isHandleLocked; private FVRViveHand m_lastBraceHand; private bool m_isPumpCycling; private Vector3 m_sleeveStartLocal = Vector3.zero; private bool m_sleeveInit; private Quaternion m_carrierRestRotation = Quaternion.identity; private Quaternion m_slideBottomRestRotation = Quaternion.identity; private GameObject m_hingeGO; private Transform m_hingeOriginalParent; private Rigidbody m_hingeRB; private bool m_isWelded; private Vector3 m_hingeParentSeatedLocalPos; private HingeJoint m_decoyHinge; private Vector3 m_weldedLocalPos; private Quaternion m_weldedLocalRot; private bool m_needsPreciseWeldSnap; private float m_cachedMass; private float m_cachedDrag; private float m_cachedAngularDrag; private bool m_cachedUseGravity; private RigidbodyInterpolation m_cachedInterpolation; private CollisionDetectionMode m_cachedCollisionDetection; private RigidbodyConstraints m_cachedConstraints; private Vector3 m_cachedAxis; private Vector3 m_cachedAnchor; private bool m_cachedAutoConfigureConnectedAnchor; private Vector3 m_cachedConnectedAnchor; private Rigidbody m_cachedConnectedBody; private JointLimits m_cachedLimits; private bool m_cachedUseSpring; private JointSpring m_cachedSpring; private bool m_cachedUseMotor; private JointMotor m_cachedMotor; private bool m_isAutoClosingAction; private Vector3 m_lastPivotVel; private bool m_hasPivotVelSample; private float m_lastWhipImpulseTime; private const float WHIP_ALIGNMENT = 0.3f; public float CurrentPumpPos => m_curPumpPos; public float CurrentBoltPos => m_curBoltPos; public bool IsHandleLocked => m_isHandleLocked; public bool IsActionOpen => m_curPumpPos > m_lockT; public FoldState CurrentFold => CurrentFoldState; public bool IsFoldUnlocked { get; set; } public bool IsWelded => m_isWelded; private bool HasBarrel => (Object)(object)Chamber != (Object)null; private bool IsDeployedAndLocked => m_isWelded && CurrentFoldState == FoldState.Unfolded; private Transform PumpFrame => (!((Object)(object)Point_Grip_Forward != (Object)null)) ? ((Component)this).transform : Point_Grip_Forward.parent; public void LockHandle() { m_isHandleLocked = true; } public void UnlockHandle() { m_isHandleLocked = false; } private static float AxisComponent(Vector3 v, TravelAxis a) { return a switch { TravelAxis.X => v.x, TravelAxis.Y => v.y, _ => v.z, }; } private static Vector3 SetAxisComponent(Vector3 v, TravelAxis a, float value) { //IL_0030: 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_0037: Unknown result type (might be due to invalid IL or missing references) switch (a) { case TravelAxis.X: v.x = value; break; case TravelAxis.Y: v.y = value; break; default: v.z = value; break; } return v; } private static Vector3 TravelAxisVector(TravelAxis a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_002f: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(a switch { TravelAxis.X => Vector3.right, TravelAxis.Y => Vector3.up, _ => Vector3.forward, }); } private static bool IsSlideReleaseHeld(FVRViveHand hand) { if (hand.IsInStreamlinedMode) { return hand.Input.AXButtonPressed; } return hand.Input.TouchpadPressed && hand.Input.TouchpadSouthPressed; } public static bool IsFoldUnlatchHeld(FVRViveHand hand, float touchpadDeadzone) { if (hand.IsInStreamlinedMode) { return hand.Input.BYButtonPressed; } return hand.Input.TouchpadPressed && hand.Input.TouchpadNorthPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > touchpadDeadzone; } public override Transform GetMuzzle() { if ((Object)(object)((FVRFireArm)this).CurrentMuzzle != (Object)null) { return ((FVRFireArm)this).CurrentMuzzle; } return Muzzle; } public FVRPhysicalObjectSize GetCurrentSize() { //IL_0018: 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_001d: 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) return (CurrentFoldState != FoldState.Folded) ? UnfoldedSize : FoldedSize; } public override void Awake() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: 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_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) if (base.Barrels == null) { base.Barrels = (BreakActionBarrel[])(object)new BreakActionBarrel[0]; } ((BreakActionWeapon)this).Awake(); base.m_hasEjector = false; base.m_hasExtraEjectors = false; base.m_hasLatch = false; base.m_hasLatchButton = false; base.UsesManuallyCockedHammers = false; base.m_EjectsOnOpen = false; GameObject val = new GameObject("BaseHingeDecoy"); val.transform.SetParent(((Component)this).transform, false); Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.isKinematic = true; val2.useGravity = false; val2.detectCollisions = false; m_decoyHinge = val.AddComponent<HingeJoint>(); m_qbPoseOverrideDeployed = ((FVRInteractiveObject)this).QBPoseOverride; if ((Object)(object)LifterChamber != (Object)null) { LifterChamber.Firearm = (FVRFireArm)(object)this; ((FVRFireArm)this).FChambers.Add(LifterChamber); EnsureChamberProxyStub(LifterChamber); } if ((Object)(object)Chamber != (Object)null) { Chamber.Firearm = (FVRFireArm)(object)this; ((FVRFireArm)this).FChambers.Add(Chamber); EnsureChamberProxyStub(Chamber); Chamber.IsManuallyChamberable = false; } if ((Object)(object)base.Hinge != (Object)null) { m_hingeGO = ((Component)base.Hinge).gameObject; m_hingeRB = m_hingeGO.GetComponent<Rigidbody>(); m_hingeOriginalParent = m_hingeGO.transform.parent; if ((Object)(object)m_hingeOriginalParent != (Object)null) { m_hingeParentSeatedLocalPos = m_hingeOriginalParent.localPosition; } if ((Object)(object)m_hingeRB != (Object)null) { m_cachedMass = m_hingeRB.mass; m_cachedDrag = m_hingeRB.drag; m_cachedAngularDrag = m_hingeRB.angularDrag; m_cachedUseGravity = m_hingeRB.useGravity; m_cachedInterpolation = m_hingeRB.interpolation; m_cachedCollisionDetection = m_hingeRB.collisionDetectionMode; m_cachedConstraints = m_hingeRB.constraints; } m_cachedAxis = ((Joint)base.Hinge).axis; m_cachedAnchor = ((Joint)base.Hinge).anchor; m_cachedAutoConfigureConnectedAnchor = ((Joint)base.Hinge).autoConfigureConnectedAnchor; m_cachedConnectedAnchor = ((Joint)base.Hinge).connectedAnchor; m_cachedConnectedBody = ((Joint)base.Hinge).connectedBody; m_cachedLimits = base.Hinge.limits; m_cachedUseSpring = base.Hinge.useSpring; m_cachedSpring = base.Hinge.spring; m_cachedUseMotor = base.Hinge.useMotor; m_cachedMotor = base.Hinge.motor; } if ((Object)(object)Point_Grip_Forward != (Object)null && (Object)(object)Point_Grip_Rear != (Object)null) { float num = AxisComponent(Point_Grip_Forward.localPosition, PumpTravelAxis); float num2 = AxisComponent(Point_Grip_Rear.localPosition, PumpTravelAxis); float num3 = num2 - num; if (Mathf.Abs(num3) > 0.0001f) { m_strokeDistance = Mathf.Abs(num3); m_directionSign = ((!(num3 >= 0f)) ? (-1f) : 1f); } } if ((Object)(object)Point_Bolt_Forward != (Object)null && (Object)(object)Point_Bolt_Rear != (Object)null) { float num4 = AxisComponent(Point_Bolt_Forward.localPosition, BoltTravelAxis); float num5 = AxisComponent(Point_Bolt_Rear.localPosition, BoltTravelAxis); m_boltRange = new Vector2(num4, num5); if ((Object)(object)Point_Bolt_LockPoint != (Object)null) { float num6 = AxisComponent(Point_Bolt_LockPoint.localPosition, BoltTravelAxis); float num7 = num5 - num4; if (Mathf.Abs(num7) > 0.0001f) { m_lockT = Mathf.Clamp01((num6 - num4) / num7); } } } RecordSleeveStart(); if ((Object)(object)Carrier != (Object)null) { m_carrierRestRotation = Carrier.localRotation; } if ((Object)(object)SlideBottom != (Object)null) { m_slideBottomRestRotation = SlideBottom.localRotation; } if (DebugDisableFolding) { CurrentFoldState = FoldState.Unfolded; m_debugWasEnabled = true; SnapHingeToFoldPose(FoldState.Unfolded); WeldBarrel(); } else if (CurrentFoldState == FoldState.Folded) { SnapHingeToFoldPose(FoldState.Folded); WeldBarrel(); } else { SnapHingeToFoldPose(FoldState.Unfolded); WeldBarrel(); } } private static void EnsureChamberProxyStub(FVRFireArmChamber chamber) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if (!((Object)(object)chamber == (Object)null)) { if ((Object)(object)chamber.ProxyRound == (Object)null) { GameObject val = new GameObject("ProxyRoundStub"); val.transform.SetParent(((Component)chamber).transform, false); chamber.ProxyRound = val.transform; } if ((Object)(object)chamber.ProxyMesh == (Object)null) { chamber.ProxyMesh = ((Component)chamber.ProxyRound).gameObject.AddComponent<MeshFilter>(); } if ((Object)(object)chamber.ProxyRenderer == (Object)null) { chamber.ProxyRenderer = ((Component)chamber.ProxyRound).gameObject.AddComponent<MeshRenderer>(); ((Renderer)chamber.ProxyRenderer).enabled = false; } } } public override void BeginInteraction(FVRViveHand hand) { ((FVRFireArm)this).BeginInteraction(hand); m_hasTriggerReset = true; m_hasUnlatchUpSinceBegin = false; m_wasCockButtonHeld = true; m_cockButtonConsumed = true; } public override void UpdateInteraction(FVRViveHand hand) { base.HasTriggerReset = true; ((BreakActionWeapon)this).UpdateInteraction(hand); bool flag = IsSlideReleaseHeld(hand); if (flag && !m_wasCockButtonHeld && ShouldButtonCockHammer() && CockHammerManually()) { m_cockButtonConsumed = true; } if (!flag) { m_cockButtonConsumed = false; } m_wasCockButtonHeld = flag; bool flag2 = (Object)(object)ForeGrip != (Object)null && IsFoldUnlatchHeld(hand, ForeGrip.UnlockInputThreshold); if (!flag2) { m_hasUnlatchUpSinceBegin = true; } if (CurrentFoldState == FoldState.Folded) { m_primaryUnlatchHeld = flag2 && m_hasUnlatchUpSinceBegin; return; } m_primaryUnlatchHeld = false; UpdateBurgessInput(hand); } private bool CockHammerManually() { if (!HasBarrel || m_isHammerCocked) { return false; } m_isHammerCocked = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); return true; } private bool ShouldButtonCockHammer() { if (m_isHammerCocked || !HasBarrel) { return false; } if (!IsDeployedAndLocked) { return true; } return (Object)(object)Chamber != (Object)null && Chamber.IsFull && !Chamber.IsSpent; } private void UpdateBurgessInput(FVRViveHand hand) { if (!((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin || !HasBarrel) { return; } float triggerFloat = hand.Input.TriggerFloat; if (!m_hasTriggerReset && triggerFloat <= 0.45f) { m_hasTriggerReset = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f); } if (triggerFloat >= 0.85f && m_isHammerCocked && m_isWelded && m_hasReachedFore) { if ((m_hasTriggerReset || UsesSlamFireTrigger) && Time.time - m_lastFireTime >= 0.1f) { FireBurgess(); } m_hasTriggerReset = false; } } private Transform GetEjectPoint() { if ((Object)(object)EjectionPort != (Object)null) { return EjectionPort; } return (!HasBarrel) ? ((Component)this).transform : Muzzle; } private void UpdateFoldedEjection() { //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) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (UsesSimplifiedFoldedChamberAccess || CurrentFoldState != FoldState.Folded || (Object)(object)Chamber == (Object)null || !Chamber.IsFull) { return; } Vector3 val = ((Component)this).transform.TransformDirection(FoldEjectionForce); if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f) && !(Vector3.Angle(Vector3.down, val) > FoldEjectionAngleThreshold)) { FVRFireArmRound round = Chamber.GetRound(); if (!((Object)(object)round == (Object)null)) { Transform ejectPoint = GetEjectPoint(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); Chamber.EjectRound(ejectPoint.position, val, ((Component)this).transform.TransformDirection(FoldEjectionTorque), ejectPoint.position, ((Component)Chamber).transform.rotation, false); } } } public void EjectChamberShell() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) if (!((Object)(object)Chamber == (Object)null) && Chamber.IsFull) { Transform ejectPoint = GetEjectPoint(); Chamber.EjectRound(ejectPoint.position, ((Component)this).transform.TransformDirection(EjectionForce), ((Component)this).transform.TransformDirection(EjectionTorque), ejectPoint.position, ((Component)Chamber).transform.rotation, false); } } private void SnapHingeToPose(Vector3 localPos, Vector3 localEuler) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_hingeGO == (Object)null)) { if ((Object)(object)m_hingeOriginalParent != (Object)null && (Object)(object)m_hingeGO.transform.parent != (Object)(object)m_hingeOriginalParent) { m_hingeGO.transform.SetParent(m_hingeOriginalParent, true); } m_hingeGO.transform.localPosition = localPos; m_hingeGO.transform.localEulerAngles = localEuler; if ((Object)(object)m_hingeRB != (Object)null) { m_hingeRB.velocity = Vector3.zero; m_hingeRB.angularVelocity = Vector3.zero; } } } private void ApplyHingeSeating(bool seated) { //IL_002f: 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_0024: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_hingeOriginalParent == (Object)null)) { m_hingeOriginalParent.localPosition = ((!seated) ? (m_hingeParentSeatedLocalPos + UnlatchedHingeParentOffset) : m_hingeParentSeatedLocalPos); } } private void SnapHingeToFoldPose(FoldState state) { //IL_002a: 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_0013: 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) ApplyHingeSeating(state == FoldState.Unfolded); if (state == FoldState.Folded) { SnapHingeToPose(FoldedLocalPosition, FoldedLocalEuler); } else { SnapHingeToPose(UnfoldedLocalPosition, UnfoldedLocalEuler); } } private void WeldBarrel() { //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_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_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_hingeGO == (Object)null)) { m_weldedLocalPos = ((Component)this).transform.InverseTransformPoint(m_hingeGO.transform.position); m_weldedLocalRot = Quaternion.Inverse(((Component)this).transform.rotation) * m_hingeGO.transform.rotation; if ((Object)(object)m_hingeRB != (Object)null) { m_hingeRB.velocity = Vector3.zero; m_hingeRB.angularVelocity = Vector3.zero; } if ((Object)(object)base.Hinge != (Object)null) { Object.Destroy((Object)(object)base.Hinge); base.Hinge = null; } if ((Object)(object)m_hingeRB != (Object)null) { Object.Destroy((Object)(object)m_hingeRB); m_hingeRB = null; } if ((Object)(object)ForeGrip != (Object)null) { ForeGrip.Hinge = null; ForeGrip.RB = null; } m_hingeGO.transform.SetParent(((Component)this).transform, true); m_isWelded = true; m_needsPreciseWeldSnap = true; m_wasUnlatchRequested = true; } } private static Vector3 PickFoldReferenceAxis(Vector3 localAxis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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_0060: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.forward; float num = Mathf.Abs(Vector3.Dot(localAxis, val)); float num2 = Mathf.Abs(Vector3.Dot(localAxis, Vector3.up)); if (num2 < num) { val = Vector3.up; num = num2; } float num3 = Mathf.Abs(Vector3.Dot(localAxis, Vector3.right)); if (num3 < num) { val = Vector3.right; num = num3; } return val; } private static float SignedAngleAbout(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_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_000c: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(from, to); float num2 = Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to))); return num * num2; } private static float UnwrapNear(float angle, float center) { while (angle - center > 180f) { angle -= 360f; } while (angle - center < -180f) { angle += 360f; } return angle; } private float GetFoldToUnfoldSign(out Vector3 hingeAxisWorld, out Vector3 closedDir, out Vector3 openDir) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0048: 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_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_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = TravelAxisVector((TravelAxis)FoldRotationAxis); hingeAxisWorld = m_hingeOriginalParent.TransformDirection(val); Vector3 val2 = PickFoldReferenceAxis(val); closedDir = m_hingeOriginalParent.rotation * Quaternion.Euler(FoldedLocalEuler) * val2; openDir = m_hingeOriginalParent.rotation * Quaternion.Euler(UnfoldedLocalEuler) * val2; return Mathf.Sign(Vector3.Dot(hingeAxisWorld, Vector3.Cross(closedDir, openDir))); } private void SeparateBarrel() { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0231: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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_02e4: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_hingeGO == (Object)null) { return; } bool isWelded = m_isWelded; m_needsPreciseWeldSnap = false; m_hingeGO.transform.SetParent(m_hingeOriginalParent, true); ApplyHingeSeating(seated: false); if ((Object)(object)m_hingeGO.GetComponent<Rigidbody>() == (Object)null) { m_hingeRB = m_hingeGO.AddComponent<Rigidbody>(); m_hingeRB.mass = ((!(m_cachedMass > 0f)) ? 1f : m_cachedMass); m_hingeRB.drag = m_cachedDrag; m_hingeRB.angularDrag = m_cachedAngularDrag; m_hingeRB.useGravity = m_cachedUseGravity; m_hingeRB.interpolation = m_cachedInterpolation; m_hingeRB.collisionDetectionMode = m_cachedCollisionDetection; m_hingeRB.constraints = m_cachedConstraints; } else { m_hingeRB = m_hingeGO.GetComponent<Rigidbody>(); } m_hingeRB.velocity = Vector3.zero; m_hingeRB.angularVelocity = Vector3.zero; m_hingeRB.maxAngularVelocity = 20f; HingeJoint val = m_hingeGO.GetComponent<HingeJoint>(); if ((Object)(object)val == (Object)null) { val = m_hingeGO.AddComponent<HingeJoint>(); ((Joint)val).axis = m_cachedAxis; ((Joint)val).anchor = m_cachedAnchor; ((Joint)val).autoConfigureConnectedAnchor = false; Vector3 val2 = Vector3.zero; if ((Object)(object)m_hingeOriginalParent != (Object)null) { Vector3 val3 = m_hingeOriginalParent.localPosition - m_hingeParentSeatedLocalPos; if (((Vector3)(ref val3)).sqrMagnitude > 0f) { Transform parent = m_hingeOriginalParent.parent; Vector3 val4 = ((!((Object)(object)parent != (Object)null)) ? val3 : parent.TransformVector(val3)); Transform val5 = ((!((Object)(object)m_cachedConnectedBody != (Object)null)) ? ((Component)this).transform : ((Component)m_cachedConnectedBody).transform); val2 = val5.InverseTransformVector(val4); } } ((Joint)val).connectedAnchor = m_cachedConnectedAnchor + val2; ((Joint)val).connectedBody = m_cachedConnectedBody; val.useLimits = true; Vector3 hingeAxisWorld; Vector3 closedDir; Vector3 openDir; float foldToUnfoldSign = GetFoldToUnfoldSign(out hingeAxisWorld, out closedDir, out openDir); float num = ((CurrentFoldState != FoldState.Folded) ? (0f - foldToUnfoldSign) : foldToUnfoldSign); JointLimits cachedLimits = m_cachedLimits; if (num > 0f) { ((JointLimits)(ref cachedLimits)).min = 0f; ((JointLimits)(ref cachedLimits)).max = base.HingeLimit; } else { ((JointLimits)(ref cachedLimits)).min = 0f - base.HingeLimit; ((JointLimits)(ref cachedLimits)).max = 0f; } val.limits = cachedLimits; val.useSpring = m_cachedUseSpring; if (m_cachedUseSpring) { val.spring = m_cachedSpring; } val.useMotor = m_cachedUseMotor; if (m_cachedUseMotor) { val.motor = m_cachedMotor; } } base.Hinge = val; m_isWelded = false; m_hasLeftStartZoneSinceSeparate = false; m_hasForeGripGrabOffset = false; if ((Object)(object)ForeGrip != (Object)null) { ForeGrip.Hinge = val; ForeGrip.RB = m_hingeRB; } if (isWelded) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)((CurrentFoldState != FoldState.Unfolded) ? 30 : 17), 1f); if (CurrentFoldState == FoldState.Unfolded) { BeginAutoCloseAction(); } } } private void SyncFoldDependentState() { //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) ((FVRInteractiveObject)this).QBPoseOverride = ((CurrentFoldState != FoldState.Folded || !((Object)(object)QBPoseOverride_Folded != (Object)null)) ? m_qbPoseOverrideDeployed : QBPoseOverride_Folded); ((FVRPhysicalObject)this).Size = GetCurrentSize(); } private void SyncBaseLatchState() { base.m_isLatched = IsDeployedAndLocked; base.m_isExternallyUnlatched = !base.m_isLatched; base.m_latchRot = 0f; base.IsLatchHeldOpen = !base.m_isLatched; } public void BeginHingeDrive() { if (!DebugDisableFolding && !((Object)(object)m_hingeGO == (Object)null) && m_isWelded) { SeparateBarrel(); } } private void BeginAutoCloseAction() { if (!IsActionOpen) { FinishAutoCloseAction(); } else { m_isAutoClosingAction = true; } } private void UpdateAutoCloseAction() { //IL_0077: 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) if (m_isAutoClosingAction) { m_curPumpPos = Mathf.MoveTowards(m_curPumpPos, 0f, Speed_Held * Time.deltaTime); m_curBoltPos = Mathf.Lerp(m_boltRange.x, m_boltRange.y, m_curPumpPos); if ((Object)(object)Bolt != (Object)null) { Bolt.localPosition = SetAxisComponent(Bolt.localPosition, BoltTravelAxis, m_curBoltPos); } DriveSleeve(); if (m_curPumpPos <= 0f) { FinishAutoCloseAction(); } } } private void FinishAutoCloseAction() { //IL_0055: 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) m_isAutoClosingAction = false; m_curPumpPos = 0f; m_curBoltPos = m_boltRange.x; m_hasReachedFore = true; m_carrierUp = false; LockHandle(); if ((Object)(object)Bolt != (Object)null) { Bolt.localPosition = SetAxisComponent(Bolt.localPosition, BoltTravelAxis, m_curBoltPos); } DriveSleeve(); } private FVRViveHand GetForeGripHand() { if ((Object)(object)ForeGrip == (Object)null) { return null; } if ((Object)(object)((FVRInteractiveObject)ForeGrip).m_hand != (Object)null) { return ((FVRInteractiveObject)ForeGrip).m_hand; } if (((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).savedGrip == (Object)(object)ForeGrip) { return ((FVRInteractiveObject)this).m_hand; } return null; } private void DriveForeGripSpring(FVRViveHand hand) { //IL_0057: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.Hinge == (Object)null || (Object)(object)m_hingeOriginalParent == (Object)null || (Object)(object)m_hingeRB == (Object)null) { return; } GetFoldToUnfoldSign(out var hingeAxisWorld, out var closedDir, out var openDir); Vector3 val = ((CurrentFoldState != FoldState.Folded) ? openDir : closedDir); Vector3 val2 = ((!((Object)(object)((Joint)base.Hinge).connectedBody != (Object)null)) ? ((Component)base.Hinge).transform.position : ((Component)((Joint)base.Hinge).connectedBody).transform.TransformPoint(((Joint)base.Hinge).connectedAnchor)); Vector3 val3 = Vector3.ProjectOnPlane(((HandInput)(ref hand.Input)).Pos - val2, hingeAxisWorld); if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f) { return; } Vector3 localAxis = TravelAxisVector((TravelAxis)FoldRotationAxis); Vector3 val4 = Vector3.ProjectOnPlane(m_hingeGO.transform.rotation * PickFoldReferenceAxis(localAxis), hingeAxisWorld); if (!(((Vector3)(ref val4)).sqrMagnitude < 0.0001f)) { JointLimits limits = base.Hinge.limits; float num = UnwrapNear(SignedAngleAbout(val, val4, hingeAxisWorld), (((JointLimits)(ref limits)).min + ((JointLimits)(ref limits)).max) * 0.5f); if (!m_hasForeGripGrabOffset) { m_foreGripGrabOffset = ((!ForeGripPreserveGrabOffset) ? 0f : SignedAngleAbout(val4, val3, hingeAxisWorld)); m_hasForeGripGrabOffset = true; } Vector3 to = ((!(Mathf.Abs(m_foreGripGrabOffset) > 0.001f)) ? val3 : (Quaternion.AngleAxis(0f - m_foreGripGrabOffset, hingeAxisWorld) * val3)); float num2 = SignedAngleAbout(val4, to, hingeAxisWorld); float num3 = Mathf.Max(0f, ForeGripMaxTrackSpeed) * Time.fixedDeltaTime; if (num3 > 0f) { num2 = Mathf.Clamp(num2, 0f - num3, num3); } float targetPosition = Mathf.Clamp(num + num2, ((JointLimits)(ref limits)).min, ((JointLimits)(ref limits)).max); float num4 = m_hingeRB.mass / 0.1f; JointSpring spring = base.Hinge.spring; spring.spring = ForeGripDriveSpring * num4; spring.damper = ForeGripDriveDamper * num4; spring.targetPosition = targetPosition; base.Hinge.useSpring = true; base.Hinge.spring = spring; CancelGravityAboutAxis(ForeGripGravityCompensation, val2, hingeAxisWorld); } } private void ApplyWhipAssist() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_0107: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_014b: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_02d5: 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) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) if (m_isWelded || (Object)(object)base.Hinge == (Object)null || (Object)(object)m_hingeRB == (Object)null || (Object)(object)((FVRPhysicalObject)this).RootRigidbody == (Object)null) { m_hasPivotVelSample = false; return; } Rigidbody rootRigidbody = ((FVRPhysicalObject)this).RootRigidbody; Vector3 val = ((!((Object)(object)((Joint)base.Hinge).connectedBody != (Object)null)) ? ((Component)base.Hinge).transform.TransformPoint(((Joint)base.Hinge).anchor) : ((Component)((Joint)base.Hinge).connectedBody).transform.TransformPoint(((Joint)base.Hinge).connectedAnchor)); Vector3 val2 = rootRigidbody.velocity + Vector3.Cross(rootRigidbody.angularVelocity, val - rootRigidbody.worldCenterOfMass); float fixedDeltaTime = Time.fixedDeltaTime; Vector3 val3 = Vector3.zero; if (m_hasPivotVelSample && fixedDeltaTime > 0f) { val3 = (val2 - m_lastPivotVel) / fixedDeltaTime; } m_lastPivotVel = val2; m_hasPivotVelSample = true; if (!((FVRInteractiveObject)this).IsHeld || (Object)(object)GetForeGripHand() != (Object)null) { return; } Vector3 val4 = ((Component)base.Hinge).transform.TransformDirection(((Joint)base.Hinge).axis); Vector3 normalized = ((Vector3)(ref val4)).normalized; Vector3 val5 = m_hingeRB.worldCenterOfMass - val; if (FreeSwingFriction > 0f) { float num = base.Hinge.velocity * ((float)Math.PI / 180f); m_hingeRB.AddTorque(normalized * ((0f - num) * FreeSwingFriction), (ForceMode)5); } if (WhipAssistGain <= 0f) { return; } Vector3 val6 = Vector3.Cross(val5, -val3 * m_hingeRB.mass); float num2 = Vector3.Dot(val6, normalized); m_hingeRB.AddTorque(normalized * num2 * WhipAssistGain, (ForceMode)0); if (!(WhipImpulse > 0f) || !((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) || !(Time.time - m_lastWhipImpulseTime > WhipImpulseCooldown)) { return; } Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld; float magnitude = ((Vector3)(ref velLinearWorld)).magnitude; float magnitude2 = ((Vector3)(ref val5)).magnitude; if (magnitude > WhipFlickSpeed && magnitude2 > 0.001f) { float num3 = Vector3.Dot(Vector3.Cross(val5, -velLinearWorld), normalized) / (magnitude2 * magnitude); if (Mathf.Abs(num3) > 0.3f) { m_lastWhipImpulseTime = Time.time; m_hingeRB.AddTorque(normalized * Mathf.Sign(num3) * WhipImpulse * ((float)Math.PI / 180f), (ForceMode)2); } } } private void CancelGravityAboutAxis(float amount, Vector3 pivotWorld, Vector3 axisWorld) { //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_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_0034: 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_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!(amount <= 0f) && !((Object)(object)m_hingeRB == (Object)null)) { Vector3 val = m_hingeRB.worldCenterOfMass - pivotWorld; Vector3 val2 = Vector3.Cross(val, Physics.gravity * m_hingeRB.mass); float num = Vector3.Dot(val2, axisWorld); m_hingeRB.AddTorque(axisWorld * ((0f - num) * amount), (ForceMode)0); } } private void ReleaseForeGripSpring() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.Hinge == (Object)null)) { base.Hinge.useSpring = m_cachedUseSpring; if (m_cachedUseSpring) { base.Hinge.spring = m_cachedSpring; } } } private bool IsHammerCocked() { return HasBarrel && m_isHammerCocked; } private Vector3 GetWorldRearDirection() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0030: Unknown result type (might be due to invalid IL or missing references) Vector3 val = PumpFrame.TransformDirection(TravelAxisVector(PumpTravelAxis) * m_directionSign); return ((Vector3)(ref val)).normalized; } private void RecordSleeveStart() { //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_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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!((Object)(object)Sleeve == (Object)null)) { Vector3 val = Sleeve.InverseTransformDirection(GetWorldRearDirection()) * (m_curPumpPos * m_strokeDistance); m_sleeveStartLocal = Sleeve.localPosition - val; m_sleeveInit = true; } } private void DriveSleeve() { //IL_0029: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Sleeve == (Object)null) && m_sleeveInit) { Sleeve.localPosition = m_sleeveStartLocal + Sleeve.InverseTransformDirection(GetWorldRearDirection()) * (m_curPumpPos * m_strokeDistance); } } private FVRViveHand GetBraceHand() { return (!((Object)(object)((FVRPhysicalObject)this).AltGrip == (Object)(object)ForeGrip) || !((Object)(object)ForeGrip != (Object)null) || !((Object)(object)((FVRInteractiveObject)ForeGrip).m_hand != (Object)(object)((FVRInteractiveObject)this).m_hand)) ? null : ((FVRInteractiveObject)ForeGrip).m_hand; } private float BraceHandTravel(FVRViveHand braceHand) { //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_001e: 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_0038: Unknown result type (might be due to invalid IL or missing references) Vector3 val = PumpFrame.TransformDirection(TravelAxisVector(PumpTravelAxis)); return Vector3.Dot(((HandInput)(ref braceHand.Input)).Pos - ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos, val); } private void UpdatePumpAction() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) FVRViveHand braceHand = GetBraceHand(); if ((Object)(object)braceHand != (Object)(object)m_lastBraceHand) { if ((Object)(object)braceHand != (Object)null) { m_handStartTravel = BraceHandTravel(braceHand); m_grabStartPumpPos = m_curPumpPos; } m_lastBraceHand = braceHand; } m_isPumpCycling = (Object)(object)braceHand != (Object)null && CurrentFoldState == FoldState.Unfolded && m_isWelded && m_curPumpPos > 0.05f; if ((Object)(object)braceHand == (Object)null || CurrentFoldState == FoldState.Folded || !m_isWelded) { if ((Object)(object)Bolt != (Object)null) { Bolt.localPosition = SetAxisComponent(Bolt.localPosition, BoltTravelAxis, m_curBoltPos); } DriveSleeve(); return; } if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && !m_cockButtonConsumed && IsSlideReleaseHeld(((FVRInteractiveObject)this).m_hand)) { UnlockHandle(); } if (m_isHandleLocked) { m_handStartTravel = BraceHandTravel(braceHand); m_grabStartPumpPos = m_curPumpPos; if ((Object)(object)Bolt != (Object)null) { Bolt.localPosition = SetAxisComponent(Bolt.localPosition, BoltTravelAxis, m_curBoltPos); } DriveSleeve(); return; } float num = BraceHandTravel(braceHand); float num2 = (m_handStartTravel - num) * m_directionSign; float num3 = num2 / Mathf.Max(0.0001f, m_strokeDistance); float num4 = Mathf.Clamp01(m_grabStartPumpPos + num3); m_curPumpPos = Mathf.MoveTowards(m_curPumpPos, num4, Speed_Held * Time.deltaTime); m_curBoltPos = Mathf.Lerp(m_boltRange.x, m_boltRange.y, m_curPumpPos); if ((Object)(object)Bolt != (Object)null) { Bolt.localPosition = SetAxisComponent(Bolt.localPosition, BoltTravelAxis, m_curBoltPos); } CheckPumpState(); DriveSleeve(); } private void ApplyPumpVelocityDamping() { //IL_0029: 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) if (m_isPumpCycling && !((Object)(object)((FVRPhysicalObject)this).RootRigidbody == (Object)null)) { Rigidbody rootRigidbody = ((FVRPhysicalObject)this).RootRigidbody; rootRigidbody.velocity *= 1f - PumpPositionDamping; } } private void CheckPumpState() { //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) bool flag = m_curPumpPos > m_lockT; if (flag && !m_wasPastLock) { EjectChamberShell(); if (HasBarrel && !m_isHammerCocked) { m_isHammerCocked = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } m_wasPastLock = flag; if (m_curPumpPos > 0.95f && !m_hasReachedRear) { m_hasReachedRear = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)1, 1f); bool flag2 = ((Object)(object)Chamber != (Object)null && Chamber.IsFull) || ((Object)(object)LifterChamber != (Object)null && LifterChamber.IsFull); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)((!flag2) ? 41 : 10), 1f); m_carrierUp = true; } else if (m_curPumpPos < 0.76f) { m_hasReachedRear = false; } bool hasReachedFore = m_hasReachedFore; if (m_curPumpPos < 0.05f && !hasReachedFore) { m_hasReachedFore = true; m_curPumpPos = 0f; m_curBoltPos = m_boltRange.x; if ((Object)(object)Bolt != (Object)null) { Bolt.localPosition = SetAxisComponent(Bolt.localPosition, BoltTravelAxis, m_curBoltPos); } bool flag3 = ((Object)(object)Chamber != (Object)null && Chamber.IsFull) || ((Object)(object)LifterChamber != (Object)null && LifterChamber.IsFull); if ((Object)(object)LifterChamber != (Object)null && LifterChamber.IsFull) { if ((Object)(object)Chamber != (Object)null && !Chamber.IsFull) { TransferLifterToChamber(); } else { ReturnLifterRoundToMagazine(); } } m_carrierUp = false; if (IsHammerCocked()) { LockHandle(); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)((!flag3) ? 40 : 11), 1f); } else if (m_curPumpPos > 0.15f && hasReachedFore) { m_hasReachedFore = false; RefillLifter(); } } private void RefillLifter() { //IL_00ba: 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) if (!((Object)(object)LifterChamber == (Object)null) && !LifterChamber.IsFull && !((Object)(object)((FVRFireArm)this).Magazine == (Object)null) && ((FVRFireArm)this).Magazine.HasARound()) { GameObject val = ((FVRFireArm)this).Magazine.RemoveRound(false); FVRFireArmRound val2 = ((!((Object)(object)val != (Object)null)) ? null : val.GetComponent<FVRFireArmRound>()); if ((Object)(object)val2 != (Object)null) { Transform val3 = ((!((Object)(object)((FVRFireArm)this).Magazine.RoundEjectionPos != (Object)null)) ? ((Component)((FVRFireArm)this).Magazine).transform : ((FVRFireArm)this).Magazine.RoundEjectionPos); LifterChamber.SetRound(val2, val3.position, val3.rotation); } } } private void TransferLifterToChamber() { //IL_0050: 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_0055: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d2: 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) FVRFireArmRound round = LifterChamber.GetRound(); if ((Object)(object)round != (Object)null) { Vector3 val = ((!((Object)(object)LifterChamber.ProxyRound != (Object)null)) ? ((Component)LifterChamber).transform.position : LifterChamber.ProxyRound.position); Quaternion val2 = ((!((Object)(object)LifterChamber.ProxyRound != (Object)null)) ? ((Component)LifterChamber).transform.rotation : LifterChamber.ProxyRound.rotation); Chamber.SetRound(round, val, val2); Chamber.m_animateToLerp = 1f; if ((Object)(object)Chamber.ProxyRound != (Object)null) { Chamber.ProxyRound.localPosition = Vector3.zero; Chamber.ProxyRound.localEulerAngles = Vector3.zero; } LifterChamber.SetRound((FVRFireArmRound)null, false); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)20, 1f); } else { LifterChamber.SetRound((FVRFireArmRound)null, false); } } private void ReturnLifterRoundToMagazine() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) FVRFireArmRound round = LifterChamber.GetRound(); if ((Object)(object)round != (Object)null && (Object)(object)((FVRFireArm)this).Magazine != (Object)null) { ((FVRFireArm)this).Magazine.AddRound(round.RoundClass, false, true); } LifterChamber.SetRound((FVRFireArmRound)null, false); } private void FireBurgess() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Chamber == (Object)null) && HasBarrel) { m_isHammerCocked = false; m_lastFireTime = Time.time; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); UnlockHandle(); if (Chamber.Fire()) { ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); } } } public override void FVRUpdate() { //IL_002a: 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) if (m_needsPreciseWeldSnap && (Object)(object)m_hingeGO != (Object)null) { m_hingeGO.transform.localPosition = m_weldedLocalPos; m_hingeGO.transform.localRotation = m_weldedLocalRot; m_needsPreciseWeldSnap = false; } ((FVRFireArm)this).FVRUpdate(); } public override void FVRFixedUpdate() { if (DebugDisableFolding) { CurrentFoldState = FoldState.Unfolded; if (!m_debugWasEnabled) { SnapHingeToFoldPose(FoldState.Unfolded); WeldBarrel(); } } m_debugWasEnabled = DebugDisableFolding; if (!m_isWelded && (Object)(object)base.Hinge == (Object)null && (Object)(object)m_hingeGO != (Object)null) { SeparateBarrel(); } SyncBaseLatchState(); SyncFoldDependentState(); bool flag = (Object)(object)base.Hinge == (Object)null && !base.m_isLatched && (Object)(object)m_decoyHinge != (Object)null; if (flag) { base.Hinge = m_decoyHinge; } ((BreakActionWeapon)this).FVRFixedUpdate(); if (flag && (Object)(object)base.Hinge == (Object)(object)m_decoyHinge) { base.Hinge = null; } m_unlatchRequested = m_primaryUnlatchHeld || ((Object)(object)ForeGrip != (Object)null && ForeGrip.IsUnlocked); if (m_unlatchRequested && !m_wasUnlatchRequested) { BeginHingeDrive(); } m_wasUnlatchRequested = m_unlatchRequested; FVRViveHand val = ((!((Object)(object)base.Hinge != (Object)null) || m_isWelded) ? null : GetForeGripHand()); if ((Object)(object)val != (Object)null) { DriveForeGripSpring(val); m_wasForeGripDriving = true; } else if (m_wasForeGripDriving) { ReleaseForeGripSpring(); m_wasForeGripDriving = false; m_hasForeGripGrabOffset = false; } ApplyWhipAssist(); UpdateAutoCloseAction(); CheckBarrelPosition(); UpdateFoldedEjection(); UpdatePumpAction(); ApplyPumpVelocityDamping(); UpdateHammerVisual(); UpdateChamberExtraction(); UpdateLifterFeed(); UpdateCarrier(); UpdateSlideBottom(); UpdateMagazineFollower(); UpdateChamberAccessibility(); UpdateLifterAccessibility(); UpdateMagazineAccessibility(); SyncBaseLatchState(); } private void UpdateCarrier() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Carrier == (Object)null)) { float num = ((!m_carrierUp) ? CarrierDownAngle : CarrierUpAngle); m_carrierCurrentAngle = Mathf.MoveTowards(m_carrierCurrentAngle, num, CarrierSnapSpeed * Time.deltaTime); Carrier.localRotation = m_carrierRestRotation * Quaternion.AngleAxis(m_carrierCurrentAngle, TravelAxisVector(CarrierRotationAxis)); } } private void UpdateSlideBottom() { //IL_0036: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)SlideBottom == (Object)null)) { float num = Mathf.Lerp(SlideBottomForwardAngle, SlideBottomRearAngle, CurrentPumpPos); SlideBottom.localRotation = m_slideBottomRestRotation * Quaternion.AngleAxis(num, Vector3.up); } } private void UpdateMagazineFollower() { //IL_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)MagazineFollower == (Object)null) && !((Object)(object)((FVRFireArm)this).Magazine == (Object)null)) { float num = Mathf.Clamp01((float)((FVRFireArm)this).Magazine.m_numRounds / (float)Mathf.Max(1, ((FVRFireArm)this).Magazine.m_capacity)); MagazineFollower.localPosition = Vector3.Lerp(MagazineFollowerEmptyPos, MagazineFollowerFullPos, num); ((Component)MagazineFollower).gameObject.SetActive(((FVRFireArm)this).Magazine.m_numRounds == 0); } } private float GetFoldAngle() { //IL_0028: 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) if ((Object)(object)base.Hinge == (Object)null) { return 0f; } return Quaternion.Angle(((Component)base.Hinge).transform.l