using System;
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 nootarc.Trepang2_Bolt_Launcher
{
[BepInPlugin("nootarc.Trepang2_Bolt_Launcher", "Trepang2_Bolt_Launcher", "1.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Trepang2_Bolt_LauncherPlugin : 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(), "nootarc.Trepang2_Bolt_Launcher");
OtherLoader.RegisterDirectLoad(BasePath, "nootarc.Trepang2_Bolt_Launcher", "", "", "trepangboltlauncher", "");
}
}
}
namespace nootarc
{
public class BreakActionHCBBoltMod : FVRFireArm
{
[Serializable]
public class BreakActionBarrel
{
public FVRFireArmChamber Chamber;
public Transform Hammer;
public Transform Muzzle;
public bool HasVisibleHammer;
public InterpStyle HammerInterpStyle = (InterpStyle)1;
public Axis HammerAxis;
public float HammerUncocked;
public float HammerCocked;
public int MuzzleIndexBarrelFire;
public int MuzzleIndexBarrelSmoke;
public int GasOutIndexBarrel;
public int GasOutIndexBreach;
[HideInInspector]
public bool IsBreachOpenForGasOut;
[HideInInspector]
public bool m_isHammerCocked;
}
[Serializable]
public class BreakActionLatch
{
public Transform Latch;
public Axis LatchAxis;
public InterpStyle LatchInterp;
public Vector2 LatchRange;
}
[Header("Component Connections")]
public BreakActionBarrel[] Barrels;
public Transform[] Triggers;
public InterpStyle TriggerInterpStyle = (InterpStyle)1;
public Axis TriggerAxis;
public float TriggerUnpulled;
public float TriggerPulled;
public bool FireAllBarrels;
public bool OnlyOneShotSound;
[Header("Hinge Params")]
public HingeJoint Hinge;
[NonSerialized]
public Vector3 m_foreStartPos;
public float HingeLimit = 45f;
public float HingeEjectLimit = 30f;
public Transform Ejector;
public Vector2 EjectorRange;
[NonSerialized]
public bool m_hasEjector;
[NonSerialized]
public float m_ejectorLerp;
[Header("Latch Params")]
public bool m_hasLatch;
public Transform Latch;
public Axis LatchAxis = (Axis)1;
public float MaxRotExtent;
[NonSerialized]
public float m_latchRot;
[NonSerialized]
public bool m_isLatched = true;
[Header("ExtraLatchPieces")]
public List<BreakActionLatch> ExtraLatches;
[NonSerialized]
public bool m_hasExtraEjectors;
[NonSerialized]
public float m_extraEjectorLerp;
public float ExtraLatchMaxRot = 5f;
public float EjectOffset = -0.06f;
public float EjectSpeed = -2.5f;
[Header("Control Params")]
public bool UsesManuallyCockedHammers;
[NonSerialized]
public int m_curBarrel;
[NonSerialized]
public bool m_EjectsOnOpen = true;
[NonSerialized]
public bool m_hasLatchButton = true;
[HideInInspector]
public bool IsLatchHeldOpen;
[HideInInspector]
public bool HasTriggerReset = true;
[NonSerialized]
public float m_triggerFloat;
[NonSerialized]
public bool m_isExternallyUnlatched;
[NonSerialized]
public bool firedOneShot;
[NonSerialized]
[HideInInspector]
public int ShotCounter;
public int MaxShotCounter = 3;
public FVRFireArmRound EvilRound;
[HideInInspector]
private float TrepangBoltCounter = 0f;
public float TrepangBurstDelay = 0f;
public bool IsLatched => m_isLatched;
public void SetEjectOnOpen(bool b)
{
m_EjectsOnOpen = b;
}
public void SetHasLatchButton(bool b)
{
m_hasLatchButton = b;
}
public override void Awake()
{
//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)
((FVRFireArm)this).Awake();
BreakActionBarrel[] barrels = Barrels;
foreach (BreakActionBarrel breakActionBarrel in barrels)
{
base.FChambers.Add(breakActionBarrel.Chamber);
}
m_foreStartPos = ((Component)Hinge).transform.localPosition;
if ((Object)(object)Ejector != (Object)null)
{
m_hasEjector = true;
}
if (ExtraLatches != null && ExtraLatches.Count > 0)
{
m_hasExtraEjectors = true;
}
}
public override Transform GetMuzzle()
{
return Barrels[m_curBarrel].Muzzle;
}
public void Unlatch()
{
}
public void SetIsExternallyUnlatched(bool b)
{
m_isExternallyUnlatched = b;
}
public void PopOutEmpties()
{
for (int i = 0; i < Barrels.Length; i++)
{
if (Barrels[i].Chamber.IsFull && Barrels[i].Chamber.IsSpent)
{
PopOutRound(Barrels[i].Chamber);
}
}
}
public void PopOutRound(FVRFireArmChamber chamber)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
((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);
}
public void CockHammer()
{
for (int i = 0; i < Barrels.Length; i++)
{
if (!Barrels[i].m_isHammerCocked)
{
Barrels[i].m_isHammerCocked = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
break;
}
}
UpdateVisualHammers();
}
public void CockAllHammers()
{
bool flag = false;
for (int i = 0; i < Barrels.Length; i++)
{
if (!Barrels[i].m_isHammerCocked)
{
Barrels[i].m_isHammerCocked = true;
flag = true;
}
}
if (flag)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
UpdateVisualHammers();
}
}
public void DropHammer()
{
if (!m_isLatched)
{
return;
}
firedOneShot = false;
for (int i = 0; i < Barrels.Length; i++)
{
if (Barrels[i].m_isHammerCocked)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
Barrels[i].m_isHammerCocked = false;
UpdateVisualHammers();
Fire(i, FireAllBarrels, i);
if (!FireAllBarrels)
{
break;
}
}
}
}
public bool Fire(int b, bool FireAllBarrels, int index)
{
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
m_curBarrel = b;
if (!Barrels[b].Chamber.Fire())
{
return false;
}
((FVRFireArm)this).Fire(Barrels[b].Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
((FVRFireArm)this).FireMuzzleSmoke(Barrels[b].MuzzleIndexBarrelFire);
((FVRFireArm)this).FireMuzzleSmoke(Barrels[b].MuzzleIndexBarrelSmoke);
((FVRFireArm)this).AddGas(Barrels[b].GasOutIndexBarrel);
((FVRFireArm)this).AddGas(Barrels[b].GasOutIndexBreach);
bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag2 = ((FVRFireArm)this).IsForegripStabilized();
bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
ShotCounter--;
TrepangBoltCounter = 0f;
if (!OnlyOneShotSound || !firedOneShot)
{
firedOneShot = true;
((FVRFireArm)this).PlayAudioGunShot(Barrels[b].Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
}
if (ShotCounter > 0 || GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
{
Barrels[b].m_isHammerCocked = true;
Barrels[b].Chamber.IsSpent = false;
Barrels[b].Chamber.UpdateProxyDisplay();
}
return true;
}
public void UpdateVisualHammers()
{
//IL_0093: 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_0052: 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)
for (int i = 0; i < Barrels.Length; i++)
{
if (Barrels[i].HasVisibleHammer)
{
if (Barrels[i].m_isHammerCocked)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Barrels[i].Hammer, Barrels[i].HammerCocked, Barrels[i].HammerInterpStyle, Barrels[i].HammerAxis);
}
else
{
((FVRPhysicalObject)this).SetAnimatedComponent(Barrels[i].Hammer, Barrels[i].HammerUncocked, Barrels[i].HammerInterpStyle, Barrels[i].HammerAxis);
}
}
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).UpdateInteraction(hand);
UpdateInputAndAnimate(hand);
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRFireArm)this).EndInteraction(hand);
IsLatchHeldOpen = false;
}
public void UpdateInputAndAnimate(FVRViveHand hand)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_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_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_045a: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_0530: Unknown result type (might be due to invalid IL or missing references)
//IL_0536: Unknown result type (might be due to invalid IL or missing references)
//IL_0508: Unknown result type (might be due to invalid IL or missing references)
//IL_050e: Unknown result type (might be due to invalid IL or missing references)
if (m_hasEjector)
{
float num = 0f;
if (!m_isLatched && ((Component)Hinge).transform.localEulerAngles.x > 15f)
{
num = Mathf.InverseLerp(15f, 25f, Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x));
}
if (Mathf.Abs(num - m_ejectorLerp) > 1E-05f)
{
m_ejectorLerp = num;
((FVRPhysicalObject)this).SetAnimatedComponent(Ejector, Mathf.Lerp(EjectorRange.x, EjectorRange.y, m_ejectorLerp), (InterpStyle)0, (Axis)2);
}
}
if (m_hasExtraEjectors)
{
float num2 = 0f;
if (!m_isLatched && ((Component)Hinge).transform.localEulerAngles.x > 0.1f)
{
num2 = Mathf.InverseLerp(0f, ExtraLatchMaxRot, Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x));
}
if (Mathf.Abs(num2 - m_extraEjectorLerp) > 1E-05f)
{
m_extraEjectorLerp = num2;
for (int i = 0; i < ExtraLatches.Count; i++)
{
((FVRPhysicalObject)this).SetAnimatedComponent(ExtraLatches[i].Latch, Mathf.Lerp(ExtraLatches[i].LatchRange.x, ExtraLatches[i].LatchRange.y, m_extraEjectorLerp), ExtraLatches[i].LatchInterp, ExtraLatches[i].LatchAxis);
}
}
}
IsLatchHeldOpen = false;
if (((FVRPhysicalObject)this).IsAltHeld)
{
return;
}
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
m_triggerFloat = hand.Input.TriggerFloat;
}
else
{
m_triggerFloat = 0f;
}
if (!HasTriggerReset && m_triggerFloat <= 0.45f)
{
HasTriggerReset = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
}
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonPressed && m_hasLatchButton)
{
IsLatchHeldOpen = true;
m_latchRot = 1f * MaxRotExtent;
}
else
{
m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * 100f);
}
if (hand.Input.AXButtonDown && UsesManuallyCockedHammers)
{
if (FireAllBarrels)
{
CockAllHammers();
}
else
{
CockHammer();
}
}
}
else
{
if (hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f && m_hasLatchButton)
{
IsLatchHeldOpen = true;
m_latchRot = touchpadAxes.y * MaxRotExtent;
}
else
{
m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * 100f);
}
if (hand.Input.TouchpadDown && UsesManuallyCockedHammers && touchpadAxes.y < 0.1f)
{
if (FireAllBarrels)
{
CockAllHammers();
}
else
{
CockHammer();
}
}
}
if (UsesManuallyCockedHammers && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null)
{
Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld;
float num3 = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, Barrels[0].Hammer.position);
if (num3 < 0.15f && Vector3.Angle(velLinearWorld, -((Component)this).transform.forward) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f)
{
CockAllHammers();
}
}
if (m_hasLatch)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Latch, m_latchRot, (InterpStyle)1, LatchAxis);
}
for (int j = 0; j < Triggers.Length; j++)
{
int num4 = Mathf.Clamp(m_curBarrel, 0, Triggers.Length - 1);
if (num4 == j)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Triggers[j], Mathf.Lerp(TriggerUnpulled, TriggerPulled, m_triggerFloat), TriggerInterpStyle, TriggerAxis);
}
else
{
((FVRPhysicalObject)this).SetAnimatedComponent(Triggers[j], TriggerUnpulled, TriggerInterpStyle, TriggerAxis);
}
}
if (m_triggerFloat >= 0.9f && HasTriggerReset && m_isLatched)
{
HasTriggerReset = false;
DropHammer();
}
}
public override void FVRFixedUpdate()
{
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: 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_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).FVRFixedUpdate();
for (int i = 0; i < Barrels.Length; i++)
{
base.GasOutEffects[Barrels[i].GasOutIndexBarrel].GasUpdate(true);
if (Barrels[i].Chamber.IsFull || !Barrels[i].Chamber.IsAccessible)
{
base.GasOutEffects[Barrels[i].GasOutIndexBreach].GasUpdate(false);
}
else
{
base.GasOutEffects[Barrels[i].GasOutIndexBreach].GasUpdate(true);
}
}
if (m_isLatched && (Mathf.Abs(m_latchRot) > 5f || m_isExternallyUnlatched))
{
m_isLatched = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
JointLimits limits = Hinge.limits;
((JointLimits)(ref limits)).max = HingeLimit;
Hinge.limits = limits;
for (int j = 0; j < Barrels.Length; j++)
{
Barrels[j].Chamber.IsAccessible = true;
}
}
for (int k = 0; k < Barrels.Length; k++)
{
TrepangBoltCounter += Time.deltaTime;
if ((double)m_triggerFloat >= 0.9 && (Object)(object)Barrels[k].Chamber.GetRound() == (Object)(object)EvilRound && TrepangBoltCounter > TrepangBurstDelay)
{
HasTriggerReset = true;
}
}
if (ShotCounter < MaxShotCounter && ShotCounter > 0)
{
m_isLatched = true;
}
if (!Barrels[0].Chamber.IsFull)
{
ShotCounter = MaxShotCounter;
}
if (m_isLatched)
{
return;
}
if (!IsLatchHeldOpen && ((Component)Hinge).transform.localEulerAngles.x <= 1f && Mathf.Abs(m_latchRot) < 5f && !m_isExternallyUnlatched)
{
m_isLatched = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
JointLimits limits2 = Hinge.limits;
((JointLimits)(ref limits2)).max = 0f;
Hinge.limits = limits2;
for (int l = 0; l < Barrels.Length; l++)
{
Barrels[l].Chamber.IsAccessible = false;
}
((Component)Hinge).transform.localPosition = m_foreStartPos;
}
if (Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x) >= HingeEjectLimit)
{
if (m_EjectsOnOpen)
{
PopOutEmpties();
}
if (!UsesManuallyCockedHammers)
{
CockAllHammers();
}
}
}
public override List<FireArmRoundClass> GetChamberRoundList()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
for (int i = 0; i < Barrels.Length; i++)
{
if (Barrels[i].Chamber.IsFull)
{
list.Add(Barrels[i].Chamber.GetRound().RoundClass);
flag = true;
}
}
if (flag)
{
return list;
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count <= 0)
{
return;
}
for (int i = 0; i < Barrels.Length; i++)
{
if (i < rounds.Count)
{
Barrels[i].Chamber.Autochamber(rounds[i]);
}
}
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
for (int i = 0; i < Barrels.Length; i++)
{
string key = "HammerState_" + i;
if (f.ContainsKey(key))
{
string text = f[key];
if (text == "Cocked")
{
Barrels[i].m_isHammerCocked = true;
UpdateVisualHammers();
}
}
}
((FVRFireArm)this).ConfigureFromFlagDic(f);
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> flagDic = ((FVRFireArm)this).GetFlagDic();
for (int i = 0; i < Barrels.Length; i++)
{
string key = "HammerState_" + i;
string value = "Uncocked";
if (Barrels[i].m_isHammerCocked)
{
value = "Cocked";
}
flagDic.Add(key, value);
}
return flagDic;
}
}
public class BreakActionManualEjectorMod : FVRInteractiveObject
{
public enum BoltHandlePos
{
Forward,
Middle,
Rear
}
[Header("ChargingHandle")]
public BreakActionHCBBoltMod Weapon;
public bool IsCartridgeEjector = true;
public Transform Point_Fore;
public Transform Point_Rear;
public float ForwardSpeed = 1f;
[NonSerialized]
public float m_boltZ_forward;
[NonSerialized]
public float m_boltZ_rear;
[NonSerialized]
public float m_currentHandleZ;
public BoltHandlePos CurPos;
public BoltHandlePos LastPos;
[Header("Rotating Bit")]
public bool HasRotatingPart;
public Transform RotatingPart;
public Vector3 RotatingPartNeutralEulers;
public Vector3 RotatingPartLeftEulers;
public Vector3 RotatingPartRightEulers;
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)
((FVRInteractiveObject)this).Awake();
m_boltZ_forward = Point_Fore.localPosition.z;
m_boltZ_rear = Point_Rear.localPosition.z;
m_currentHandleZ = ((Component)this).transform.localPosition.z;
Weapon.SetHasLatchButton(b: false);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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)
((FVRInteractiveObject)this).UpdateInteraction(hand);
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Fore.position, Point_Rear.position, ((HandInput)(ref base.m_hand.Input)).Pos);
((Component)this).transform.position = closestValidPoint;
m_currentHandleZ = ((Component)this).transform.localPosition.z;
float num = Mathf.InverseLerp(m_boltZ_forward, m_boltZ_rear, m_currentHandleZ);
if (HasRotatingPart)
{
Vector3 val = ((Component)this).transform.position - base.m_hand.PalmTransform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
if (Vector3.Dot(normalized, ((Component)this).transform.right) > 0f)
{
RotatingPart.localEulerAngles = RotatingPartLeftEulers;
}
else
{
RotatingPart.localEulerAngles = RotatingPartRightEulers;
}
}
}
public override void EndInteraction(FVRViveHand hand)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (HasRotatingPart)
{
RotatingPart.localEulerAngles = RotatingPartNeutralEulers;
}
((FVRInteractiveObject)this).EndInteraction(hand);
}
public override void FVRUpdate()
{
//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_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_0094: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (Weapon.IsLatched && !((FVRInteractiveObject)this).IsHeld && Mathf.Abs(m_currentHandleZ - m_boltZ_forward) > 0.001f)
{
m_currentHandleZ = Mathf.MoveTowards(m_currentHandleZ, m_boltZ_forward, Time.deltaTime * ForwardSpeed);
((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, m_currentHandleZ);
}
if (Mathf.Abs(m_currentHandleZ - m_boltZ_forward) < 0.005f)
{
CurPos = BoltHandlePos.Forward;
}
else if (Mathf.Abs(m_currentHandleZ - m_boltZ_rear) < 0.005f)
{
CurPos = BoltHandlePos.Rear;
}
else
{
CurPos = BoltHandlePos.Middle;
}
if (CurPos == BoltHandlePos.Forward && LastPos != 0)
{
if (IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
{
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)11, 1f);
}
if (!IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
{
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)31, 1f);
}
}
else if (CurPos == BoltHandlePos.Rear && LastPos != BoltHandlePos.Rear)
{
if (IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
{
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)10, 1f);
}
if (!IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
{
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)30, 1f);
}
if (IsCartridgeEjector && !Weapon.IsLatched)
{
Weapon.PopOutRound(Weapon.Barrels[0].Chamber);
}
}
if (!IsCartridgeEjector)
{
if ((CurPos == BoltHandlePos.Forward) | !((FVRInteractiveObject)this).IsHeld)
{
Weapon.SetIsExternallyUnlatched(b: false);
}
else if (CurPos == BoltHandlePos.Rear && (Weapon.ShotCounter <= 0 || Weapon.ShotCounter >= Weapon.MaxShotCounter))
{
Weapon.SetIsExternallyUnlatched(b: true);
}
}
LastPos = CurPos;
}
}
public class FVRShotgunForegripMod : FVRAlternateGrip
{
public Transform ShotgunBase;
public HingeJoint Hinge;
[NonSerialized]
public Vector3 localPosStart;
[NonSerialized]
public Rigidbody RB;
[NonSerialized]
public BreakActionHCBBoltMod Wep;
[NonSerialized]
public float m_initialDamp = 0.05f;
[NonSerialized]
public float m_initialSpring = 0.05f;
public override void Awake()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
((FVRAlternateGrip)this).Awake();
localPosStart = ((Component)Hinge).transform.localPosition;
RB = ((Component)Hinge).gameObject.GetComponent<Rigidbody>();
Wep = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent<BreakActionHCBBoltMod>();
JointSpring spring = Hinge.spring;
m_initialSpring = spring.spring;
m_initialDamp = spring.damper;
}
public override void FVRUpdate()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f)
{
((Component)Hinge).transform.localPosition = localPosStart;
}
}
public override void FVRFixedUpdate()
{
((FVRInteractiveObject)this).FVRFixedUpdate();
if (((FVRInteractiveObject)Wep).IsHeld && ((FVRPhysicalObject)Wep).IsAltHeld)
{
RB.mass = 0.001f;
}
else
{
RB.mass = 0.1f;
}
}
public override bool IsInteractable()
{
return true;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0062: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00f9: 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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
((FVRAlternateGrip)this).UpdateInteraction(hand);
Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position;
Vector3 val2 = Vector3.ProjectOnPlane(val, ShotgunBase.right);
if (Vector3.Angle(val2, -ShotgunBase.up) > 90f)
{
val2 = ShotgunBase.forward;
}
if (Vector3.Angle(val2, ShotgunBase.forward) > 90f)
{
val2 = -ShotgunBase.up;
}
float num = Vector3.Angle(val2, ShotgunBase.forward);
JointSpring spring = Hinge.spring;
spring.spring = 10f;
spring.damper = 0f;
JointLimits limits = Hinge.limits;
spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max);
Hinge.spring = spring;
((Component)Hinge).transform.localPosition = localPosStart;
}
public override void EndInteraction(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)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
JointSpring spring = Hinge.spring;
spring.spring = m_initialSpring;
spring.damper = m_initialDamp;
spring.targetPosition = 45f;
Hinge.spring = spring;
((FVRAlternateGrip)this).EndInteraction(hand);
}
}
}