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;
using UnityEngine.Rendering;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public class Landstad : FVRFireArm
{
[Header("Landstad Params")]
public FVRFireArmChamber TopChamber;
public FVRFireArmChamber BottomChamber;
public GameObject Cylinder;
public GameObject CylinderActuator;
public float CylinderActuatorBasePosition;
public float CylinderActuatorFullyEngagedPosition;
private float m_cylinderAngle = 0f;
private bool m_hasFullyRotatedCylinder = false;
private float m_lastTriggerFloatCylinder;
[Header("Handgun Params")]
public LandstadSlide Slide;
public FVRFireArmChamber Chamber;
[Header("Component Connections")]
public Transform Trigger;
public Transform Safety;
public Transform Barrel;
public Transform Hammer;
public Transform FireSelector;
public Transform SlideRelease;
public GameObject ReloadTriggerWell;
[Header("Round Positions")]
public Transform RoundPos_Ejecting;
public Transform RoundPos_Ejection;
public Transform RoundPos_Magazine;
public Vector3 RoundEjectionSpeed;
public Vector3 RoundEjectionSpin;
private FVRFirearmMovingProxyRound m_proxy;
[Header("Trigger Params")]
public bool HasTrigger;
public InterpStyle TriggerInterp;
public Axis TriggerAxis;
public float TriggerUnheld;
public float TriggerHeld;
public float TriggerResetThreshold = 0.45f;
public float TriggerBreakThreshold = 0.85f;
public TriggerStyle TriggerType;
public float TriggerSpeed = 20f;
public bool HasManualDecocker;
private float m_triggerTarget;
private float m_triggerFloat;
private float m_lastTriggerFloat;
private bool m_isSeerReady = true;
[Header("Slide Release Params")]
public bool HasSlideRelease;
public bool HasSlideReleaseControl = true;
public InterpStyle SlideReleaseInterp;
public Axis SlideReleaseAxis;
public float SlideReleaseUp;
public float SlideReleaseDown;
public bool HasSlideLockFunctionality;
public float SlideLockRot;
private bool m_isSlideLockMechanismEngaged;
[Header("Safety Params")]
public bool HasSafety;
public bool HasSafetyControl = true;
public InterpStyle Safety_Interp;
public Axis SafetyAxis;
public float SafetyOff;
public float SafetyOn;
public bool DoesSafetyRequireSlideForward;
public bool DoesSafetyLockSlide;
public bool HasMagazineSafety;
public bool DoesSafetyRequireCockedHammer;
public bool DoesSafetyEngagingDecock;
public bool DoesSafetyDisengageCockHammer;
private bool m_isSafetyEngaged;
[Header("Hammer Params")]
public bool HasHammer;
public bool HasHammerControl = true;
public InterpStyle Hammer_Interp;
public Axis HammerAxis;
public float HammerForward;
public float HammerRearward;
private bool m_isHammerCocked;
private float m_hammerDALerp;
[Header("Barrel Params")]
public bool HasTiltingBarrel;
public InterpStyle BarrelInterp;
public Axis BarrelAxis;
public float BarrelUntilted;
public float BarrelTilted;
[Header("TransferBar Params")]
public bool HasTransferBar;
public bool TransferBarRequiresHammerCocked;
public Transform TransferBar;
public Vector3 TransferBarPoint1;
public Vector3 TransferBarPoint2;
[Header("TriggerSafety Params")]
public bool HasTriggerSafety;
public Transform TriggerSafety;
public InterpStyle TriggerSafetyInterp;
public Axis TriggerSafetyAxis;
public float TriggerSafetyUnpressed;
public float TriggerSafetyPressed;
[Header("Magazine Release Button")]
public bool HasMagReleaseButton;
public Transform MagazineReleaseButton;
public InterpStyle MagReleaseInterp;
public Axis MagReleaseAxis;
public float MagReleaseUnpressed;
public float MagReleasePressed;
[Header("FireSelector Params")]
public bool HasFireSelector;
public InterpStyle FireSelectorInterpStyle = (InterpStyle)1;
public Axis FireSelectorAxis;
public FireSelectorMode[] FireSelectorModes;
private int m_fireSelectorMode;
private int m_CamBurst;
private float m_engagementDelay;
[Header("Misc Control Vars")]
public bool HasMagReleaseInput = true;
[HideInInspector]
public bool IsSlideLockPushedUp;
[HideInInspector]
public bool IsSlideLockHeldDown;
[HideInInspector]
public bool IsMagReleaseHeldDown;
[HideInInspector]
public bool IsSafetyOn;
[HideInInspector]
public bool HasTriggerReset = true;
[HideInInspector]
public bool IsSlideLockUp;
[HideInInspector]
public bool IsSlideLockExternalPushedUp;
[HideInInspector]
public bool IsSlideLockExternalHeldDown;
public bool CanPhysicsSlideRack = true;
private HashSet<Collider> m_slideCols = new HashSet<Collider>();
private HashSet<Collider> m_unRackCols = new HashSet<Collider>();
private HeldTouchpadAction m_heldTouchpadAction;
private Vector2 TouchpadClickInitiation = Vector2.zero;
private float m_timeSinceFiredShot = 1f;
[Header("StupidFX")]
public List<ParticleSystem> PSystem_OnHammerDrop;
public List<int> PSystem_OnHammerDrop_Emit;
public List<ParticleSystem> PSystem_OnFire;
public List<int> PSystem_OnFire_Emit;
private float m_lastHammerVal;
private float m_lastBarrelVal;
private float m_lastSlideReleaseVal;
private float m_lastMagReleaseVal;
private Vector3 m_lastTBarVal = Vector3.zero;
public bool IsSLideLockMechanismEngaged => m_isSlideLockMechanismEngaged;
public bool IsSafetyEngaged => m_isSafetyEngaged;
public int FireSelectorModeIndex => m_fireSelectorMode;
public void NukeShadows()
{
m_proxy.NukeShadowCasting();
((Renderer)Chamber.ProxyRenderer).shadowCastingMode = (ShadowCastingMode)0;
}
public override void Awake()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
((FVRFireArm)this).Awake();
base.FChambers.Add(Chamber);
m_CamBurst = 1;
GameObject val = new GameObject("m_proxyRound");
m_proxy = val.AddComponent<FVRFirearmMovingProxyRound>();
m_proxy.Init(((Component)this).transform);
if (CanPhysicsSlideRack)
{
InitSlideCols();
}
if ((Object)(object)Chamber != (Object)null)
{
Chamber.Firearm = (FVRFireArm)(object)this;
}
}
private void InitSlideCols()
{
Transform[] componentsInChildren = ((Component)Slide).gameObject.GetComponentsInChildren<Transform>();
Transform[] array = componentsInChildren;
foreach (Transform val in array)
{
Collider component = ((Component)val).GetComponent<Collider>();
if ((Object)(object)component != (Object)null && !component.isTrigger)
{
m_slideCols.Add(component);
}
}
}
public void ResetCamBurst()
{
m_engagementDelay = 0f;
if (FireSelectorModes.Length > 0)
{
FireSelectorMode val = FireSelectorModes[m_fireSelectorMode];
m_CamBurst = val.BurstAmount;
}
}
public override void OnCollisionEnter(Collision c)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
if (((FVRInteractiveObject)this).IsHeld && CanPhysicsSlideRack && c.contacts.Length > 0 && m_slideCols.Contains(((ContactPoint)(ref c.contacts[0])).thisCollider) && !IsSLideLockMechanismEngaged && !m_isSafetyEngaged)
{
float num = Vector3.Angle(((Component)this).transform.forward, c.relativeVelocity);
if (num > 135f)
{
Vector3 relativeVelocity = c.relativeVelocity;
if (((Vector3)(ref relativeVelocity)).magnitude > 3f)
{
m_unRackCols.Add(c.collider);
Slide.KnockToRear();
}
}
}
((FVRPhysicalObject)this).OnCollisionEnter(c);
}
public void OnCollisionExit(Collision c)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (((FVRInteractiveObject)this).IsHeld && CanPhysicsSlideRack && m_unRackCols.Contains(c.collider))
{
Vector3 relativeVelocity = c.relativeVelocity;
if (((Vector3)(ref relativeVelocity)).magnitude > 3f)
{
IsSlideLockExternalHeldDown = true;
}
m_unRackCols.Clear();
}
}
public override int GetTutorialState()
{
if ((Object)(object)base.Magazine == (Object)null)
{
return 0;
}
if (m_isSafetyEngaged)
{
return 4;
}
if (Chamber.IsFull || Slide.GetSlideSpeed() > 0f || m_timeSinceFiredShot <= 0.25f)
{
return 2;
}
if (base.Magazine.HasARound())
{
return 1;
}
return 3;
}
public void EjectExtractedRound()
{
//IL_0029: 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_0044: 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_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_006f: 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_008f: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: 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_00ea: 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)
if (m_hasFullyRotatedCylinder && Chamber.IsFull)
{
Chamber.EjectRound(RoundPos_Ejection.position, ((Component)this).transform.right * RoundEjectionSpeed.x + ((Component)this).transform.up * RoundEjectionSpeed.y + ((Component)this).transform.forward * RoundEjectionSpeed.z, ((Component)this).transform.right * RoundEjectionSpin.x + ((Component)this).transform.up * RoundEjectionSpin.y + ((Component)this).transform.forward * RoundEjectionSpin.z, RoundPos_Ejection.position, RoundPos_Ejection.rotation, false);
}
if (m_hasFullyRotatedCylinder)
{
Chamber = ((!((Object)(object)Chamber == (Object)(object)TopChamber)) ? TopChamber : BottomChamber);
}
}
public void ExtractRound()
{
if (!((Object)(object)base.Magazine == (Object)null) && !m_proxy.IsFull && base.Magazine.HasARound())
{
GameObject fromPrefabReference = base.Magazine.RemoveRound(false);
m_proxy.SetFromPrefabReference(fromPrefabReference);
}
}
public bool ChamberRound()
{
if (m_proxy.IsFull && !Chamber.IsFull)
{
Chamber.SetRound(m_proxy.Round, false);
m_proxy.ClearProxy();
return true;
}
return false;
}
public bool CycleFireSelector()
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
m_engagementDelay = 0f;
if (FireSelectorModes.Length <= 1)
{
return false;
}
bool flag = true;
bool flag2 = true;
int fireSelectorMode = m_fireSelectorMode;
m_fireSelectorMode++;
if (m_fireSelectorMode >= FireSelectorModes.Length)
{
m_fireSelectorMode -= FireSelectorModes.Length;
}
if (HasSafety)
{
if ((int)FireSelectorModes[m_fireSelectorMode].ModeType == 3)
{
flag2 = SetSafetyState(s: true);
}
else
{
SetSafetyState(s: false);
}
}
if (!flag2)
{
flag = false;
m_fireSelectorMode = fireSelectorMode;
}
if (flag)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
}
if (FireSelectorModes.Length > 0)
{
FireSelectorMode val = FireSelectorModes[m_fireSelectorMode];
if (m_triggerFloat < 0.1f)
{
m_CamBurst = val.BurstAmount;
}
}
return true;
}
public bool SetFireSelectorByIndex(int i)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Invalid comparison between Unknown and I4
if (FireSelectorModes.Length <= 1)
{
return false;
}
m_fireSelectorMode = i;
if (m_fireSelectorMode >= FireSelectorModes.Length)
{
m_fireSelectorMode -= FireSelectorModes.Length;
}
if (HasSafety)
{
if ((int)FireSelectorModes[m_fireSelectorMode].ModeType == 3)
{
SetSafetyState(s: true);
}
else
{
SetSafetyState(s: false);
}
}
return true;
}
public bool ToggleSafety()
{
//IL_003d: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
if (!HasSafety)
{
return false;
}
if (DoesSafetyRequireSlideForward && (int)Slide.CurPos != 0)
{
return false;
}
if ((int)Slide.CurPos == 0 || (int)Slide.CurPos >= 2)
{
if (m_isSafetyEngaged)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)14, 1f);
m_isSafetyEngaged = false;
if (DoesSafetyDisengageCockHammer)
{
CockHammer(isManual: true);
}
}
else
{
bool flag = true;
if (DoesSafetyRequireCockedHammer && !m_isHammerCocked)
{
flag = false;
}
if (flag)
{
m_isSafetyEngaged = true;
if (DoesSafetyEngagingDecock)
{
DeCockHammer(isManual: true, isLoud: true);
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)14, 1f);
}
}
UpdateSafetyPos();
return true;
}
return false;
}
public bool SetSafetyState(bool s)
{
//IL_003d: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
if (!HasSafety)
{
return false;
}
if (DoesSafetyRequireSlideForward && (int)Slide.CurPos != 0)
{
return false;
}
if ((int)Slide.CurPos == 0 || (int)Slide.CurPos == 2)
{
if (m_isSafetyEngaged && !s)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)14, 1f);
m_isSafetyEngaged = false;
if (DoesSafetyDisengageCockHammer)
{
CockHammer(isManual: true);
}
UpdateSafetyPos();
return true;
}
if (!m_isSafetyEngaged && s)
{
bool flag = true;
if (DoesSafetyRequireCockedHammer && !m_isHammerCocked)
{
flag = false;
}
if (flag)
{
m_isSafetyEngaged = true;
if (DoesSafetyEngagingDecock)
{
DeCockHammer(isManual: true, isLoud: true);
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)14, 1f);
}
UpdateSafetyPos();
return true;
}
}
return false;
}
private void UpdateSafetyPos()
{
//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)
if (HasSafety)
{
float num = SafetyOff;
if (m_isSafetyEngaged)
{
num = SafetyOn;
}
((FVRPhysicalObject)this).SetAnimatedComponent(Safety, num, Safety_Interp, SafetyAxis);
}
}
public void ReleaseSeer()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Invalid comparison between Unknown and I4
HasTriggerReset = false;
if (m_isHammerCocked && m_isSeerReady)
{
if ((int)FireSelectorModes[m_fireSelectorMode].ModeType == 1 || ((int)FireSelectorModes[m_fireSelectorMode].ModeType == 4 && m_CamBurst < 1))
{
m_isSeerReady = false;
}
DropHammer(isManual: false);
}
}
public void CockHammer(bool isManual)
{
if (isManual && !m_isHammerCocked)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
}
m_isHammerCocked = true;
}
public void DeCockHammer(bool isManual, bool isLoud)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
if ((int)Slide.CurPos != 0)
{
return;
}
if (isManual && m_isHammerCocked)
{
if (isLoud)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
}
}
m_isHammerCocked = false;
}
public void DropSlideRelease()
{
if (IsSlideLockUp)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)8, 1f);
}
IsSlideLockUp = false;
}
public void EngageSlideRelease()
{
IsSlideLockUp = true;
}
private void EngageSlideLockMechanism()
{
if (!m_isSlideLockMechanismEngaged)
{
m_isSlideLockMechanismEngaged = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
}
}
private void DisEngageSlideLockMechanism()
{
if (m_isSlideLockMechanismEngaged)
{
m_isSlideLockMechanismEngaged = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
}
}
public bool IsSlideCatchEngaged()
{
return IsSlideLockUp;
}
public void DropHammer(bool isManual)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
if ((int)Slide.CurPos != 0 || !m_isHammerCocked)
{
return;
}
m_isHammerCocked = false;
if (m_CamBurst > 0)
{
m_CamBurst--;
}
if (PSystem_OnHammerDrop != null && PSystem_OnHammerDrop_Emit != null)
{
for (int i = 0; i < Mathf.Min(PSystem_OnHammerDrop.Count, PSystem_OnHammerDrop_Emit.Count); i++)
{
PSystem_OnHammerDrop[i].Emit(PSystem_OnHammerDrop_Emit[i]);
}
}
Fire();
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
}
public bool Fire()
{
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
if (!Chamber.Fire())
{
return false;
}
m_timeSinceFiredShot = 0f;
((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
((FVRFireArm)this).FireMuzzleSmoke();
bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag2 = ((FVRFireArm)this).IsForegripStabilized();
bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
float num = 1f;
float num2 = 1f;
if (m_isSlideLockMechanismEngaged)
{
num = 0.4f;
num2 = 1.5f;
}
if (PSystem_OnFire != null && PSystem_OnFire_Emit != null)
{
for (int i = 0; i < Mathf.Min(PSystem_OnFire.Count, PSystem_OnFire_Emit.Count); i++)
{
PSystem_OnFire[i].Emit(PSystem_OnFire_Emit[i]);
}
}
((FVRFireArm)this).Recoil(flag, flag2, flag3, ((FVRFireArm)this).GetRecoilProfile(), num2);
((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), num);
if (!IsSLideLockMechanismEngaged)
{
Slide.ImpartFiringImpulse();
}
return true;
}
public override void FVRUpdate()
{
((FVRFireArm)this).FVRUpdate();
if (m_engagementDelay > 0f)
{
m_engagementDelay -= Time.deltaTime;
}
UpdateComponents();
Slide.UpdateSlide();
UpdateDisplayRoundPositions();
if (m_timeSinceFiredShot < 1f)
{
m_timeSinceFiredShot += Time.deltaTime;
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).UpdateInteraction(hand);
UpdateInputAndAnimate(hand);
}
private void UpdateInputAndAnimate(FVRViveHand hand)
{
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Invalid comparison between Unknown and I4
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Invalid comparison between Unknown and I4
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0374: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Invalid comparison between Unknown and I4
//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_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Invalid comparison between Unknown and I4
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_0420: Invalid comparison between Unknown and I4
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: 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_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_051b: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Invalid comparison between Unknown and I4
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
//IL_044a: Invalid comparison between Unknown and I4
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Invalid comparison between Unknown and I4
//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
//IL_05d6: Invalid comparison between Unknown and I4
//IL_0538: Unknown result type (might be due to invalid IL or missing references)
//IL_0527: Unknown result type (might be due to invalid IL or missing references)
//IL_052d: Invalid comparison between Unknown and I4
//IL_0496: Unknown result type (might be due to invalid IL or missing references)
//IL_049c: Invalid comparison between Unknown and I4
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Invalid comparison between Unknown and I4
//IL_0460: 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_04cd: Unknown result type (might be due to invalid IL or missing references)
IsSlideLockHeldDown = false;
IsSlideLockPushedUp = false;
IsMagReleaseHeldDown = false;
if (((FVRPhysicalObject)this).IsAltHeld)
{
return;
}
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
if (m_engagementDelay <= 0f)
{
m_triggerTarget = hand.Input.TriggerFloat;
}
else
{
m_triggerTarget = 0f;
}
if (m_isHammerCocked && (int)TriggerType == 1)
{
m_triggerTarget = Mathf.Max(TriggerResetThreshold * 0.9f, hand.Input.TriggerFloat);
}
}
else if (m_isHammerCocked && (int)TriggerType == 1)
{
m_triggerTarget = TriggerResetThreshold * 0.9f;
}
else
{
m_triggerTarget = 0f;
}
if (m_triggerTarget > m_triggerFloat)
{
m_triggerFloat = Mathf.MoveTowards(m_triggerFloat, m_triggerTarget, Time.deltaTime * TriggerSpeed);
}
else
{
m_triggerFloat = Mathf.MoveTowards(m_triggerFloat, m_triggerTarget, Time.deltaTime * TriggerSpeed * 2f);
}
if (!HasTriggerReset && m_triggerFloat <= TriggerResetThreshold)
{
HasTriggerReset = true;
m_isSeerReady = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
if (FireSelectorModes.Length > 0)
{
m_CamBurst = FireSelectorModes[m_fireSelectorMode].BurstAmount;
}
}
if (hand.IsInStreamlinedMode)
{
if (hand.Input.AXButtonPressed)
{
IsMagReleaseHeldDown = true;
}
if (hand.Input.BYButtonDown)
{
m_heldTouchpadAction = (HeldTouchpadAction)0;
bool flag = true;
if (HasSlideReleaseControl && IsSlideCatchEngaged())
{
DropSlideRelease();
flag = false;
}
if (flag)
{
if (HasFireSelector)
{
CycleFireSelector();
}
else if (HasSafetyControl)
{
ToggleSafety();
}
}
}
}
else
{
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.Input.TouchpadDown)
{
TouchpadClickInitiation = touchpadAxes;
if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f)
{
if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
{
m_heldTouchpadAction = (HeldTouchpadAction)0;
if (HasFireSelector)
{
CycleFireSelector();
}
else if (HasSafetyControl)
{
ToggleSafety();
}
}
else if (Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
{
m_heldTouchpadAction = (HeldTouchpadAction)3;
}
else if (Vector2.Angle(touchpadAxes, Vector2.left) <= 45f && HasSlideRelease && HasSlideReleaseControl)
{
m_heldTouchpadAction = (HeldTouchpadAction)1;
}
else if (Vector2.Angle(touchpadAxes, Vector2.right) <= 45f && (int)TriggerType != 2 && HasHammerControl)
{
m_heldTouchpadAction = (HeldTouchpadAction)2;
}
}
}
if (hand.Input.TouchpadPressed)
{
if ((int)m_heldTouchpadAction == 3)
{
if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) <= 45f)
{
IsMagReleaseHeldDown = true;
}
}
else if ((int)m_heldTouchpadAction == 1)
{
if (touchpadAxes.y >= TouchpadClickInitiation.y + 0.05f)
{
IsSlideLockPushedUp = true;
}
else if (touchpadAxes.y <= TouchpadClickInitiation.y - 0.05f)
{
IsSlideLockHeldDown = true;
}
}
else if ((int)m_heldTouchpadAction == 2)
{
if (touchpadAxes.y <= TouchpadClickInitiation.y - 0.05f && (int)TriggerType != 2 && !m_isHammerCocked && (int)Slide.CurPos == 0)
{
CockHammer(isManual: true);
}
else if (touchpadAxes.y >= TouchpadClickInitiation.y + 0.05f && (int)TriggerType != 2 && m_isHammerCocked && (m_triggerFloat > 0.1f || HasManualDecocker) && (int)Slide.CurPos == 0)
{
DeCockHammer(isManual: true, isLoud: false);
}
}
}
if (hand.Input.TouchpadUp)
{
m_heldTouchpadAction = (HeldTouchpadAction)0;
}
}
if (m_triggerFloat >= TriggerBreakThreshold)
{
if (!m_isHammerCocked && ((int)TriggerType == 1 || (int)TriggerType == 2) && (int)Slide.CurPos == 0 && (!HasMagazineSafety || (Object)(object)base.Magazine != (Object)null))
{
if (m_hammerDALerp >= 1f && m_isSeerReady)
{
CockHammer(isManual: false);
}
}
else if (!m_isSafetyEngaged && (!HasMagazineSafety || (Object)(object)base.Magazine != (Object)null))
{
ReleaseSeer();
}
}
if (!m_isHammerCocked && !m_isSafetyEngaged && ((int)TriggerType == 1 || (int)TriggerType == 2) && (int)Slide.CurPos == 0 && m_isSeerReady)
{
float hammerDALerp = Mathf.InverseLerp(TriggerResetThreshold, TriggerBreakThreshold, m_triggerFloat);
m_hammerDALerp = hammerDALerp;
}
else
{
m_hammerDALerp = 0f;
}
if (IsMagReleaseHeldDown && HasMagReleaseInput)
{
if ((Object)(object)base.Magazine != (Object)null)
{
((FVRFireArm)this).EjectMag(false);
}
if ((Object)(object)ReloadTriggerWell != (Object)null)
{
ReloadTriggerWell.SetActive(false);
}
}
else if ((Object)(object)ReloadTriggerWell != (Object)null)
{
ReloadTriggerWell.SetActive(true);
}
}
public void ReleaseMag()
{
if ((Object)(object)base.Magazine != (Object)null)
{
((FVRFireArm)this).EjectMag(false);
}
}
private void UpdateComponents()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: 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_00ef: Invalid comparison between Unknown and I4
//IL_026d: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Invalid comparison between Unknown and I4
//IL_015f: 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_01f8: 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_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_067b: Unknown result type (might be due to invalid IL or missing references)
//IL_0680: Unknown result type (might be due to invalid IL or missing references)
//IL_0682: Unknown result type (might be due to invalid IL or missing references)
//IL_0685: Invalid comparison between Unknown and I4
//IL_072d: Unknown result type (might be due to invalid IL or missing references)
//IL_0732: Unknown result type (might be due to invalid IL or missing references)
//IL_0735: Unknown result type (might be due to invalid IL or missing references)
//IL_073a: Unknown result type (might be due to invalid IL or missing references)
//IL_073c: Unknown result type (might be due to invalid IL or missing references)
//IL_068b: Unknown result type (might be due to invalid IL or missing references)
//IL_046b: Unknown result type (might be due to invalid IL or missing references)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Invalid comparison between Unknown and I4
//IL_0744: Unknown result type (might be due to invalid IL or missing references)
//IL_0747: Invalid comparison between Unknown and I4
//IL_0693: Unknown result type (might be due to invalid IL or missing references)
//IL_0698: Unknown result type (might be due to invalid IL or missing references)
//IL_069b: Unknown result type (might be due to invalid IL or missing references)
//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0538: Unknown result type (might be due to invalid IL or missing references)
//IL_053d: Unknown result type (might be due to invalid IL or missing references)
//IL_0540: Unknown result type (might be due to invalid IL or missing references)
//IL_0545: Unknown result type (might be due to invalid IL or missing references)
//IL_0547: Unknown result type (might be due to invalid IL or missing references)
//IL_047b: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
//IL_074d: Unknown result type (might be due to invalid IL or missing references)
//IL_0750: Invalid comparison between Unknown and I4
//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
//IL_06ad: Invalid comparison between Unknown and I4
//IL_054f: Unknown result type (might be due to invalid IL or missing references)
//IL_0552: Invalid comparison between Unknown and I4
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_0496: Unknown result type (might be due to invalid IL or missing references)
//IL_0498: Unknown result type (might be due to invalid IL or missing references)
//IL_071e: Unknown result type (might be due to invalid IL or missing references)
//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
//IL_06b6: Invalid comparison between Unknown and I4
//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0558: Unknown result type (might be due to invalid IL or missing references)
//IL_055b: Invalid comparison between Unknown and I4
//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
//IL_04a3: Invalid comparison between Unknown and I4
//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0523: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04ac: Invalid comparison between Unknown and I4
//IL_0606: Unknown result type (might be due to invalid IL or missing references)
//IL_060c: Unknown result type (might be due to invalid IL or missing references)
//IL_0617: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_063e: Unknown result type (might be due to invalid IL or missing references)
//IL_0641: Unknown result type (might be due to invalid IL or missing references)
//IL_0626: Unknown result type (might be due to invalid IL or missing references)
//IL_062c: Unknown result type (might be due to invalid IL or missing references)
//IL_0636: Unknown result type (might be due to invalid IL or missing references)
//IL_063b: Unknown result type (might be due to invalid IL or missing references)
//IL_0928: Unknown result type (might be due to invalid IL or missing references)
//IL_092d: Unknown result type (might be due to invalid IL or missing references)
//IL_0947: Unknown result type (might be due to invalid IL or missing references)
//IL_094c: Unknown result type (might be due to invalid IL or missing references)
//IL_0955: 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_096a: Unknown result type (might be due to invalid IL or missing references)
//IL_0984: Unknown result type (might be due to invalid IL or missing references)
//IL_0989: Unknown result type (might be due to invalid IL or missing references)
//IL_0992: Unknown result type (might be due to invalid IL or missing references)
//IL_0999: Unknown result type (might be due to invalid IL or missing references)
//IL_0657: Unknown result type (might be due to invalid IL or missing references)
//IL_0659: Unknown result type (might be due to invalid IL or missing references)
//IL_0664: Unknown result type (might be due to invalid IL or missing references)
if ((int)Slide.CurPos < 2)
{
IsSlideLockUp = false;
}
else if (IsSlideLockPushedUp || IsSlideLockExternalPushedUp)
{
EngageSlideRelease();
}
else if ((IsSlideLockHeldDown || IsSlideLockExternalHeldDown) && (Object)(object)((FVRInteractiveObject)Slide).m_hand == (Object)null)
{
DropSlideRelease();
IsSlideLockExternalHeldDown = false;
}
IsSlideLockExternalHeldDown = false;
if (HasSlideLockFunctionality && (int)Slide.CurPos == 0)
{
if (IsSlideLockHeldDown)
{
EngageSlideLockMechanism();
}
else if (IsSlideLockPushedUp)
{
DisEngageSlideLockMechanism();
}
}
if (HasHammer)
{
float num = 0f;
TriggerStyle triggerType = TriggerType;
if ((int)triggerType == 0)
{
num = ((!m_isHammerCocked) ? (1f - Slide.GetSlideLerpBetweenLockAndFore()) : 1f);
}
else if ((int)triggerType == 1)
{
num = (m_isHammerCocked ? 1f : (((int)Slide.CurPos != 0) ? (1f - Slide.GetSlideLerpBetweenLockAndFore()) : m_hammerDALerp));
}
else if ((int)triggerType == 2)
{
num = (((int)Slide.CurPos != 0 || !m_isSeerReady) ? (1f - Slide.GetSlideLerpBetweenLockAndFore()) : m_hammerDALerp);
}
float num2 = Mathf.Lerp(HammerForward, HammerRearward, num);
if (Mathf.Abs(num2 - m_lastHammerVal) >= 1E-05f)
{
m_lastHammerVal = num2;
((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, num2, Hammer_Interp, HammerAxis);
}
}
if (HasTiltingBarrel)
{
float num3 = 1f - Slide.GetSlideLerpBetweenLockAndFore();
float num4 = Mathf.Lerp(BarrelUntilted, BarrelTilted, num3 * 4f);
if (Mathf.Abs(num4 - m_lastBarrelVal) >= 1E-05f)
{
m_lastBarrelVal = num4;
((FVRPhysicalObject)this).SetAnimatedComponent(Barrel, num4, BarrelInterp, BarrelAxis);
}
}
if (HasSlideRelease)
{
float num5 = 0f;
if (IsSlideLockUp)
{
num5 = 1f;
}
float num6 = SlideReleaseDown;
float num7 = SlideReleaseUp;
if (m_isSlideLockMechanismEngaged)
{
num6 = SlideLockRot;
num7 = SlideLockRot;
}
float num8 = Mathf.Lerp(num6, num7, num5);
if (Mathf.Abs(num8 - m_lastSlideReleaseVal) >= 1E-05f)
{
m_lastSlideReleaseVal = num8;
((FVRPhysicalObject)this).SetAnimatedComponent(SlideRelease, num8, SlideReleaseInterp, SlideReleaseAxis);
}
}
if (HasMagReleaseButton)
{
float num9 = 0f;
if (IsMagReleaseHeldDown && HasMagReleaseInput)
{
num9 = 1f;
}
float num10 = Mathf.Lerp(MagReleaseUnpressed, MagReleasePressed, num9);
if (Mathf.Abs(num10 - m_lastMagReleaseVal) >= 1E-05f)
{
m_lastMagReleaseVal = num10;
((FVRPhysicalObject)this).SetAnimatedComponent(MagazineReleaseButton, num10, MagReleaseInterp, MagReleaseAxis);
}
}
bool flag = false;
if (Mathf.Abs(m_triggerFloat - m_lastTriggerFloat) > 0.0001f)
{
m_lastTriggerFloat = m_triggerFloat;
flag = true;
}
if (HasTrigger && flag)
{
if (HasTriggerSafety)
{
if (m_triggerFloat < 0.2f)
{
((FVRPhysicalObject)this).SetAnimatedComponent(TriggerSafety, TriggerSafetyUnpressed, TriggerSafetyInterp, TriggerSafetyAxis);
}
else
{
float num11 = Mathf.InverseLerp(0.2f, 0.4f, m_triggerFloat);
((FVRPhysicalObject)this).SetAnimatedComponent(TriggerSafety, Mathf.Lerp(TriggerSafetyUnpressed, TriggerSafetyPressed, num11), TriggerSafetyInterp, TriggerSafetyAxis);
}
}
InterpStyle triggerInterp = TriggerInterp;
if ((int)triggerInterp != 1)
{
if ((int)triggerInterp == 0)
{
Vector3 localPosition = Trigger.localPosition;
Axis triggerAxis = TriggerAxis;
if ((int)triggerAxis != 0)
{
if ((int)triggerAxis != 1)
{
if ((int)triggerAxis == 2)
{
localPosition.z = Mathf.Lerp(TriggerUnheld, TriggerHeld, m_triggerFloat);
}
}
else
{
localPosition.y = Mathf.Lerp(TriggerUnheld, TriggerHeld, m_triggerFloat);
}
}
else
{
localPosition.x = Mathf.Lerp(TriggerUnheld, TriggerHeld, m_triggerFloat);
}
Trigger.localPosition = localPosition;
}
}
else
{
Vector3 localEulerAngles = Trigger.localEulerAngles;
Axis triggerAxis2 = TriggerAxis;
if ((int)triggerAxis2 != 0)
{
if ((int)triggerAxis2 != 1)
{
if ((int)triggerAxis2 == 2)
{
localEulerAngles.z = Mathf.Lerp(TriggerUnheld, TriggerHeld, m_triggerFloat);
}
}
else
{
localEulerAngles.y = Mathf.Lerp(TriggerUnheld, TriggerHeld, m_triggerFloat);
}
}
else
{
localEulerAngles.x = Mathf.Lerp(TriggerUnheld, TriggerHeld, m_triggerFloat);
}
Trigger.localEulerAngles = localEulerAngles;
}
if (HasTransferBar)
{
Vector3 lastTBarVal = m_lastTBarVal;
lastTBarVal = ((TransferBarRequiresHammerCocked && !m_isHammerCocked) ? Vector3.Lerp(TransferBarPoint1, TransferBarPoint2, 0f) : Vector3.Lerp(TransferBarPoint1, TransferBarPoint2, m_triggerFloat));
if (Vector3.Distance(lastTBarVal, m_lastTBarVal) > 0.0001f)
{
m_lastTBarVal = lastTBarVal;
TransferBar.localPosition = lastTBarVal;
}
}
}
if (HasFireSelector)
{
InterpStyle fireSelectorInterpStyle = FireSelectorInterpStyle;
if ((int)fireSelectorInterpStyle != 1)
{
if ((int)fireSelectorInterpStyle == 0)
{
Vector3 zero = Vector3.zero;
Axis fireSelectorAxis = FireSelectorAxis;
if ((int)fireSelectorAxis != 0)
{
if ((int)fireSelectorAxis != 1)
{
if ((int)fireSelectorAxis == 2)
{
zero.z = FireSelectorModes[m_fireSelectorMode].SelectorPosition;
}
}
else
{
zero.y = FireSelectorModes[m_fireSelectorMode].SelectorPosition;
}
}
else
{
zero.x = FireSelectorModes[m_fireSelectorMode].SelectorPosition;
}
FireSelector.localPosition = zero;
}
}
else
{
Vector3 zero2 = Vector3.zero;
Axis fireSelectorAxis2 = FireSelectorAxis;
if ((int)fireSelectorAxis2 != 0)
{
if ((int)fireSelectorAxis2 != 1)
{
if ((int)fireSelectorAxis2 == 2)
{
zero2.z = FireSelectorModes[m_fireSelectorMode].SelectorPosition;
}
}
else
{
zero2.y = FireSelectorModes[m_fireSelectorMode].SelectorPosition;
}
}
else
{
zero2.x = FireSelectorModes[m_fireSelectorMode].SelectorPosition;
}
FireSelector.localEulerAngles = zero2;
}
}
if ((Object)(object)Cylinder != (Object)null)
{
if (!m_hasFullyRotatedCylinder && m_triggerFloat >= TriggerBreakThreshold)
{
m_cylinderAngle += 180f;
m_hasFullyRotatedCylinder = true;
m_lastTriggerFloatCylinder = 0f;
}
float num15;
if (!m_hasFullyRotatedCylinder)
{
float cylinderAngle = m_cylinderAngle;
float num12 = m_cylinderAngle + 180f;
float num13 = ((!(m_triggerFloat > m_lastTriggerFloatCylinder)) ? m_lastTriggerFloatCylinder : m_triggerFloat);
float num14 = Mathf.InverseLerp(TriggerResetThreshold, TriggerBreakThreshold, num13);
num15 = Mathf.Lerp(cylinderAngle, num12, num14);
m_lastTriggerFloatCylinder = num13;
}
else
{
num15 = m_cylinderAngle;
}
if (m_hasFullyRotatedCylinder && m_triggerFloat <= TriggerResetThreshold)
{
m_hasFullyRotatedCylinder = false;
}
Cylinder.transform.localEulerAngles = new Vector3(0f, 0f, 0f - num15);
if ((Object)(object)CylinderActuator != (Object)null)
{
float num16 = ((!(m_triggerFloat > m_lastTriggerFloatCylinder)) ? m_lastTriggerFloatCylinder : m_triggerFloat);
CylinderActuator.transform.localPosition = Vector3.Lerp(new Vector3(CylinderActuator.transform.localPosition.x, CylinderActuatorBasePosition, CylinderActuator.transform.localPosition.z), new Vector3(CylinderActuator.transform.localPosition.x, CylinderActuatorFullyEngagedPosition, CylinderActuator.transform.localPosition.z), num16);
}
}
}
private void UpdateDisplayRoundPositions()
{
//IL_002f: 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_0045: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
float slideLerpBetweenLockAndFore = Slide.GetSlideLerpBetweenLockAndFore();
if (m_proxy.IsFull)
{
m_proxy.ProxyRound.position = Vector3.Lerp(RoundPos_Magazine.position, ((Component)Chamber).transform.position, slideLerpBetweenLockAndFore);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(RoundPos_Magazine.rotation, ((Component)Chamber).transform.rotation, slideLerpBetweenLockAndFore);
}
else if (m_hasFullyRotatedCylinder && Chamber.IsFull)
{
Chamber.ProxyRound.position = Vector3.Lerp(RoundPos_Ejecting.position, ((Component)Chamber).transform.position, slideLerpBetweenLockAndFore);
Chamber.ProxyRound.rotation = Quaternion.Slerp(RoundPos_Ejecting.rotation, ((Component)Chamber).transform.rotation, slideLerpBetweenLockAndFore);
}
if ((int)Slide.CurPos == 0)
{
Chamber.IsAccessible = false;
}
else
{
Chamber.IsAccessible = true;
}
}
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 override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
string empty = string.Empty;
string empty2 = string.Empty;
empty = "HammerState";
if (f.ContainsKey(empty))
{
empty2 = f[empty];
if (empty2 == "Cocked")
{
CockHammer(isManual: false);
}
}
if (HasSafety)
{
empty = "SafetyState";
if (f.ContainsKey(empty))
{
empty2 = f[empty];
if (empty2 == "On")
{
SetSafetyState(s: true);
}
}
}
if (HasFireSelector)
{
empty = "FireSelectorState";
if (f.ContainsKey(empty))
{
empty2 = f[empty];
int result = 0;
int.TryParse(empty2, out result);
SetFireSelectorByIndex(result);
}
}
UpdateComponents();
UpdateSafetyPos();
((FVRFireArm)this).ConfigureFromFlagDic(f);
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> flagDic = ((FVRFireArm)this).GetFlagDic();
string key = "HammerState";
string value = "Uncocked";
if (m_isHammerCocked)
{
value = "Cocked";
}
flagDic.Add(key, value);
if (HasSafety)
{
key = "SafetyState";
value = "Off";
if (m_isSafetyEngaged)
{
value = "On";
}
flagDic.Add(key, value);
}
if (HasFireSelector)
{
key = "FireSelectorState";
value = m_fireSelectorMode.ToString();
flagDic.Add(key, value);
}
return flagDic;
}
}
public class crazytest : MonoBehaviour
{
public static crazytest instance;
private void Start()
{
}
private void Update()
{
}
}
public class LandstadSlide : FVRInteractiveObject
{
public Landstad Landstad;
public float Speed_Forward;
public float Speed_Rearward;
public float Speed_Held;
public float SpringStiffness = 5f;
public SlidePos CurPos;
public SlidePos LastPos;
public Transform Point_Slide_Forward;
public Transform Point_Slide_LockPoint;
public Transform Point_Slide_Rear;
public bool HasLastRoundSlideHoldOpen = true;
private float m_curSlideSpeed;
private float m_slideZ_current;
private float m_slideZ_heldTarget;
private float m_slideZ_forward;
private float m_slideZ_lock;
private float m_slideZ_rear;
private float m_handZOffset;
public override void Awake()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).Awake();
m_slideZ_current = ((Component)this).transform.localPosition.z;
m_slideZ_forward = Point_Slide_Forward.localPosition.z;
m_slideZ_lock = Point_Slide_LockPoint.localPosition.z;
m_slideZ_rear = Point_Slide_Rear.localPosition.z;
}
public override bool IsInteractable()
{
return !Landstad.IsSLideLockMechanismEngaged && ((FVRInteractiveObject)this).IsInteractable();
}
public float GetSlideSpeed()
{
return m_curSlideSpeed;
}
public float GetSlideLerpBetweenLockAndFore()
{
return Mathf.InverseLerp(m_slideZ_lock, m_slideZ_forward, m_slideZ_current);
}
public float GetSlideLerpBetweenRearAndFore()
{
return Mathf.InverseLerp(m_slideZ_rear, m_slideZ_forward, m_slideZ_current);
}
public void ImpartFiringImpulse()
{
m_curSlideSpeed = Speed_Rearward;
}
public override void BeginInteraction(FVRViveHand hand)
{
//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)
((FVRInteractiveObject)this).BeginInteraction(hand);
if ((Object)(object)((FVRFireArm)Landstad).Clip != (Object)null)
{
((FVRFireArm)Landstad).EjectClip();
}
m_handZOffset = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z;
}
public override void EndInteraction(FVRViveHand hand)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)CurPos >= 2 && !Landstad.IsSlideLockUp)
{
((FVRFireArm)Landstad).PlayAudioEvent((FirearmAudioEventType)8, 1f);
}
((FVRInteractiveObject)this).EndInteraction(hand);
}
public void KnockToRear()
{
ImpartFiringImpulse();
}
public void UpdateSlide()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00bd: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Invalid comparison between Unknown and I4
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Invalid comparison between Unknown and I4
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: 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_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Expected I4, but got Unknown
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Expected I4, but got Unknown
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Invalid comparison between Unknown and I4
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Invalid comparison between Unknown and I4
//IL_037e: 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_03b5: Invalid comparison between Unknown and I4
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Invalid comparison between Unknown and I4
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_0420: Invalid comparison between Unknown and I4
//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Invalid comparison between Unknown and I4
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Invalid comparison between Unknown and I4
//IL_047a: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Invalid comparison between Unknown and I4
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Invalid comparison between Unknown and I4
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Invalid comparison between Unknown and I4
bool flag = false;
if (((FVRInteractiveObject)this).IsHeld)
{
flag = true;
}
if ((Landstad.DoesSafetyLockSlide && Landstad.IsSafetyEngaged) || Landstad.IsSLideLockMechanismEngaged)
{
return;
}
if (((FVRInteractiveObject)this).IsHeld)
{
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Slide_Forward.position, Point_Slide_Rear.position, ((HandInput)(ref base.m_hand.Input)).Pos + -((Component)this).transform.forward * m_handZOffset * ((Component)Landstad).transform.localScale.x);
m_slideZ_heldTarget = ((Component)Landstad).transform.InverseTransformPoint(closestValidPoint).z;
}
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(m_slideZ_rear, m_slideZ_forward);
if (m_slideZ_current <= m_slideZ_lock && Landstad.IsSlideCatchEngaged())
{
((Vector2)(ref val))..ctor(m_slideZ_rear, m_slideZ_lock);
}
if ((Object)(object)((FVRFireArm)Landstad).Clip != (Object)null)
{
((Vector2)(ref val))..ctor(m_slideZ_rear, m_slideZ_lock);
}
if (flag)
{
m_curSlideSpeed = 0f;
}
else if (((int)CurPos < 3 && m_curSlideSpeed >= 0f) || (int)LastPos >= 4)
{
m_curSlideSpeed = Mathf.MoveTowards(m_curSlideSpeed, Speed_Forward, Time.deltaTime * SpringStiffness);
}
float slideZ_current = m_slideZ_current;
float slideZ_current2 = m_slideZ_current;
if (flag)
{
slideZ_current2 = m_slideZ_heldTarget;
slideZ_current = Mathf.MoveTowards(m_slideZ_current, slideZ_current2, Speed_Held * Time.deltaTime);
}
else
{
slideZ_current = m_slideZ_current + m_curSlideSpeed * Time.deltaTime;
}
slideZ_current = Mathf.Clamp(slideZ_current, val.x, val.y);
if (Mathf.Abs(slideZ_current - m_slideZ_current) > Mathf.Epsilon)
{
m_slideZ_current = slideZ_current;
((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, m_slideZ_current);
}
else
{
m_curSlideSpeed = 0f;
}
SlidePos curPos = CurPos;
curPos = ((Mathf.Abs(m_slideZ_current - m_slideZ_forward) < 0.001f) ? ((SlidePos)0) : ((Mathf.Abs(m_slideZ_current - m_slideZ_lock) < 0.001f) ? ((SlidePos)2) : ((Mathf.Abs(m_slideZ_current - m_slideZ_rear) < 0.001f) ? ((SlidePos)4) : ((!(m_slideZ_current > m_slideZ_lock)) ? ((SlidePos)3) : ((SlidePos)1)))));
int num = (int)CurPos;
CurPos = (SlidePos)Mathf.Clamp((int)curPos, num - 1, num + 1);
if ((int)CurPos == 0 && (int)LastPos != 0)
{
SlideEvent_ArriveAtFore();
}
else if ((int)CurPos != 1 || (int)LastPos != 0)
{
if ((int)CurPos == 2 && (int)LastPos == 1)
{
SlideEvent_EjectRound();
}
else if ((int)CurPos == 1 && (int)LastPos == 2)
{
SlideEvent_ExtractRoundFromMag();
}
else if ((int)CurPos == 2 && (int)LastPos == 3)
{
SlideEvent_SlideCaught();
}
else if ((int)CurPos == 4 && (int)LastPos != 4)
{
SlideEvent_SmackRear();
}
}
if ((int)CurPos >= 2 && HasLastRoundSlideHoldOpen && (Object)(object)((FVRFireArm)Landstad).Magazine != (Object)null && !((FVRFireArm)Landstad).Magazine.HasARound() && !Landstad.IsSlideCatchEngaged())
{
Landstad.EngageSlideRelease();
}
LastPos = CurPos;
}
private void SlideEvent_ArriveAtFore()
{
Landstad.ChamberRound();
if (((FVRInteractiveObject)this).IsHeld)
{
((FVRFireArm)Landstad).PlayAudioEvent((FirearmAudioEventType)2, 1f);
}
else
{
((FVRFireArm)Landstad).PlayAudioEvent((FirearmAudioEventType)0, 1f);
}
}
private void SlideEvent_EjectRound()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
Landstad.EjectExtractedRound();
if ((int)Landstad.TriggerType != 2)
{
Landstad.CockHammer(isManual: false);
}
}
private void SlideEvent_ExtractRoundFromMag()
{
Landstad.ExtractRound();
}
private void SlideEvent_SmackRear()
{
Landstad.DropSlideRelease();
if (((FVRInteractiveObject)this).IsHeld)
{
((FVRFireArm)Landstad).PlayAudioEvent((FirearmAudioEventType)3, 1f);
}
else
{
((FVRFireArm)Landstad).PlayAudioEvent((FirearmAudioEventType)1, 1f);
}
}
private void SlideEvent_SlideCaught()
{
if (Landstad.IsSlideCatchEngaged())
{
((FVRFireArm)Landstad).PlayAudioEvent((FirearmAudioEventType)4, 1f);
}
}
}
namespace PrimeVR.Landstad;
[BepInPlugin("PrimeVR.Landstad", "Landstad", "1.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class LandstadPlugin : 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(), "PrimeVR.Landstad");
OtherLoader.RegisterDirectLoad(BasePath, "PrimeVR.Landstad", "", "primevr-landstad", "", "");
}
}
public class NitroString : MonoBehaviour
{
[Header("Anchors")]
public Transform rearAnchor;
public Transform frontAnchor;
[Tooltip("Length of the mesh in Unity units (Z axis)")]
public float meshLength = 0.32f;
private void LateUpdate()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)rearAnchor) && Object.op_Implicit((Object)(object)frontAnchor))
{
Vector3 position = rearAnchor.position;
Vector3 position2 = frontAnchor.position;
Vector3 val = position2 - position;
float magnitude = ((Vector3)(ref val)).magnitude;
if (!(magnitude < 0.0001f))
{
((Component)this).transform.position = position;
((Component)this).transform.rotation = Quaternion.LookRotation(val);
((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x, ((Component)this).transform.localScale.y, magnitude / meshLength);
}
}
}
}