using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace BitWizrd.HuntLongHand
{
[BepInPlugin("BitWizrd.HuntLongHand", "HuntLongHand", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HuntLongHandPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "BitWizrd.HuntLongHand");
OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntLongHand", "", "long hand", "", "");
}
}
}
namespace BitWizrd.Breech
{
public class BreechLoadingRifle : FVRFireArm
{
public enum BreechRifleState
{
HammerForward,
HammerBackBreechClosed,
HammerBackBreechOpen
}
[Header("Base Weapon Params")]
public FVRFireArmChamber Chamber;
public Transform Trigger;
public Vector2 TriggerRots;
public Transform Hammer;
public Vector2 HammerRots;
public Transform EjectPos;
[Header("Hammer Settings")]
public float hammerCockSpeed = 45f;
public float hammerCockDamping = 1.5f;
public float hammerReturnSpeed = 60f;
public float hammerReturnDamping = 2.5f;
public float hammerOvershoot = 4f;
public float hammerSnapThreshold = 4f;
public float hammerMaxVelocity = 1500f;
[Header("Breech Components")]
public Transform Breech;
public Vector2 BreechRots;
[Header("Breech Animation")]
public float openDuration = 0.15f;
public float closeDuration = 0.18f;
public float bounceBaseDuration = 0.3f;
public float bounceOvershootMin = 4f;
public float bounceOvershootMax = 6f;
public float bounceDamping = 3.5f;
public float bounceFrequency = 2.8f;
[Header("Interaction Settings")]
public Transform BreechInteractionPoint;
public float BreechInteractionDistance = 0.15f;
public bool UseSwipeToInteract = false;
public float SwipeInteractionDistance = 0.15f;
public float SwipeVelocityThreshold = 1f;
public float SwipeAngleThreshold = 60f;
[Header("Ejection Settings")]
public float forwardMultiplier = 1.2f;
public float rightMultiplier = 0.7f;
public float upMultiplier = 1.2f;
public float ejectForceMultiplier = 2f;
public float ejectUnfiredForceMultiplier = 2f;
public Vector2 ejectSpinRange = new Vector2(180f, 360f);
public bool bypassUnfiredEjection = false;
[Header("Trigger Hold Prevention Settings")]
public float TriggerBreakThreshold = 0.5f;
public float TriggerResetThreshold = 0.3f;
private BreechRifleState m_state;
private float m_curHammerRot;
private float m_tarHammerRot;
private float m_triggerVal;
private bool m_isPressedDown;
private float m_customCurBreechRot;
private Coroutine m_breechAnimation;
private float m_hammerVelocity;
private bool m_triggerWasHeldOnGrab = false;
public override void Awake()
{
//IL_005e: 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)
((FVRFireArm)this).Awake();
base.FChambers.Add(Chamber);
base.IsBreachOpenForGasOut = false;
m_state = BreechRifleState.HammerForward;
m_customCurBreechRot = BreechRots.x;
if ((Object)(object)Breech != (Object)null)
{
Breech.localEulerAngles = new Vector3(m_customCurBreechRot, 0f, 0f);
}
if ((Object)(object)Hammer != (Object)null)
{
Hammer.localEulerAngles = new Vector3(HammerRots.x, 0f, 0f);
}
}
public override void BeginInteraction(FVRViveHand hand)
{
((FVRFireArm)this).BeginInteraction(hand);
m_triggerWasHeldOnGrab = hand.Input.TriggerFloat >= TriggerBreakThreshold;
}
public override void FVRUpdate()
{
((FVRFireArm)this).FVRUpdate();
UpdateHammerPhysics();
UpdateBreechState();
UpdateTriggerVisuals();
}
private void UpdateHammerPhysics()
{
//IL_0063: 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)
if ((Object)(object)Hammer == (Object)null)
{
return;
}
float tarHammerRot = m_tarHammerRot;
float curHammerRot = m_curHammerRot;
float num = tarHammerRot - curHammerRot;
if (Mathf.Abs(num) < hammerSnapThreshold)
{
m_curHammerRot = tarHammerRot;
m_hammerVelocity = 0f;
Hammer.localEulerAngles = new Vector3(m_curHammerRot, 0f, 0f);
return;
}
float num2 = 0f;
float num3 = 1f;
if (m_state == BreechRifleState.HammerBackBreechClosed || m_state == BreechRifleState.HammerBackBreechOpen)
{
num2 = num * hammerCockSpeed * 3f;
num3 = 1f - hammerCockDamping * Time.deltaTime;
}
else
{
num2 = num * hammerReturnSpeed * 4f;
num3 = 1f - hammerReturnDamping * Time.deltaTime;
}
m_hammerVelocity += num2 * Time.deltaTime;
m_hammerVelocity = Mathf.Clamp(m_hammerVelocity, 0f - hammerMaxVelocity, hammerMaxVelocity);
m_hammerVelocity *= Mathf.Clamp01(num3);
m_curHammerRot += m_hammerVelocity * Time.deltaTime * 2f;
if ((m_state == BreechRifleState.HammerBackBreechClosed || m_state == BreechRifleState.HammerBackBreechOpen) && m_curHammerRot >= HammerRots.y + hammerOvershoot)
{
m_tarHammerRot = HammerRots.y;
}
Hammer.localEulerAngles = new Vector3(m_curHammerRot, 0f, 0f);
}
private void UpdateBreechState()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Breech != (Object)null)
{
Breech.localEulerAngles = new Vector3(m_customCurBreechRot, 0f, 0f);
}
}
private void UpdateTriggerVisuals()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Trigger != (Object)null)
{
float num = Mathf.Lerp(TriggerRots.x, TriggerRots.y, m_triggerVal);
Trigger.localEulerAngles = new Vector3(num, 0f, 0f);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
m_triggerVal = hand.Input.TriggerFloat;
if (m_triggerVal < TriggerResetThreshold)
{
m_triggerWasHeldOnGrab = false;
}
HandleInputControls(hand);
HandleHammerRelease(hand);
HandleSwipeInteractions(hand);
}
private void HandleInputControls(FVRViveHand hand)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown)
{
ClickUpward();
}
if (hand.Input.AXButtonDown)
{
ClickDownward();
}
}
else if (hand.Input.TouchpadDown)
{
if (touchpadAxes.y > 0f)
{
ClickUpward();
}
else
{
ClickDownward();
}
}
}
private void HandleHammerRelease(FVRViveHand hand)
{
if (m_state == BreechRifleState.HammerBackBreechClosed && hand.Input.TriggerDown && !m_triggerWasHeldOnGrab)
{
m_isPressedDown = false;
DropHammer();
m_state = BreechRifleState.HammerForward;
}
}
private void HandleSwipeInteractions(FVRViveHand hand)
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
if (!UseSwipeToInteract || (Object)(object)hand.OtherHand == (Object)null || !((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null || ((FVRFireArm)this).IsTwoHandStabilized())
{
return;
}
FVRViveHand otherHand = hand.OtherHand;
Vector3 velLinearWorld = otherHand.Input.VelLinearWorld;
float num = Vector3.Distance(BreechInteractionPoint.position, otherHand.PalmTransform.position);
if (num > SwipeInteractionDistance || ((Vector3)(ref velLinearWorld)).magnitude <= SwipeVelocityThreshold)
{
return;
}
float num2 = Vector3.Angle(velLinearWorld, -((Component)this).transform.forward);
float num3 = Vector3.Angle(velLinearWorld, ((Component)this).transform.forward);
if (num2 < SwipeAngleThreshold)
{
if (m_state == BreechRifleState.HammerForward)
{
CockHammerAction();
}
else if (m_state == BreechRifleState.HammerBackBreechOpen)
{
CloseBreechAction();
}
}
else if (num3 < SwipeAngleThreshold && m_state == BreechRifleState.HammerBackBreechClosed)
{
OpenBreechAction();
}
}
private void CockHammerAction()
{
CockHammer();
m_state = BreechRifleState.HammerBackBreechClosed;
}
private void CloseBreechAction()
{
CloseCustomBreech();
m_state = BreechRifleState.HammerBackBreechClosed;
}
private void OpenBreechAction()
{
OpenCustomBreech();
m_state = BreechRifleState.HammerBackBreechOpen;
}
private void ClickUpward()
{
switch (m_state)
{
case BreechRifleState.HammerBackBreechClosed:
m_state = BreechRifleState.HammerForward;
DecockHammer();
break;
case BreechRifleState.HammerBackBreechOpen:
m_state = BreechRifleState.HammerBackBreechClosed;
CloseCustomBreech();
break;
}
}
private void ClickDownward()
{
switch (m_state)
{
case BreechRifleState.HammerForward:
CockHammer();
m_state = BreechRifleState.HammerBackBreechClosed;
break;
case BreechRifleState.HammerBackBreechClosed:
OpenCustomBreech();
m_state = BreechRifleState.HammerBackBreechOpen;
break;
}
}
private void CockHammer()
{
m_tarHammerRot = HammerRots.y + hammerOvershoot;
m_hammerVelocity = 0f;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
}
private void DecockHammer()
{
m_tarHammerRot = HammerRots.x;
m_hammerVelocity = 0f;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
}
private void DropHammer()
{
m_tarHammerRot = HammerRots.x;
m_hammerVelocity = 0f;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
if ((Object)(object)Chamber != (Object)null && Chamber.IsFull)
{
Fire();
}
}
private void OpenCustomBreech()
{
if (m_breechAnimation != null)
{
((MonoBehaviour)this).StopCoroutine(m_breechAnimation);
}
m_breechAnimation = ((MonoBehaviour)this).StartCoroutine(AnimateBreechOpen());
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
if ((Object)(object)Chamber != (Object)null && Chamber.IsFull)
{
EjectRound();
}
base.IsBreachOpenForGasOut = true;
Chamber.IsAccessible = true;
}
private void CloseCustomBreech()
{
if (m_breechAnimation != null)
{
((MonoBehaviour)this).StopCoroutine(m_breechAnimation);
}
m_breechAnimation = ((MonoBehaviour)this).StartCoroutine(AnimateBreechClose());
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
base.IsBreachOpenForGasOut = false;
Chamber.IsAccessible = false;
}
private IEnumerator AnimateBreechOpen()
{
float elapsed = 0f;
float startAngle = m_customCurBreechRot;
float openAngle = BreechRots.y;
while (elapsed < openDuration)
{
elapsed += Time.deltaTime;
m_customCurBreechRot = Mathf.Lerp(startAngle, openAngle, elapsed / openDuration);
yield return null;
}
m_customCurBreechRot = openAngle;
float bounceTimer = 0f;
float amplitude = Random.Range(bounceOvershootMin, bounceOvershootMax);
float naturalFreq = bounceFrequency * (float)Math.PI * 2f;
float damping = bounceDamping * 0.5f;
float velocity = amplitude * naturalFreq;
float position = 0f;
while (bounceTimer < bounceBaseDuration)
{
bounceTimer += Time.deltaTime;
float acceleration = (0f - naturalFreq) * naturalFreq * position - damping * velocity;
velocity += acceleration * Time.deltaTime;
position += velocity * Time.deltaTime;
m_customCurBreechRot = openAngle + position * Mathf.Exp((0f - bounceDamping) * bounceTimer);
if (Mathf.Abs(position) < 0.5f && velocity < 5f && bounceTimer > bounceBaseDuration * 0.3f)
{
break;
}
yield return null;
}
m_customCurBreechRot = openAngle;
m_breechAnimation = null;
}
private IEnumerator AnimateBreechClose()
{
float elapsed = 0f;
float startAngle = m_customCurBreechRot;
float closeAngle = BreechRots.x;
while (elapsed < closeDuration)
{
elapsed += Time.deltaTime;
m_customCurBreechRot = Mathf.Lerp(startAngle, closeAngle, elapsed / closeDuration);
yield return null;
}
m_customCurBreechRot = closeAngle;
m_breechAnimation = null;
}
private void Fire()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
if (Chamber.Fire())
{
((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
((FVRFireArm)this).FireMuzzleSmoke();
((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f);
((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
}
}
public override List<FireArmRoundClass> GetChamberRoundList()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
object result;
if (Chamber.IsFull && !Chamber.IsSpent)
{
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
list.Add(Chamber.GetRound().RoundClass);
result = list;
}
else
{
result = null;
}
return (List<FireArmRoundClass>)result;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count > 0)
{
Chamber.Autochamber(rounds[0]);
}
}
private void EjectRound()
{
//IL_004d: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d1: 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)
if (!((Object)(object)Chamber == (Object)null) && Chamber.IsFull && (Chamber.IsSpent || !bypassUnfiredEjection))
{
Vector3 val = ((Component)this).transform.forward * forwardMultiplier + ((Component)this).transform.right * rightMultiplier + ((Component)this).transform.up * upMultiplier;
Vector3 normalized = ((Vector3)(ref val)).normalized;
float num = ((!Chamber.IsSpent) ? ejectUnfiredForceMultiplier : ejectForceMultiplier);
Chamber.EjectRound(((Component)this).transform.position, normalized * num, new Vector3(0f, 0f, Random.Range(ejectSpinRange.x, ejectSpinRange.y)), false);
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
}
}
}
public class LoadingBox : MonoBehaviour
{
public Transform LoadingGateObject;
public Vector3 StartRotation = Vector3.zero;
public Vector3 EndRotation;
private float curRot;
private float tarRot;
public float Range = 0.02f;
[Header("Animation")]
public float OpenCloseSpeed = 2f;
[Header("Physical Toggle")]
public bool AllowPhysicalToggle = false;
public float ToggleRange = 0.05f;
private bool isHandInRange = false;
private bool wasHandInRange = false;
[Header("Audio")]
public FVRFireArm FireArm;
private bool isOpen = false;
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
LoadingGateObject.localEulerAngles = StartRotation;
}
private void Update()
{
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
if (AllowPhysicalToggle)
{
CheckForHandToggle();
}
else
{
CheckForBulletProximity();
}
float num = curRot;
float num2 = OpenCloseSpeed * 2f * Time.deltaTime;
if (curRot != tarRot)
{
curRot = Mathf.MoveTowards(curRot, tarRot, num2);
}
if (num < 0.1f && curRot >= 0.1f && !isOpen)
{
if ((Object)(object)FireArm != (Object)null)
{
FireArm.PlayAudioEvent((FirearmAudioEventType)23, 1f);
}
isOpen = true;
}
else if (num > 0.9f && curRot <= 0.9f && isOpen)
{
if ((Object)(object)FireArm != (Object)null)
{
FireArm.PlayAudioEvent((FirearmAudioEventType)24, 1f);
}
isOpen = false;
}
LoadingGateObject.localEulerAngles = new Vector3(Mathf.Lerp(StartRotation.x, EndRotation.x, curRot), Mathf.Lerp(StartRotation.y, EndRotation.y, curRot), Mathf.Lerp(StartRotation.z, EndRotation.z, curRot));
}
private void CheckForBulletProximity()
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
float num = 1f;
if (!((Object)(object)GM.CurrentMovementManager != (Object)null))
{
return;
}
for (int i = 0; i < GM.CurrentMovementManager.Hands.Length; i++)
{
if ((Object)(object)GM.CurrentMovementManager.Hands[i] != (Object)null && (Object)(object)GM.CurrentMovementManager.Hands[i].CurrentInteractable != (Object)null && GM.CurrentMovementManager.Hands[i].CurrentInteractable is FVRFireArmRound)
{
float num2 = Vector3.Distance(((Component)GM.CurrentMovementManager.Hands[i].CurrentInteractable).transform.position, ((Component)this).transform.position);
if (num2 < num)
{
num = num2;
flag = true;
}
}
}
if (flag && num <= Range)
{
tarRot = 1f;
}
else
{
tarRot = 0f;
}
}
private void CheckForHandToggle()
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)GM.CurrentMovementManager != (Object)null))
{
return;
}
isHandInRange = false;
float num = ToggleRange + 0.1f;
for (int i = 0; i < GM.CurrentMovementManager.Hands.Length; i++)
{
FVRViveHand val = GM.CurrentMovementManager.Hands[i];
if (!((Object)(object)val != (Object)null))
{
continue;
}
float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position);
if (num2 < num)
{
num = num2;
if (num2 <= ToggleRange && val.Input.TriggerDown)
{
isHandInRange = true;
}
}
}
if (isHandInRange && !wasHandInRange)
{
tarRot = ((!(tarRot < 0.5f)) ? 0f : 1f);
}
wasHandInRange = isHandInRange;
}
}
public class Martini : FVRFireArm
{
public enum BreechRifleState
{
HammerForward,
HammerBackBreechClosed,
HammerBackBreechOpen
}
[Header("Chamber Settings")]
public FVRFireArmChamber Chamber;
[Header("Transform References")]
public Transform Trigger;
public Transform Hammer;
public Transform Breech;
public Transform Lever;
public Transform LeverRoot;
[Header("Alternate Grip")]
public FVRAlternateGrip AltGrip;
[Header("Hammer Settings")]
public Vector2 HammerRots;
public float hammerCockSpeed = 45f;
public float hammerReturnSpeed = 60f;
[Header("Trigger Settings")]
public Vector2 TriggerRots;
[Header("Breech Settings")]
public Vector2 BreechRots;
[Header("Lever Settings")]
public Vector2 LeverAngleRange;
public float leverSpeed = 900f;
public float LeverClosedTolerance = 0.5f;
[Header("Ejection Settings")]
public float EjectOffset = 0f;
public float EjectSpeed = 0f;
public bool bypassUnfiredEjection = false;
[Header("Auto Close Settings")]
public bool AutoCloseOnRegrab = true;
private BreechRifleState m_state;
private float m_tarHammerRot;
private float m_triggerVal;
private bool m_isHammerCocked;
private float leverProgress;
private float m_curLeverRot;
private float m_tarLeverRot;
private bool m_triggerWasHeldOnGrab;
private float m_rackingDisplacement;
private float m_lastHandZ;
private bool m_handZInitialized;
private bool m_wasBreechOpenOnRelease;
private float m_lastDistanceBetweenGrips = -1f;
public override void Awake()
{
((FVRFireArm)this).Awake();
base.FChambers.Add(Chamber);
m_tarLeverRot = LeverAngleRange.y;
m_curLeverRot = LeverAngleRange.y;
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).BeginInteraction(hand);
if (AutoCloseOnRegrab && m_wasBreechOpenOnRelease)
{
leverProgress = 0f;
m_rackingDisplacement = 0f;
m_tarLeverRot = LeverAngleRange.y;
m_state = BreechRifleState.HammerBackBreechClosed;
CloseCustomBreech();
m_wasBreechOpenOnRelease = false;
}
m_triggerWasHeldOnGrab = hand.Input.TriggerFloat > 0f;
if (Object.op_Implicit((Object)(object)LeverRoot))
{
m_lastHandZ = LeverRoot.InverseTransformPoint(hand.PalmTransform.position).z;
m_handZInitialized = true;
}
if ((Object)(object)AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)AltGrip).m_hand != (Object)null)
{
m_lastDistanceBetweenGrips = Vector3.Distance(hand.PalmTransform.position, ((FVRInteractiveObject)AltGrip).m_hand.PalmTransform.position);
}
else
{
m_lastDistanceBetweenGrips = -1f;
}
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRFireArm)this).EndInteraction(hand);
m_wasBreechOpenOnRelease = m_state == BreechRifleState.HammerBackBreechOpen;
m_handZInitialized = false;
m_lastDistanceBetweenGrips = -1f;
}
public override void FVRUpdate()
{
((FVRFireArm)this).FVRUpdate();
UpdateHammerPhysics();
UpdateTriggerVisuals();
}
public override void UpdateInteraction(FVRViveHand hand)
{
m_triggerVal = Mathf.Clamp(hand.Input.TriggerFloat, 0f, 1f);
if (m_triggerVal == 0f)
{
m_triggerWasHeldOnGrab = false;
}
HandleInputControls(hand);
HandleHammerRelease(hand);
if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
HandleLeverManualControl(hand);
}
}
public override void FVRFixedUpdate()
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).FVRFixedUpdate();
if (!m_isHammerCocked)
{
leverProgress = 0f;
m_rackingDisplacement = 0f;
m_tarLeverRot = LeverAngleRange.y;
}
m_curLeverRot = Mathf.MoveTowards(m_curLeverRot, m_tarLeverRot, leverSpeed * Time.deltaTime);
Lever.localEulerAngles = new Vector3(m_curLeverRot, 0f, 0f);
float num = (LeverAngleRange.y - m_curLeverRot) / (LeverAngleRange.y - LeverAngleRange.x);
num = Mathf.Clamp01(num);
if (Object.op_Implicit((Object)(object)Breech))
{
Breech.localEulerAngles = new Vector3(Mathf.Lerp(BreechRots.x, BreechRots.y, num), 0f, 0f);
}
base.IsBreachOpenForGasOut = (Object)(object)Chamber != (Object)null && Chamber.IsAccessible;
}
private bool IsLeverClosed()
{
float num = Mathf.Abs(m_curLeverRot - LeverAngleRange.y);
return num < LeverClosedTolerance;
}
private void HandleInputControls(FVRViveHand hand)
{
bool flag = false;
bool flag2 = false;
if (hand.IsInStreamlinedMode)
{
flag = hand.Input.BYButtonDown;
flag2 = hand.Input.AXButtonDown;
}
else if (hand.Input.TouchpadDown)
{
flag = hand.Input.TouchpadAxes.y > 0f;
flag2 = hand.Input.TouchpadAxes.y <= 0f;
}
if (flag)
{
HandleUpwardAction();
}
if (flag2)
{
HandleDownwardAction();
}
}
private void HandleUpwardAction()
{
if (m_state == BreechRifleState.HammerBackBreechOpen)
{
leverProgress = 0f;
m_rackingDisplacement = 0f;
m_tarLeverRot = LeverAngleRange.y;
m_state = BreechRifleState.HammerBackBreechClosed;
CloseCustomBreech();
}
else if (m_state == BreechRifleState.HammerBackBreechClosed)
{
m_state = BreechRifleState.HammerForward;
DecockHammer();
}
}
private void HandleDownwardAction()
{
if (!m_isHammerCocked)
{
CockHammer();
}
else if (m_state == BreechRifleState.HammerBackBreechClosed)
{
leverProgress = 1f;
m_rackingDisplacement = 0.04f;
m_tarLeverRot = LeverAngleRange.x;
m_state = BreechRifleState.HammerBackBreechOpen;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
Chamber.IsAccessible = true;
EjectRound();
}
}
private void HandleHammerRelease(FVRViveHand hand)
{
if (m_state == BreechRifleState.HammerBackBreechClosed && IsLeverClosed() && hand.Input.TriggerDown && !m_triggerWasHeldOnGrab)
{
DropHammer();
m_state = BreechRifleState.HammerForward;
}
}
private void HandleLeverManualControl(FVRViveHand hand)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if ((!((Object)(object)Chamber != (Object)null) || !Chamber.IsFull || Chamber.IsSpent || m_state != BreechRifleState.HammerBackBreechClosed) && m_isHammerCocked && !((Object)(object)AltGrip == (Object)null) && !((Object)(object)((FVRInteractiveObject)AltGrip).m_hand == (Object)null))
{
float num = Vector3.Distance(hand.PalmTransform.position, ((FVRInteractiveObject)AltGrip).m_hand.PalmTransform.position);
if (m_lastDistanceBetweenGrips < 0f)
{
m_lastDistanceBetweenGrips = num;
}
if (num < m_lastDistanceBetweenGrips)
{
float num2 = m_lastDistanceBetweenGrips - num;
m_rackingDisplacement += num2;
}
else
{
float num3 = num - m_lastDistanceBetweenGrips;
m_rackingDisplacement -= num3;
}
m_lastDistanceBetweenGrips = num;
m_rackingDisplacement = Mathf.Clamp(m_rackingDisplacement, 0f, 0.04f);
float num4 = Mathf.Clamp01(m_rackingDisplacement * 25f);
leverProgress = num4;
if (leverProgress >= 1f && m_state == BreechRifleState.HammerBackBreechClosed)
{
m_tarLeverRot = LeverAngleRange.x;
m_state = BreechRifleState.HammerBackBreechOpen;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
Chamber.IsAccessible = true;
EjectRound();
m_lastDistanceBetweenGrips = num;
}
else if (leverProgress <= 0f && m_state == BreechRifleState.HammerBackBreechOpen)
{
m_tarLeverRot = LeverAngleRange.y;
m_state = BreechRifleState.HammerBackBreechClosed;
CloseCustomBreech();
m_lastDistanceBetweenGrips = num;
}
}
}
private void UpdateHammerPhysics()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Hammer))
{
Quaternion val = Quaternion.Euler(m_tarHammerRot, 0f, 0f);
float num = ((!(m_tarHammerRot > Hammer.localEulerAngles.x)) ? hammerReturnSpeed : hammerCockSpeed);
Hammer.localRotation = Quaternion.RotateTowards(Hammer.localRotation, val, num * Time.deltaTime);
}
}
private void CockHammer()
{
m_tarHammerRot = HammerRots.x;
m_isHammerCocked = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
m_state = BreechRifleState.HammerBackBreechClosed;
}
private void DropHammer()
{
m_tarHammerRot = HammerRots.y;
m_isHammerCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
if (Chamber.IsFull)
{
Fire();
}
}
private void DecockHammer()
{
m_tarHammerRot = HammerRots.y;
m_isHammerCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
}
private void CloseCustomBreech()
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
Chamber.IsAccessible = false;
}
private void EjectRound()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Chamber == (Object)null) && Chamber.IsFull && (Chamber.IsSpent || !bypassUnfiredEjection))
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
Chamber.EjectRound(((Component)Chamber).transform.position + ((Component)Chamber).transform.forward * EjectOffset, ((Component)Chamber).transform.forward * EjectSpeed, Vector3.right, false);
}
}
private void Fire()
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
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)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 List<FireArmRoundClass> GetChamberRoundList()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (Chamber.IsFull && !Chamber.IsSpent)
{
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
list.Add(Chamber.GetRound().RoundClass);
return list;
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count > 0)
{
Chamber.Autochamber(rounds[0]);
}
}
private void UpdateTriggerVisuals()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Trigger))
{
float num = Mathf.Lerp(TriggerRots.x, TriggerRots.y, m_triggerVal);
Trigger.localEulerAngles = new Vector3(num, 0f, 0f);
}
}
}
public class MartiniHenry : FVRFireArm
{
public enum ZPos
{
Forward,
Middle,
Rear
}
private enum RoundAnimState
{
NotLoaded,
LoadedFromMag,
InLowerPath,
InUpperPath,
ReadyForChamber
}
[Serializable]
public class LeverActuatedPiece
{
public Transform Piece;
public Vector3 PosBack;
public Vector3 PosForward;
public InterpStyle InterpStyle;
public ActuationType ActuationType;
}
public enum ActuationType
{
Lever,
Hammer
}
private RoundAnimState m_roundAnimState = RoundAnimState.NotLoaded;
[Header("LeverAction Config")]
public FVRFireArmChamber Chamber;
public bool UsesSecondChamber;
public FVRFireArmChamber Chamber2;
public Transform SecondEjectionSpot;
public Transform SecondMuzzle;
private bool m_isHammerCocked2;
private bool m_isSecondaryMuzzlePos;
public Transform Lever;
public Transform LeverRoot;
public Transform Hammer;
public Transform LoadingGate;
public Transform Trigger;
public Vector2 TriggerRotRange;
public FVRAlternateGrip ForeGrip;
public Vector2 LeverAngleRange = new Vector2(-68f, 0f);
public Vector2 HammerAngleRange = new Vector2(-36f, 0f);
public Vector2 LoadingGateAngleRange = new Vector2(-24f, 0f);
public Vector3 EjectionDir = new Vector3(0f, 2f, 0f);
public Vector3 EjectionSpin = new Vector3(80f, 0f, 0f);
private bool m_isLeverReleasePressed;
private float m_curLeverRot;
private float m_tarLeverRot;
private float m_leverRotSpeed = 700f;
private bool m_isActionMovingForward;
private ZPos m_curLeverPos = ZPos.Rear;
private ZPos m_lastLeverPos = ZPos.Rear;
private FVRFirearmMovingProxyRound m_proxy;
private FVRFirearmMovingProxyRound m_proxy2;
[Header("Round Positions Config")]
public Transform ReceiverLowerPathForward;
public Transform ReceiverLowerPathRearward;
public Transform ReceiverUpperPathForward;
public Transform ReceiverUpperPathRearward;
public Transform ReceiverEjectionPathForward;
public Transform ReceiverEjectionPathRearward;
public Transform ReceiverEjectionPoint;
public bool GrabsRoundFromMagOnBoltForward;
private bool m_isHammerCocked;
[Header("Spinning Config")]
public Transform PoseSpinHolder;
public bool CanSpin;
private bool m_isSpinning;
public LeverActuatedPiece[] ActuatedPieces;
private bool useLinearRacking = true;
private float baseDistance = 1f;
private float BaseAngleOffset;
private bool m_wasLeverLocked;
private Vector3 m_baseSpinPosition = Vector3.zero;
private float curDistanceBetweenGrips = 1f;
private float lastDistanceBetweenGrips = -1f;
private float m_rackingDisplacement;
private float xSpinRot;
private float xSpinVel;
[Header("Lever Velocity Config")]
public float RequiredVelocityToOpen = 0.8f;
public float RequiredHandSeparation = 0.1f;
public float MaxWeaponTiltAngle = 60f;
public float MinLeverPullDistance = 0.05f;
public float MaxSyncVelocityThreshold = 0.4f;
private bool m_hasReachedVelocity;
private Vector3 m_lastMainHandPos;
private Vector3 m_lastForeHandPos;
private float m_handSeparationStart;
private bool m_isValidLeverPull;
private FVRViveHand m_lastAltGripHand;
[Header("Loading Box Animations")]
public bool UseLoadingBoxAnimations = false;
public Transform SideBoxHatch;
public Transform Kickout;
public Transform KickoutArm;
public Vector2 SideBoxHatchRotRange = new Vector2(0f, -45f);
public Vector2 KickoutRotRange = new Vector2(0f, 30f);
public Vector2 KickoutArmRotRange = new Vector2(0f, 45f);
public float BoxAnimationSpeed = 1f;
private float m_curSideBoxHatchRot = 0f;
private float m_curKickoutRot = 0f;
private float m_curKickoutArmRot = 0f;
private float m_boxAnimSpeed = 300f;
private bool m_isBoxAnimating = false;
private float m_boxAnimTimer = 0f;
private float m_boxAnimDuration = 1.5f;
public bool IsBreachOpenForGasOut { get; private set; }
public bool IsHammerCocked => m_isHammerCocked;
public override void Awake()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
((FVRFireArm)this).Awake();
base.FChambers.Add(Chamber);
if (UsesSecondChamber && (Object)(object)Chamber2 != (Object)null)
{
base.FChambers.Add(Chamber2);
}
GameObject val = new GameObject("m_proxyRound");
m_proxy = val.AddComponent<FVRFirearmMovingProxyRound>();
m_proxy.Init(((Component)this).transform);
if (UsesSecondChamber)
{
GameObject val2 = new GameObject("m_proxyRound2");
m_proxy2 = val2.AddComponent<FVRFirearmMovingProxyRound>();
m_proxy2.Init(((Component)this).transform);
}
m_baseSpinPosition = PoseSpinHolder.localPosition;
}
public override Transform GetMuzzle()
{
if (!UsesSecondChamber)
{
return ((FVRFireArm)this).GetMuzzle();
}
if (m_isSecondaryMuzzlePos)
{
return SecondMuzzle;
}
return base.MuzzlePos;
}
public override void BeginInteraction(FVRViveHand hand)
{
//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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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)
((FVRFireArm)this).BeginInteraction(hand);
SetBaseHandAngle(hand);
m_hasReachedVelocity = false;
m_isValidLeverPull = false;
m_lastMainHandPos = hand.PalmTransform.position;
if ((Object)(object)((FVRInteractiveObject)ForeGrip).m_hand != (Object)null)
{
m_lastForeHandPos = ((FVRInteractiveObject)ForeGrip).m_hand.PalmTransform.position;
m_handSeparationStart = Vector3.Distance(m_lastMainHandPos, m_lastForeHandPos);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Invalid comparison between Unknown and I4
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: 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_01b0: 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_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
bool flag = !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand != (Object)null;
bool flag2 = false;
if (flag && ((Object)(object)m_lastAltGripHand == (Object)null || (Object)(object)m_lastAltGripHand != (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand))
{
m_lastForeHandPos = ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position;
m_handSeparationStart = Vector3.Distance(hand.PalmTransform.position, m_lastForeHandPos);
m_hasReachedVelocity = false;
m_isValidLeverPull = false;
m_lastAltGripHand = ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand;
}
else if (!flag)
{
m_lastAltGripHand = null;
m_hasReachedVelocity = false;
m_isValidLeverPull = false;
}
if (flag)
{
if (((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Input.TriggerPressed && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hasTriggeredUpSinceBegin && (int)GM.Options.ControlOptions.LongGunSnipingAssist != 1)
{
flag2 = true;
}
if (m_curLeverPos == ZPos.Rear && !m_hasReachedVelocity)
{
Vector3 position = hand.PalmTransform.position;
Vector3 position2 = ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position;
float num = Vector3.Distance(position, position2);
Vector3 velLinearWorld = hand.Input.VelLinearWorld;
Vector3 velLinearWorld2 = ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Input.VelLinearWorld;
Vector3 val = velLinearWorld - velLinearWorld2;
float num2 = Vector3.Distance(velLinearWorld, velLinearWorld2);
float num3 = Vector3.Dot(((Vector3)(ref velLinearWorld)).normalized, ((Vector3)(ref velLinearWorld2)).normalized);
bool flag3 = num2 < MaxSyncVelocityThreshold && num3 > 0.9f;
Vector3 val2 = ((Component)this).transform.forward + ((Component)this).transform.up * -1.5f;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
float magnitude = ((Vector3)(ref val)).magnitude;
float num4 = Vector3.Dot(((Vector3)(ref val)).normalized, normalized);
bool flag4 = magnitude >= RequiredVelocityToOpen && num4 > 0.3f && !flag3;
bool flag5 = num >= RequiredHandSeparation;
if (flag4 && flag5)
{
m_hasReachedVelocity = true;
m_isValidLeverPull = true;
}
m_lastMainHandPos = position;
m_lastForeHandPos = position2;
}
}
else
{
m_hasReachedVelocity = false;
m_isValidLeverPull = false;
}
if (hand.Input.TriggerDown && !((FVRPhysicalObject)this).IsAltHeld && m_curLeverPos == ZPos.Rear && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && (m_isHammerCocked || m_isHammerCocked2))
{
m_hasReachedVelocity = false;
m_isValidLeverPull = false;
Fire();
}
if ((flag && (flag2 || m_isValidLeverPull || m_curLeverPos != ZPos.Rear)) || m_curLeverPos != ZPos.Rear)
{
UpdateLever();
}
Trigger.localEulerAngles = new Vector3(Mathf.Lerp(TriggerRotRange.x, TriggerRotRange.y, hand.Input.TriggerFloat), 0f, 0f);
float num5 = Mathf.InverseLerp(LeverAngleRange.y, LeverAngleRange.x, m_curLeverRot);
if ((Object)(object)Hammer != (Object)null)
{
if (m_isHammerCocked)
{
Hammer.localEulerAngles = new Vector3(HammerAngleRange.x, 0f, 0f);
}
else
{
Hammer.localEulerAngles = new Vector3(Mathf.Lerp(HammerAngleRange.y, HammerAngleRange.x, num5), 0f, 0f);
}
}
}
public override void EndInteraction(FVRViveHand hand)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
Trigger.localEulerAngles = new Vector3(0f, 0f, 0f);
m_hasReachedVelocity = false;
((FVRFireArm)this).EndInteraction(hand);
}
private void SetBaseHandAngle(FVRViveHand hand)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.ProjectOnPlane(((FVRInteractiveObject)this).m_hand.PoseOverride.forward, LeverRoot.right);
Vector3 normalized = ((Vector3)(ref val)).normalized;
Vector3 forward = LeverRoot.forward;
float baseAngleOffset = Mathf.Atan2(Vector3.Dot(LeverRoot.right, Vector3.Cross(forward, normalized)), Vector3.Dot(forward, normalized)) * 57.29578f;
BaseAngleOffset = baseAngleOffset;
}
private void UpdateLever()
{
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Invalid comparison between Unknown and I4
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_113b: Unknown result type (might be due to invalid IL or missing references)
//IL_0782: Unknown result type (might be due to invalid IL or missing references)
//IL_078d: Unknown result type (might be due to invalid IL or missing references)
//IL_079d: Unknown result type (might be due to invalid IL or missing references)
//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
//IL_07bd: Unknown result type (might be due to invalid IL or missing references)
//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
//IL_07dd: Unknown result type (might be due to invalid IL or missing references)
//IL_07e8: Unknown result type (might be due to invalid IL or missing references)
//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0803: Unknown result type (might be due to invalid IL or missing references)
//IL_0813: Unknown result type (might be due to invalid IL or missing references)
//IL_0818: Unknown result type (might be due to invalid IL or missing references)
//IL_0823: Unknown result type (might be due to invalid IL or missing references)
//IL_0833: Unknown result type (might be due to invalid IL or missing references)
//IL_0838: Unknown result type (might be due to invalid IL or missing references)
//IL_0843: Unknown result type (might be due to invalid IL or missing references)
//IL_084e: Unknown result type (might be due to invalid IL or missing references)
//IL_1168: Unknown result type (might be due to invalid IL or missing references)
//IL_1173: Unknown result type (might be due to invalid IL or missing references)
//IL_117a: Unknown result type (might be due to invalid IL or missing references)
//IL_1195: Unknown result type (might be due to invalid IL or missing references)
//IL_11a0: Unknown result type (might be due to invalid IL or missing references)
//IL_11a7: Unknown result type (might be due to invalid IL or missing references)
//IL_0cc0: Unknown result type (might be due to invalid IL or missing references)
//IL_0cdb: Unknown result type (might be due to invalid IL or missing references)
//IL_0d74: Unknown result type (might be due to invalid IL or missing references)
//IL_0d7f: Unknown result type (might be due to invalid IL or missing references)
//IL_0d86: Unknown result type (might be due to invalid IL or missing references)
//IL_0da1: Unknown result type (might be due to invalid IL or missing references)
//IL_0dac: Unknown result type (might be due to invalid IL or missing references)
//IL_0db3: Unknown result type (might be due to invalid IL or missing references)
//IL_0e61: Unknown result type (might be due to invalid IL or missing references)
//IL_0e6c: Unknown result type (might be due to invalid IL or missing references)
//IL_0e73: Unknown result type (might be due to invalid IL or missing references)
//IL_0e8e: Unknown result type (might be due to invalid IL or missing references)
//IL_0e99: Unknown result type (might be due to invalid IL or missing references)
//IL_0ea0: Unknown result type (might be due to invalid IL or missing references)
//IL_0f45: Unknown result type (might be due to invalid IL or missing references)
//IL_0f50: Unknown result type (might be due to invalid IL or missing references)
//IL_0f57: Unknown result type (might be due to invalid IL or missing references)
//IL_0f72: Unknown result type (might be due to invalid IL or missing references)
//IL_0f7d: Unknown result type (might be due to invalid IL or missing references)
//IL_0f84: Unknown result type (might be due to invalid IL or missing references)
//IL_0d12: Unknown result type (might be due to invalid IL or missing references)
//IL_0dea: Unknown result type (might be due to invalid IL or missing references)
//IL_0ed7: Unknown result type (might be due to invalid IL or missing references)
//IL_0fbb: Unknown result type (might be due to invalid IL or missing references)
//IL_11df: Unknown result type (might be due to invalid IL or missing references)
//IL_11ea: Unknown result type (might be due to invalid IL or missing references)
//IL_11f1: Unknown result type (might be due to invalid IL or missing references)
//IL_120c: Unknown result type (might be due to invalid IL or missing references)
//IL_1217: Unknown result type (might be due to invalid IL or missing references)
//IL_121e: Unknown result type (might be due to invalid IL or missing references)
//IL_1081: Unknown result type (might be due to invalid IL or missing references)
//IL_108c: Unknown result type (might be due to invalid IL or missing references)
//IL_1093: Unknown result type (might be due to invalid IL or missing references)
//IL_10ae: Unknown result type (might be due to invalid IL or missing references)
//IL_10b9: Unknown result type (might be due to invalid IL or missing references)
//IL_10c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0fe8: Unknown result type (might be due to invalid IL or missing references)
//IL_0ff3: Unknown result type (might be due to invalid IL or missing references)
//IL_0ffa: Unknown result type (might be due to invalid IL or missing references)
//IL_1015: Unknown result type (might be due to invalid IL or missing references)
//IL_1020: Unknown result type (might be due to invalid IL or missing references)
//IL_1027: Unknown result type (might be due to invalid IL or missing references)
//IL_08af: Unknown result type (might be due to invalid IL or missing references)
//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
//IL_08ea: Unknown result type (might be due to invalid IL or missing references)
//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0905: Unknown result type (might be due to invalid IL or missing references)
//IL_090a: Unknown result type (might be due to invalid IL or missing references)
//IL_0915: Unknown result type (might be due to invalid IL or missing references)
//IL_0925: Unknown result type (might be due to invalid IL or missing references)
//IL_0930: Unknown result type (might be due to invalid IL or missing references)
//IL_0940: Unknown result type (might be due to invalid IL or missing references)
//IL_0945: Unknown result type (might be due to invalid IL or missing references)
//IL_0950: Unknown result type (might be due to invalid IL or missing references)
//IL_0960: Unknown result type (might be due to invalid IL or missing references)
//IL_0965: Unknown result type (might be due to invalid IL or missing references)
//IL_0970: Unknown result type (might be due to invalid IL or missing references)
//IL_097b: Unknown result type (might be due to invalid IL or missing references)
//IL_10f7: Unknown result type (might be due to invalid IL or missing references)
//IL_105e: Unknown result type (might be due to invalid IL or missing references)
//IL_12c2: Unknown result type (might be due to invalid IL or missing references)
//IL_1321: Unknown result type (might be due to invalid IL or missing references)
//IL_132f: Unknown result type (might be due to invalid IL or missing references)
//IL_1336: Unknown result type (might be due to invalid IL or missing references)
//IL_12e4: Unknown result type (might be due to invalid IL or missing references)
//IL_12f2: Unknown result type (might be due to invalid IL or missing references)
//IL_12f9: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
bool flag2 = false;
if (((FVRInteractiveObject)this).IsHeld)
{
if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode)
{
flag = ((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed;
flag2 = ((FVRInteractiveObject)this).m_hand.Input.BYButtonUp;
}
else
{
flag = ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed;
flag2 = ((FVRInteractiveObject)this).m_hand.Input.TouchpadUp;
}
}
m_isLeverReleasePressed = false;
bool flag3 = false;
if (!((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRInteractiveObject)ForeGrip).m_hand != (Object)null)
{
if (((FVRInteractiveObject)ForeGrip).m_hand.Input.TriggerPressed && ((FVRInteractiveObject)ForeGrip).m_hasTriggeredUpSinceBegin && (int)GM.Options.ControlOptions.LongGunSnipingAssist != 1)
{
flag3 = true;
}
m_isLeverReleasePressed = true;
curDistanceBetweenGrips = Vector3.Distance(((FVRInteractiveObject)this).m_hand.PalmTransform.position, ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position);
if (lastDistanceBetweenGrips < 0f)
{
lastDistanceBetweenGrips = curDistanceBetweenGrips;
}
}
else
{
lastDistanceBetweenGrips = -1f;
}
m_isSpinning = false;
if (!((FVRPhysicalObject)this).IsAltHeld && CanSpin && flag)
{
m_isSpinning = true;
}
bool flag4 = false;
if ((m_isHammerCocked || m_isHammerCocked2) && !m_isSpinning && m_curLeverPos == ZPos.Rear)
{
flag4 = true;
}
if (flag3)
{
flag4 = false;
}
if ((Object)(object)((FVRPhysicalObject)this).AltGrip == (Object)null && !((FVRPhysicalObject)this).IsAltHeld)
{
flag4 = true;
}
if (flag4 && useLinearRacking)
{
SetBaseHandAngle(((FVRInteractiveObject)this).m_hand);
}
m_wasLeverLocked = flag4;
if (flag2)
{
m_tarLeverRot = 0f;
PoseSpinHolder.localPosition = m_baseSpinPosition;
lastDistanceBetweenGrips = curDistanceBetweenGrips;
m_rackingDisplacement = 0f;
}
else if (m_isLeverReleasePressed && !flag4)
{
if (useLinearRacking)
{
curDistanceBetweenGrips = Vector3.Distance(((FVRInteractiveObject)this).m_hand.PalmTransform.position, ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position);
float num = 0f;
if (curDistanceBetweenGrips < lastDistanceBetweenGrips)
{
num = lastDistanceBetweenGrips - curDistanceBetweenGrips;
m_rackingDisplacement += num;
}
else
{
num = curDistanceBetweenGrips - lastDistanceBetweenGrips;
m_rackingDisplacement -= num;
}
m_rackingDisplacement = Mathf.Clamp(m_rackingDisplacement, 0f, 0.04f);
if (m_rackingDisplacement < 0.005f)
{
m_rackingDisplacement = 0f;
}
if (m_rackingDisplacement > 0.035f)
{
m_rackingDisplacement = 0.04f;
}
PoseSpinHolder.localPosition = m_baseSpinPosition + Vector3.forward * m_rackingDisplacement * 2f;
m_tarLeverRot = Mathf.Lerp(LeverAngleRange.y, LeverAngleRange.x, m_rackingDisplacement * 25f);
lastDistanceBetweenGrips = curDistanceBetweenGrips;
}
else
{
Vector3 val = Vector3.ProjectOnPlane(((FVRInteractiveObject)this).m_hand.PoseOverride.forward, LeverRoot.right);
Vector3 normalized = ((Vector3)(ref val)).normalized;
Vector3 forward = LeverRoot.forward;
float num2 = Mathf.Atan2(Vector3.Dot(LeverRoot.right, Vector3.Cross(forward, normalized)), Vector3.Dot(forward, normalized)) * 57.29578f;
num2 -= BaseAngleOffset;
num2 *= 3f;
num2 = Mathf.Clamp(num2, LeverAngleRange.x, LeverAngleRange.y);
m_tarLeverRot = num2;
}
}
else if (m_isSpinning)
{
float num3 = Mathf.Clamp(((Vector3)(ref ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld)).magnitude - 1f, 0f, 3f);
float num4 = num3 * 120f;
float num5 = Mathf.Repeat(Mathf.Abs(xSpinRot), 360f);
num4 = Mathf.Clamp(num4, 0f, num5 * 0.5f);
m_tarLeverRot = Mathf.Clamp(0f - num4, LeverAngleRange.x, LeverAngleRange.y);
PoseSpinHolder.localPosition = m_baseSpinPosition;
}
if (Mathf.Abs(m_curLeverRot - LeverAngleRange.y) < 1f)
{
if (m_lastLeverPos == ZPos.Forward)
{
m_curLeverPos = ZPos.Middle;
}
else
{
m_curLeverPos = ZPos.Rear;
IsBreachOpenForGasOut = false;
}
}
else if (Mathf.Abs(m_curLeverRot - LeverAngleRange.x) < 1f)
{
if (m_lastLeverPos == ZPos.Rear)
{
m_curLeverPos = ZPos.Middle;
}
else
{
m_curLeverPos = ZPos.Forward;
IsBreachOpenForGasOut = true;
}
}
else
{
m_curLeverPos = ZPos.Middle;
IsBreachOpenForGasOut = true;
}
if (m_curLeverPos == ZPos.Rear && m_lastLeverPos != ZPos.Rear)
{
m_tarLeverRot = LeverAngleRange.y;
m_curLeverRot = LeverAngleRange.y;
if (m_isActionMovingForward && m_proxy.IsFull && !Chamber.IsFull)
{
((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_OnHoverInteractive);
Chamber.SetRound(m_proxy.Round, false);
m_proxy.ClearProxy();
m_roundAnimState = RoundAnimState.NotLoaded;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f);
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)41, 1f);
}
if (UsesSecondChamber && m_isActionMovingForward && m_proxy2.IsFull && !Chamber2.IsFull)
{
Chamber2.SetRound(m_proxy2.Round, false);
m_proxy2.ClearProxy();
}
m_isActionMovingForward = false;
}
else if (m_curLeverPos == ZPos.Forward && m_lastLeverPos != 0)
{
m_tarLeverRot = LeverAngleRange.x;
m_curLeverRot = LeverAngleRange.x;
m_isHammerCocked = true;
if (UsesSecondChamber)
{
m_isHammerCocked2 = true;
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
if (!m_isActionMovingForward && Chamber.IsFull)
{
((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_OnHoverInteractive);
Chamber.EjectRound(ReceiverEjectionPoint.position, ((Component)this).transform.right * EjectionDir.x + ((Component)this).transform.up * EjectionDir.y + ((Component)this).transform.forward * EjectionDir.z, ((Component)this).transform.right * EjectionSpin.x + ((Component)this).transform.up * EjectionSpin.y + ((Component)this).transform.forward * EjectionSpin.z, ReceiverEjectionPoint.position, ReceiverEjectionPoint.rotation, false);
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f);
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)40, 1f);
}
if (UsesSecondChamber && !m_isActionMovingForward && Chamber2.IsFull)
{
Chamber2.EjectRound(SecondEjectionSpot.position, ((Component)this).transform.right * EjectionDir.x + ((Component)this).transform.up * EjectionDir.y + ((Component)this).transform.forward * EjectionDir.z, ((Component)this).transform.right * EjectionSpin.x + ((Component)this).transform.up * EjectionSpin.y + ((Component)this).transform.forward * EjectionSpin.z, ReceiverEjectionPoint.position, ReceiverEjectionPoint.rotation, false);
}
m_isActionMovingForward = true;
}
else if (!GrabsRoundFromMagOnBoltForward && m_curLeverPos == ZPos.Middle && m_lastLeverPos == ZPos.Rear)
{
if ((Object)(object)base.Magazine != (Object)null && !m_proxy.IsFull && base.Magazine.HasARound())
{
GameObject fromPrefabReference = base.Magazine.RemoveRound(false);
m_proxy.SetFromPrefabReference(fromPrefabReference);
m_roundAnimState = RoundAnimState.LoadedFromMag;
TriggerLoadingBoxAnimation();
}
if (UsesSecondChamber && (Object)(object)base.Magazine != (Object)null && !m_proxy2.IsFull && base.Magazine.HasARound())
{
GameObject fromPrefabReference2 = base.Magazine.RemoveRound(false);
m_proxy2.SetFromPrefabReference(fromPrefabReference2);
TriggerLoadingBoxAnimation();
}
}
else if (GrabsRoundFromMagOnBoltForward && m_curLeverPos == ZPos.Middle && m_lastLeverPos == ZPos.Forward)
{
if ((Object)(object)base.Magazine != (Object)null && !m_proxy.IsFull && base.Magazine.HasARound())
{
GameObject fromPrefabReference3 = base.Magazine.RemoveRound(false);
m_proxy.SetFromPrefabReference(fromPrefabReference3);
m_roundAnimState = RoundAnimState.LoadedFromMag;
TriggerLoadingBoxAnimation();
}
if (UsesSecondChamber && (Object)(object)base.Magazine != (Object)null && !m_proxy2.IsFull && base.Magazine.HasARound())
{
GameObject fromPrefabReference4 = base.Magazine.RemoveRound(false);
m_proxy2.SetFromPrefabReference(fromPrefabReference4);
TriggerLoadingBoxAnimation();
}
}
float num6 = Mathf.InverseLerp(LeverAngleRange.y, LeverAngleRange.x, m_curLeverRot);
if (m_proxy.IsFull)
{
if (GrabsRoundFromMagOnBoltForward)
{
float num7 = Mathf.InverseLerp(LeverAngleRange.x, LeverAngleRange.y, m_curLeverRot);
if (Chamber.IsFull)
{
if (m_proxy.IsFull)
{
m_proxy.ClearProxy();
m_roundAnimState = RoundAnimState.NotLoaded;
}
}
else if (m_roundAnimState != RoundAnimState.ReadyForChamber)
{
if (num7 < 0.3f && m_roundAnimState == RoundAnimState.LoadedFromMag)
{
m_roundAnimState = RoundAnimState.InLowerPath;
}
else if (num7 >= 0.3f && num7 < 0.6f && m_roundAnimState == RoundAnimState.InLowerPath)
{
m_roundAnimState = RoundAnimState.InUpperPath;
}
else if (num7 >= 0.6f && num7 < 0.9f && m_roundAnimState == RoundAnimState.InUpperPath)
{
m_roundAnimState = RoundAnimState.ReadyForChamber;
}
}
}
switch (m_roundAnimState)
{
case RoundAnimState.LoadedFromMag:
m_proxy.ProxyRound.position = ReceiverLowerPathForward.position;
m_proxy.ProxyRound.rotation = ReceiverLowerPathForward.rotation;
if ((Object)(object)LoadingGate != (Object)null)
{
LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.y, 0f, 0f);
}
break;
case RoundAnimState.InLowerPath:
{
float num10 = Mathf.InverseLerp(LeverAngleRange.x, Mathf.Lerp(LeverAngleRange.x, LeverAngleRange.y, 0.3f), m_curLeverRot);
num10 = Mathf.Clamp01(num10);
m_proxy.ProxyRound.position = Vector3.Lerp(ReceiverLowerPathForward.position, ReceiverLowerPathRearward.position, num10);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(ReceiverLowerPathForward.rotation, ReceiverLowerPathRearward.rotation, num10);
if ((Object)(object)LoadingGate != (Object)null)
{
LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.y, 0f, 0f);
}
break;
}
case RoundAnimState.InUpperPath:
{
float num9 = Mathf.InverseLerp(Mathf.Lerp(LeverAngleRange.x, LeverAngleRange.y, 0.3f), Mathf.Lerp(LeverAngleRange.x, LeverAngleRange.y, 0.6f), m_curLeverRot);
num9 = Mathf.Clamp01(num9);
m_proxy.ProxyRound.position = Vector3.Lerp(ReceiverLowerPathRearward.position, ReceiverUpperPathRearward.position, num9);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(ReceiverLowerPathRearward.rotation, ReceiverUpperPathRearward.rotation, num9);
if ((Object)(object)LoadingGate != (Object)null)
{
LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.x, 0f, 0f);
}
break;
}
case RoundAnimState.ReadyForChamber:
{
float num8 = Mathf.InverseLerp(Mathf.Lerp(LeverAngleRange.x, LeverAngleRange.y, 0.6f), Mathf.Lerp(LeverAngleRange.x, LeverAngleRange.y, 0.9f), m_curLeverRot);
m_proxy.ProxyRound.position = Vector3.Lerp(ReceiverUpperPathRearward.position, ReceiverUpperPathForward.position, num8);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(ReceiverUpperPathRearward.rotation, ReceiverUpperPathForward.rotation, num8);
if ((Object)(object)LoadingGate != (Object)null)
{
LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.x, 0f, 0f);
}
break;
}
default:
if (m_isActionMovingForward)
{
m_proxy.ProxyRound.position = Vector3.Lerp(ReceiverUpperPathForward.position, ReceiverUpperPathRearward.position, num6);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(ReceiverUpperPathForward.rotation, ReceiverUpperPathRearward.rotation, num6);
if ((Object)(object)LoadingGate != (Object)null)
{
LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.x, 0f, 0f);
}
}
else
{
m_proxy.ProxyRound.position = Vector3.Lerp(ReceiverLowerPathForward.position, ReceiverLowerPathRearward.position, num6);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(ReceiverLowerPathForward.rotation, ReceiverLowerPathRearward.rotation, num6);
if ((Object)(object)LoadingGate != (Object)null)
{
LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.y, 0f, 0f);
}
}
break;
}
}
else if ((Object)(object)LoadingGate != (Object)null)
{
LoadingGate.localEulerAngles = new Vector3(LoadingGateAngleRange.y, 0f, 0f);
}
if (Chamber.IsFull)
{
Chamber.ProxyRound.position = Vector3.Lerp(ReceiverEjectionPathForward.position, ReceiverEjectionPathRearward.position, num6);
Chamber.ProxyRound.rotation = Quaternion.Slerp(ReceiverEjectionPathForward.rotation, ReceiverEjectionPathRearward.rotation, num6);
}
if (UsesSecondChamber && Chamber2.IsFull)
{
Chamber2.ProxyRound.position = Vector3.Lerp(ReceiverEjectionPathForward.position, ReceiverEjectionPathRearward.position, num6);
Chamber2.ProxyRound.rotation = Quaternion.Slerp(ReceiverEjectionPathForward.rotation, ReceiverEjectionPathRearward.rotation, num6);
}
if (m_curLeverPos != ZPos.Rear && !m_proxy.IsFull)
{
Chamber.IsAccessible = true;
}
else
{
Chamber.IsAccessible = false;
}
if (UsesSecondChamber)
{
if (m_curLeverPos != ZPos.Rear && !m_proxy2.IsFull)
{
Chamber2.IsAccessible = true;
}
else
{
Chamber2.IsAccessible = false;
}
}
for (int i = 0; i < ActuatedPieces.Length; i++)
{
if ((int)ActuatedPieces[i].InterpStyle == 0)
{
ActuatedPieces[i].Piece.localPosition = Vector3.Lerp(ActuatedPieces[i].PosBack, ActuatedPieces[i].PosForward, num6);
}
else
{
ActuatedPieces[i].Piece.localEulerAngles = Vector3.Lerp(ActuatedPieces[i].PosBack, ActuatedPieces[i].PosForward, num6);
}
}
m_lastLeverPos = m_curLeverPos;
}
private void Fire()
{
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
if (m_isHammerCocked)
{
m_isHammerCocked = false;
}
else if (m_isHammerCocked2)
{
m_isHammerCocked2 = false;
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
bool flag = false;
bool flag2 = true;
if (Chamber.Fire())
{
flag = true;
flag2 = true;
m_isSecondaryMuzzlePos = false;
}
else if (UsesSecondChamber && Chamber2.Fire())
{
flag = true;
flag2 = false;
m_isSecondaryMuzzlePos = true;
}
if (flag)
{
if (flag2)
{
((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
}
else
{
((FVRFireArm)this).Fire(Chamber2, SecondMuzzle, true, 1f, -1f);
}
((FVRFireArm)this).FireMuzzleSmoke();
bool flag3 = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag4 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
bool flag5 = ((FVRFireArm)this).IsShoulderStabilized();
((FVRFireArm)this).Recoil(flag3, flag4, flag5, (FVRFireArmRecoilProfile)null, 1f);
if (flag2)
{
((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
}
else
{
((FVRFireArm)this).PlayAudioGunShot(Chamber2.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
}
}
}
public override void FVRFixedUpdate()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).FVRFixedUpdate();
if (m_curLeverPos != ZPos.Rear || m_hasReachedVelocity)
{
m_curLeverRot = Mathf.MoveTowards(m_curLeverRot, m_tarLeverRot, m_leverRotSpeed * Time.deltaTime);
Lever.localEulerAngles = new Vector3(m_curLeverRot, 0f, 0f);
}
UpdateSpinning();
UpdateLoadingBoxAnimations();
}
private void UpdateSpinning()
{
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
if (!((FVRInteractiveObject)this).IsHeld || ((FVRPhysicalObject)this).IsAltHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
{
m_isSpinning = false;
}
if (m_isSpinning)
{
Vector3 val = Vector3.zero;
if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld;
}
float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)this).transform.up);
num = Mathf.Clamp(num, 0f - ((Vector3)(ref val)).magnitude, ((Vector3)(ref val)).magnitude);
if (Mathf.Abs(xSpinVel) < 90f)
{
xSpinVel += num * Time.deltaTime * 600f;
}
else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel))
{
xSpinVel += num * Time.deltaTime * 600f;
}
if (Mathf.Abs(xSpinVel) < 90f)
{
if (Vector3.Dot(((Component)this).transform.up, Vector3.down) >= 0f && Mathf.Sign(xSpinVel) == 1f)
{
xSpinVel += Time.deltaTime * 50f;
}
if (Vector3.Dot(((Component)this).transform.up, Vector3.down) < 0f && Mathf.Sign(xSpinVel) == -1f)
{
xSpinVel -= Time.deltaTime * 50f;
}
}
xSpinVel = Mathf.Clamp(xSpinVel, -200f, 200f);
xSpinRot += xSpinVel * Time.deltaTime * 5f;
PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f);
xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f);
}
else
{
xSpinRot = 0f;
xSpinVel = 0f;
PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f);
}
}
private void UpdateLoadingBoxAnimations()
{
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
if (UseLoadingBoxAnimations && !((Object)(object)SideBoxHatch == (Object)null) && !((Object)(object)Kickout == (Object)null) && m_isBoxAnimating)
{
m_boxAnimTimer += Time.deltaTime * BoxAnimationSpeed;
if (m_boxAnimTimer < 0.5f)
{
float num = m_boxAnimTimer / 0.5f;
m_curSideBoxHatchRot = Mathf.Lerp(SideBoxHatchRotRange.x, SideBoxHatchRotRange.y, num);
m_curKickoutRot = Mathf.Lerp(KickoutRotRange.x, KickoutRotRange.y, num);
m_curKickoutArmRot = Mathf.Lerp(KickoutArmRotRange.x, KickoutArmRotRange.y, num);
}
else if (m_boxAnimTimer < 1f)
{
m_curSideBoxHatchRot = SideBoxHatchRotRange.y;
m_curKickoutRot = KickoutRotRange.y;
m_curKickoutArmRot = KickoutArmRotRange.y;
}
else if (m_boxAnimTimer < m_boxAnimDuration)
{
float num2 = (m_boxAnimTimer - 1f) / 0.5f;
m_curSideBoxHatchRot = Mathf.Lerp(SideBoxHatchRotRange.y, SideBoxHatchRotRange.x, num2);
m_curKickoutRot = Mathf.Lerp(KickoutRotRange.y, KickoutRotRange.x, num2);
m_curKickoutArmRot = Mathf.Lerp(KickoutArmRotRange.y, KickoutArmRotRange.x, num2);
}
else
{
m_isBoxAnimating = false;
m_boxAnimTimer = 0f;
m_curSideBoxHatchRot = SideBoxHatchRotRange.x;
m_curKickoutRot = KickoutRotRange.x;
m_curKickoutArmRot = KickoutArmRotRange.x;
}
SideBoxHatch.localEulerAngles = new Vector3(SideBoxHatch.localEulerAngles.x, SideBoxHatch.localEulerAngles.y, m_curSideBoxHatchRot);
Kickout.localEulerAngles = new Vector3(Kickout.localEulerAngles.x, m_curKickoutRot, Kickout.localEulerAngles.z);
if ((Object)(object)KickoutArm != (Object)null)
{
KickoutArm.localEulerAngles = new Vector3(KickoutArm.localEulerAngles.x, m_curKickoutArmRot, KickoutArm.localEulerAngles.z);
}
}
}
private void TriggerLoadingBoxAnimation()
{
if (UseLoadingBoxAnimations && (Object)(object)SideBoxHatch != (Object)null && (Object)(object)Kickout != (Object)null && !m_isBoxAnimating && (Object)(object)base.Magazine != (Object)null && !Chamber.IsFull)
{
m_isBoxAnimating = true;
m_boxAnimTimer = 0f;
}
}
public override List<FireArmRoundClass> GetChamberRoundList()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (Chamber.IsFull && !Chamber.IsSpent)
{
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
list.Add(Chamber.GetRound().RoundClass);
return list;
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count > 0)
{
Chamber.Autochamber(rounds[0]);
}
}
}
public class Sparks : FVRFireArm
{
public enum BreechRifleState
{
HammerForward,
HammerBackBreechClosed,
HammerBackBreechOpen
}
[Header("Chamber Settings")]
public FVRFireArmChamber Chamber;
[Header("Transform References")]
public Transform Trigger;
public Transform Hammer;
public Transform Breech;
public Transform Lever;
public Transform LeverRoot;
public Transform BreechBlock;
[Header("Alternate Grip")]
public FVRAlternateGrip AltGrip;
[Header("Hammer Settings")]
public Vector2 HammerRots;
public float hammerCockSpeed = 45f;
public float hammerReturnSpeed = 60f;
[Header("Trigger Settings")]
public Vector2 TriggerRots;
[Header("Breech Settings")]
public Vector2 BreechRots;
public Vector3 BreechBlockPos_Up;
public Vector3 BreechBlockPos_Down;
[Header("Lever Settings")]
public Vector2 LeverAngleRange;
public float leverSpeed = 900f;
public float LeverClosedTolerance = 0.5f;
[Header("Ejection Settings")]
public float EjectOffset = 0f;
public float EjectSpeed = 0f;
public bool bypassUnfiredEjection = false;
[Header("Swipe Interaction Settings")]
public bool UseSwipeToInteract = true;
public float SwipeInteractionDistance = 0.5f;
public float SwipeVelocityThreshold = 1f;
public float SwipeAngleThreshold = 30f;
[Header("Auto Close Settings")]
public bool AutoCloseOnRegrab = true;
private BreechRifleState m_state;
private float m_tarHammerRot;
private float m_triggerVal;
private bool m_isHammerCocked;
private float leverProgress;
private float m_curLeverRot;
private float m_tarLeverRot;
private bool m_triggerWasHeldOnGrab;
private float m_rackingDisplacement;
private float m_lastHandZ;
private bool m_handZInitialized;
private bool m_wasBreechOpenOnRelease;
private float m_lastDistanceBetweenGrips = -1f;
public override void Awake()
{
((FVRFireArm)this).Awake();
base.FChambers.Add(Chamber);
m_tarLeverRot = LeverAngleRange.y;
m_curLeverRot = LeverAngleRange.y;
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).BeginInteraction(hand);
if (AutoCloseOnRegrab && m_wasBreechOpenOnRelease)
{
leverProgress = 0f;
m_rackingDisplacement = 0f;
m_tarLeverRot = LeverAngleRange.y;
m_state = BreechRifleState.HammerBackBreechClosed;
CloseCustomBreech();
m_wasBreechOpenOnRelease = false;
}
m_triggerWasHeldOnGrab = hand.Input.TriggerFloat > 0f;
if (Object.op_Implicit((Object)(object)LeverRoot))
{
m_lastHandZ = LeverRoot.InverseTransformPoint(hand.PalmTransform.position).z;
m_handZInitialized = true;
}
if ((Object)(object)AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)AltGrip).m_hand != (Object)null)
{
m_lastDistanceBetweenGrips = Vector3.Distance(hand.PalmTransform.position, ((FVRInteractiveObject)AltGrip).m_hand.PalmTransform.position);
}
else
{
m_lastDistanceBetweenGrips = -1f;
}
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRFireArm)this).EndInteraction(hand);
m_wasBreechOpenOnRelease = m_state == BreechRifleState.HammerBackBreechOpen;
m_handZInitialized = false;
m_lastDistanceBetweenGrips = -1f;
}
public override void FVRUpdate()
{
((FVRFireArm)this).FVRUpdate();
UpdateHammerPhysics();
UpdateTriggerVisuals();
}
public override void UpdateInteraction(FVRViveHand hand)
{
m_triggerVal = Mathf.Clamp(hand.Input.TriggerFloat, 0f, 1f);
if (m_triggerVal == 0f)
{
m_triggerWasHeldOnGrab = false;
}
HandleInputControls(hand);
HandleSwipeInteractions(hand);
HandleHammerRelease(hand);
if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
HandleLeverManualControl(hand);
}
}
public override void FVRFixedUpdate()
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: 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)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).FVRFixedUpdate();
if (!m_isHammerCocked)
{
leverProgress = 0f;
m_rackingDisplacement = 0f;
m_tarLeverRot = LeverAngleRange.y;
}
m_curLeverRot = Mathf.MoveTowards(m_curLeverRot, m_tarLeverRot, leverSpeed * Time.deltaTime);
Lever.localEulerAngles = new Vector3(m_curLeverRot, 0f, 0f);
float num = (LeverAngleRange.y - m_curLeverRot) / (LeverAngleRange.y - LeverAngleRange.x);
num = Mathf.Clamp01(num);
if (Object.op_Implicit((Object)(object)Breech))
{
Breech.localEulerAngles = new Vector3(Mathf.Lerp(BreechRots.x, BreechRots.y, num), 0f, 0f);
}
if (Object.op_Implicit((Object)(object)BreechBlock))
{
BreechBlock.localPosition = Vector3.Lerp(BreechBlockPos_Up, BreechBlockPos_Down, num);
}
base.IsBreachOpenForGasOut = (Object)(object)Chamber != (Object)null && Chamber.IsAccessible;
}
private bool IsLeverClosed()
{
float num = Mathf.Abs(m_curLeverRot - LeverAngleRange.y);
return num < LeverClosedTolerance;
}
private void HandleInputControls(FVRViveHand hand)
{
bool flag = false;
bool flag2 = false;
if (hand.IsInStreamlinedMode)
{
flag = hand.Input.BYButtonDown;
flag2 = hand.Input.AXButtonDown;
}
else if (hand.Input.TouchpadDown)
{
flag = hand.Input.TouchpadAxes.y > 0f;
flag2 = hand.Input.TouchpadAxes.y <= 0f;
}
if (flag)
{
HandleUpwardAction();
}
if (flag2)
{
HandleDownwardAction();
}
}
private void HandleUpwardAction()
{
if (m_state == BreechRifleState.HammerBackBreechOpen)
{
leverProgress = 0f;
m_rackingDisplacement = 0f;
m_tarLeverRot = LeverAngleRange.y;
m_state = BreechRifleState.HammerBackBreechClosed;
CloseCustomBreech();
}
else if (m_state == BreechRifleState.HammerBackBreechClosed)
{
m_state = BreechRifleState.HammerForward;
DecockHammer();
}
}
private void HandleDownwardAction()
{
if (!m_isHammerCocked)
{
CockHammer();
}
else if (m_state == BreechRifleState.HammerBackBreechClosed)
{
leverProgress = 1f;
m_rackingDisplacement = 0.04f;
m_tarLeverRot = LeverAngleRange.x;
m_state = BreechRifleState.HammerBackBreechOpen;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
Chamber.IsAccessible = true;
EjectRound();
}
}
private void HandleHammerRelease(FVRViveHand hand)
{
if (m_state == BreechRifleState.HammerBackBreechClosed && IsLeverClosed() && hand.Input.TriggerDown && !m_triggerWasHeldOnGrab)
{
DropHammer();
m_state = BreechRifleState.HammerForward;
}
}
private void HandleLeverManualControl(FVRViveHand hand)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if ((!((Object)(object)Chamber != (Object)null) || !Chamber.IsFull || Chamber.IsSpent || m_state != BreechRifleState.HammerBackBreechClosed) && m_isHammerCocked && !((Object)(object)AltGrip == (Object)null) && !((Object)(object)((FVRInteractiveObject)AltGrip).m_hand == (Object)null))
{
float num = Vector3.Distance(hand.PalmTransform.position, ((FVRInteractiveObject)AltGrip).m_hand.PalmTransform.position);
if (m_lastDistanceBetweenGrips < 0f)
{
m_lastDistanceBetweenGrips = num;
}
if (num < m_lastDistanceBetweenGrips)
{
float num2 = m_lastDistanceBetweenGrips - num;
m_rackingDisplacement += num2;
}
else
{
float num3 = num - m_lastDistanceBetweenGrips;
m_rackingDisplacement -= num3;
}
m_lastDistanceBetweenGrips = num;
m_rackingDisplacement = Mathf.Clamp(m_rackingDisplacement, 0f, 0.04f);
float num4 = Mathf.Clamp01(m_rackingDisplacement * 25f);
leverProgress = num4;
if (leverProgress >= 1f && m_state == BreechRifleState.HammerBackBreechClosed)
{
m_tarLeverRot = LeverAngleRange.x;
m_state = BreechRifleState.HammerBackBreechOpen;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
Chamber.IsAccessible = true;
EjectRound();
m_lastDistanceBetweenGrips = num;
}
else if (leverProgress <= 0f && m_state == BreechRifleState.HammerBackBreechOpen)
{
m_tarLeverRot = LeverAngleRange.y;
m_state = BreechRifleState.HammerBackBreechClosed;
CloseCustomBreech();
m_lastDistanceBetweenGrips = num;
}
}
}
private void UpdateHammerPhysics()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Hammer))
{
Quaternion val = Quaternion.Euler(m_tarHammerRot, 0f, 0f);
float num = ((!(m_tarHammerRot > Hammer.localEulerAngles.x)) ? hammerReturnSpeed : hammerCockSpeed);
Hammer.localRotation = Quaternion.RotateTowards(Hammer.localRotation, val, num * Time.deltaTime);
}
}
private void CockHammer()
{
m_tarHammerRot = HammerRots.x;
m_isHammerCocked = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
m_state = BreechRifleState.HammerBackBreechClosed;
}
private void DropHammer()
{
m_tarHammerRot = HammerRots.y;
m_isHammerCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
if (Chamber.IsFull)
{
Fire();
}
}
private void DecockHammer()
{
m_tarHammerRot = HammerRots.y;
m_isHammerCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
}
private void CloseCustomBreech()
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
Chamber.IsAccessible = false;
}
private void EjectRound()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Chamber == (Object)null) && Chamber.IsFull && (Chamber.IsSpent || !bypassUnfiredEjection))
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
Chamber.EjectRound(((Component)Chamber).transform.position + ((Component)Chamber).transform.forward * EjectOffset, ((Component)Chamber).transform.forward * EjectSpeed, Vector3.right, false);
}
}
private void Fire()
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
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)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 List<FireArmRoundClass> GetChamberRoundList()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (Chamber.IsFull && !Chamber.IsSpent)
{
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
list.Add(Chamber.GetRound().RoundClass);
return list;
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count > 0)
{
Chamber.Autochamber(rounds[0]);
}
}
private void UpdateTriggerVisuals()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Trigger))
{
float num = Mathf.Lerp(TriggerRots.x, TriggerRots.y, m_triggerVal);
Trigger.localEulerAngles = new Vector3(num, 0f, 0f);
}
}
private void HandleSwipeInteractions(FVRViveHand hand)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
if (!UseSwipeToInteract || (Object)(object)hand.OtherHand == (Object)null || !((FVRInteractiveObject)this).IsHeld || ((FVRFireArm)this).IsTwoHandStabilized())
{
return;
}
FVRViveHand otherHand = hand.OtherHand;
Vector3 velLinearWorld = otherHand.Input.VelLinearWorld;
float num = Vector3.Distance(Hammer.position, otherHand.PalmTransform.position);
if (!(num > SwipeInteractionDistance) && !(((Vector3)(ref velLinearWorld)).magnitude <= SwipeVelocityThreshold))
{
float num2 = Vector3.Angle(velLinearWorld, -((Component)this).transform.forward);
if (num2 < SwipeAngleThreshold && m_state == BreechRifleState.HammerForward)
{
CockHammer();
}
}
}
}
}