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 OpenScripts2;
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]
public class AdvanceLaserSightComponent : LaserLightAttachment
{
public Transform KnobMesh;
public Vector3 RotationAxis = Vector3.up;
public List<float> CustomRotationAngles;
public GameObject ControlledGameObject;
public bool[] GameObjectEnableFlags;
public AudioEvent SettingSwapSound;
private int previousSettingsIndex = -1;
private void Start()
{
UpdateKnobRotationAndGameObject();
}
private void Update()
{
UpdateKnobRotationAndGameObject();
}
private void UpdateKnobRotationAndGameObject()
{
//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)
if ((Object)(object)KnobMesh != (Object)null && base.Settings.Count > 0 && CustomRotationAngles.Count == base.Settings.Count && GameObjectEnableFlags.Length == base.Settings.Count)
{
float num = CustomRotationAngles[base.SettingsIndex];
KnobMesh.localEulerAngles = RotationAxis * num;
UpdateControlledGameObject(base.SettingsIndex);
if (base.SettingsIndex != previousSettingsIndex)
{
PlaySettingSwapSound();
previousSettingsIndex = base.SettingsIndex;
}
}
}
private void UpdateControlledGameObject(int settingIndex)
{
if ((Object)(object)ControlledGameObject != (Object)null)
{
ControlledGameObject.SetActive(GameObjectEnableFlags[settingIndex]);
}
}
private void PlaySettingSwapSound()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
if (SettingSwapSound != null && SettingSwapSound.Clips.Count > 0)
{
AudioClip val = SettingSwapSound.Clips[Random.Range(0, SettingSwapSound.Clips.Count)];
AudioSource.PlayClipAtPoint(val, ((Component)this).transform.position, Random.Range(SettingSwapSound.VolumeRange.x, SettingSwapSound.VolumeRange.y));
}
}
}
public class DiceFaceDetector : MonoBehaviour
{
public ParticleSystem effect;
public Transform faceOneMarker;
public float checkThreshold = 0.9f;
public float cooldownTime = 2f;
private float lastTriggerTime = 0f;
private void Update()
{
//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)
if (!((Object)(object)faceOneMarker == (Object)null) && !(Time.time - lastTriggerTime < cooldownTime) && Vector3.Dot(faceOneMarker.up, Vector3.up) > checkThreshold)
{
TriggerEffect();
}
}
private void TriggerEffect()
{
if ((Object)(object)effect != (Object)null)
{
effect.Play();
lastTriggerTime = Time.time;
}
}
}
public class OpenBoltAltHandle : FVRInteractiveObject
{
public enum HandleRot
{
Down,
Mid,
Up
}
public enum HandleState
{
Forward,
Mid,
Rear
}
[Header("References")]
public OpenBoltReceiver Receiver;
public OpenBoltReceiverBolt Bolt;
[Header("Linear Travel")]
public Transform Point_Fore;
public Transform Point_Rear;
public float ForwardSpeed = 1.5f;
[Header("Rotation / Tilt")]
public Transform BoltHandleRoot;
public Transform BoltHandle;
public float MinRot = 0f;
public float MaxRot = 90f;
public float UnlockThreshold = 65f;
public float LockThreshold = 5f;
public float RotateSnapSpeed = 270f;
public HandleRot CurRot = HandleRot.Down;
public HandleRot LastRot = HandleRot.Down;
public HandleState CurState = HandleState.Forward;
public HandleState LastState = HandleState.Forward;
private float m_boltZ_forward;
private float m_boltZ_rear;
private float m_currentHandleZ;
private float m_rotAngle;
private bool m_hasReleasedBolt;
protected 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 = BoltHandleRoot.localPosition.z;
m_rotAngle = MinRot;
m_hasReleasedBolt = true;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_002e: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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)
((FVRInteractiveObject)this).UpdateInteraction(hand);
UpdateRotationFromHand(hand);
if (CurRot == HandleRot.Up || CurState != 0)
{
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Fore.position, Point_Rear.position, ((HandInput)(ref hand.Input)).Pos);
BoltHandleRoot.position = closestValidPoint;
m_currentHandleZ = BoltHandleRoot.localPosition.z;
}
UpdateHandleState();
UpdateRotState();
if (CurState != 0)
{
float num = Mathf.InverseLerp(m_boltZ_forward, m_boltZ_rear, m_currentHandleZ);
Bolt.ChargingHandleHeld(num);
}
else if (CurRot != 0)
{
Bolt.ChargingHandleHeld(0f);
}
if (CurState == HandleState.Forward && CurRot == HandleRot.Down)
{
if (!m_hasReleasedBolt)
{
Bolt.ChargingHandleReleased();
m_hasReleasedBolt = true;
}
}
else
{
m_hasReleasedBolt = false;
}
HandleRotAudioEvents();
HandleStateAudioEvents();
LastRot = CurRot;
LastState = CurState;
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).EndInteraction(hand);
}
protected void FVRUpdate()
{
//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_0072: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (((FVRInteractiveObject)this).IsHeld)
{
return;
}
if (Mathf.Abs(m_currentHandleZ - m_boltZ_forward) > 0.001f)
{
m_currentHandleZ = Mathf.MoveTowards(m_currentHandleZ, m_boltZ_forward, Time.deltaTime * ForwardSpeed);
BoltHandleRoot.localPosition = new Vector3(BoltHandleRoot.localPosition.x, BoltHandleRoot.localPosition.y, m_currentHandleZ);
if (CurState != 0)
{
float num = Mathf.InverseLerp(m_boltZ_forward, m_boltZ_rear, m_currentHandleZ);
Bolt.ChargingHandleHeld(num);
}
}
if ((CurState == HandleState.Forward || CurState == HandleState.Mid) && m_rotAngle > MinRot + 0.5f)
{
m_rotAngle = Mathf.MoveTowards(m_rotAngle, MinRot, Time.deltaTime * RotateSnapSpeed);
BoltHandle.localEulerAngles = new Vector3(0f, 0f, m_rotAngle);
}
UpdateHandleState();
UpdateRotState();
if (CurState == HandleState.Forward && CurRot == HandleRot.Down && !m_hasReleasedBolt)
{
Bolt.ChargingHandleReleased();
m_hasReleasedBolt = true;
}
HandleStateAudioEvents();
HandleRotAudioEvents();
LastRot = CurRot;
LastState = CurState;
}
private void UpdateRotationFromHand(FVRViveHand hand)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//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_002e: 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_0036: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((HandInput)(ref hand.Input)).Pos - BoltHandle.position;
Vector3 val2 = Vector3.ProjectOnPlane(val, BoltHandleRoot.forward);
val = ((Vector3)(ref val2)).normalized;
Vector3 right = BoltHandleRoot.right;
float num = Mathf.Atan2(Vector3.Dot(BoltHandleRoot.forward, Vector3.Cross(right, val)), Vector3.Dot(right, val)) * 57.29578f;
m_rotAngle = Mathf.Clamp(num, MinRot, MaxRot);
BoltHandle.localEulerAngles = new Vector3(0f, 0f, m_rotAngle);
}
private void UpdateRotState()
{
if (m_rotAngle >= UnlockThreshold)
{
CurRot = HandleRot.Up;
}
else if (m_rotAngle <= MinRot + LockThreshold)
{
CurRot = HandleRot.Down;
}
else
{
CurRot = HandleRot.Mid;
}
}
private void UpdateHandleState()
{
if (Mathf.Abs(m_currentHandleZ - m_boltZ_forward) < 0.005f)
{
CurState = HandleState.Forward;
}
else if (Mathf.Abs(m_currentHandleZ - m_boltZ_rear) < 0.005f)
{
CurState = HandleState.Rear;
}
else
{
CurState = HandleState.Mid;
}
}
private void HandleRotAudioEvents()
{
if (!((Object)(object)Receiver == (Object)null))
{
if (CurRot == HandleRot.Up && LastRot != HandleRot.Up)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)12, 1f);
}
else if (CurRot == HandleRot.Down && LastRot != 0)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)13, 1f);
}
}
}
private void HandleStateAudioEvents()
{
if (!((Object)(object)Receiver == (Object)null))
{
if (CurState == HandleState.Rear && LastState != HandleState.Rear)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)10, 1f);
}
else if (CurState == HandleState.Forward && LastState != 0)
{
((FVRFireArm)Receiver).PlayAudioEvent((FirearmAudioEventType)11, 1f);
}
}
}
}
namespace Volks.HKP30L_Redux;
[BepInPlugin("Volks.HKP30L_Redux", "HKP30L_Redux", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HKP30L_ReduxPlugin : 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(), "Volks.HKP30L_Redux");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.HKP30L_Redux", "", "", "h&kp30l_redux", "");
}
}
public class BoltReleaseChargingHandle : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public ClosedBoltHandle Handle;
public float LaunchSpeed = 5f;
[Tooltip("If true, the handle stays at Rear until bolt release is pressed again. If false, it returns forward when pulled back manually.")]
public bool HandleReturnsManually = false;
private bool m_wasLocked;
private void Start()
{
if ((Object)(object)Weapon == (Object)null || (Object)(object)Handle == (Object)null)
{
Debug.LogWarning((object)"[BoltReleaseChargingHandle] Weapon or Handle reference is missing.", (Object)(object)this);
((Behaviour)this).enabled = false;
}
else
{
m_wasLocked = Weapon.Bolt.IsBoltLocked();
}
}
private void Update()
{
//IL_005f: 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_0040: Invalid comparison between Unknown and I4
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Invalid comparison between Unknown and I4
bool flag = Weapon.Bolt.IsBoltLocked();
if (m_wasLocked && !flag && Weapon.HasBoltReleaseButton && (int)Handle.CurPos == 4)
{
Handle.Speed_Forward = LaunchSpeed;
}
if ((int)Handle.CurPos == 0 && Handle.Speed_Forward > 0f)
{
Handle.Speed_Forward = 0f;
}
if (!HandleReturnsManually && !flag && !((FVRInteractiveObject)Handle).IsHeld && (int)Handle.CurPos == 4 && Handle.Speed_Forward == 0f)
{
Handle.Speed_Forward = LaunchSpeed;
}
m_wasLocked = flag;
}
}
public class PartRecoilImpulse : MonoBehaviour
{
public enum ImpulseMode
{
Rotation,
Translation
}
public enum ImpulseAxis
{
X,
Y,
Z
}
[Serializable]
public class RecoilPart
{
public Transform Piece;
public ImpulseMode Mode = ImpulseMode.Rotation;
public ImpulseAxis Axis = ImpulseAxis.X;
public Vector2 Range = new Vector2(0f, 45f);
public float ReturnSpeed = 5f;
public float ImpulseStrength = 1f;
[NonSerialized]
public float CurrentLerp = 0f;
}
[Header("Parts")]
public List<RecoilPart> Parts = new List<RecoilPart>();
private FVRFireArm m_firearm;
private void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
private void OnDestroy()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if ((Object)(object)GM.CurrentSceneSettings != (Object)null)
{
GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired);
}
}
private void Start()
{
m_firearm = ((Component)this).GetComponentInParent<FVRFireArm>();
if ((Object)(object)m_firearm == (Object)null)
{
Debug.LogWarning((object)"[PartRecoilImpulse] No FVRFireArm found in parent hierarchy.", (Object)(object)this);
}
for (int i = 0; i < Parts.Count; i++)
{
ApplyToPart(Parts[i]);
}
}
private void OnShotFired(FVRFireArm firearm)
{
if (!((Object)(object)firearm != (Object)(object)m_firearm))
{
for (int i = 0; i < Parts.Count; i++)
{
Parts[i].CurrentLerp = Mathf.Clamp01(Parts[i].ImpulseStrength);
ApplyToPart(Parts[i]);
}
}
}
private void Update()
{
for (int i = 0; i < Parts.Count; i++)
{
RecoilPart recoilPart = Parts[i];
if (recoilPart.CurrentLerp > 0f)
{
recoilPart.CurrentLerp = Mathf.MoveTowards(recoilPart.CurrentLerp, 0f, Time.deltaTime * recoilPart.ReturnSpeed);
ApplyToPart(recoilPart);
}
}
}
private void ApplyToPart(RecoilPart part)
{
//IL_00a3: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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)
if ((Object)(object)part.Piece == (Object)null)
{
return;
}
float num = Mathf.Lerp(part.Range.x, part.Range.y, part.CurrentLerp);
if (part.Mode == ImpulseMode.Rotation)
{
Vector3 localEulerAngles = part.Piece.localEulerAngles;
if (part.Axis == ImpulseAxis.X)
{
localEulerAngles.x = num;
}
else if (part.Axis == ImpulseAxis.Y)
{
localEulerAngles.y = num;
}
else
{
localEulerAngles.z = num;
}
part.Piece.localEulerAngles = localEulerAngles;
}
else
{
Vector3 localPosition = part.Piece.localPosition;
if (part.Axis == ImpulseAxis.X)
{
localPosition.x = num;
}
else if (part.Axis == ImpulseAxis.Y)
{
localPosition.y = num;
}
else
{
localPosition.z = num;
}
part.Piece.localPosition = localPosition;
}
}
}
public class SecondaryMagPos : MonoBehaviour
{
[Serializable]
public class MagMountEntry
{
public FireArmMagazineType MagazineType;
public Transform MountPos;
public Transform EjectPos;
[HideInInspector]
public TransformProxy MountPosProxy;
[HideInInspector]
public TransformProxy EjectPosProxy;
}
[Header("References")]
public FVRFireArm FireArm;
public FVRFireArmReloadTriggerWell TriggerWell;
[Header("Mount Overrides")]
public List<MagMountEntry> MountOverrides = new List<MagMountEntry>();
private Transform m_defaultMountPos;
private Transform m_defaultEjectPos;
private TransformProxy m_defaultMountProxy;
private TransformProxy m_defaultEjectProxy;
private FVRFireArmMagazine m_lastMag;
private void Awake()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
for (int i = 0; i < MountOverrides.Count; i++)
{
if ((Object)(object)MountOverrides[i].MountPos != (Object)null)
{
MountOverrides[i].MountPosProxy = new TransformProxy(MountOverrides[i].MountPos, true);
}
if ((Object)(object)MountOverrides[i].EjectPos != (Object)null)
{
MountOverrides[i].EjectPosProxy = new TransformProxy(MountOverrides[i].EjectPos, true);
}
}
}
private void Start()
{
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
if ((Object)(object)FireArm == (Object)null || (Object)(object)TriggerWell == (Object)null)
{
Debug.LogWarning((object)"[SecondaryMagPos] FireArm or TriggerWell reference is missing.", (Object)(object)this);
((Behaviour)this).enabled = false;
return;
}
if (TriggerWell.UsesSecondaryMagSlots && TriggerWell.SecondaryMagSlotIndex >= FireArm.SecondaryMagazineSlots.Length)
{
Debug.LogWarning((object)"[SecondaryMagPos] SecondaryMagSlotIndex is out of range.", (Object)(object)this);
((Behaviour)this).enabled = false;
return;
}
if (TriggerWell.UsesSecondaryMagSlots)
{
int secondaryMagSlotIndex = TriggerWell.SecondaryMagSlotIndex;
m_defaultMountPos = FireArm.SecondaryMagazineSlots[secondaryMagSlotIndex].MagazineMountPos;
m_defaultEjectPos = FireArm.SecondaryMagazineSlots[secondaryMagSlotIndex].MagazineEjectPos;
}
else
{
m_defaultMountPos = FireArm.MagazineMountPos;
m_defaultEjectPos = FireArm.MagazineEjectPos;
}
m_defaultMountProxy = new TransformProxy(m_defaultMountPos, true);
m_defaultEjectProxy = new TransformProxy(m_defaultEjectPos, true);
Debug.Log((object)("[SecondaryMagPos] START:\n DefaultMountPos name: " + ((Object)m_defaultMountPos).name + "\n UsesSecondaryMagSlots: " + TriggerWell.UsesSecondaryMagSlots + "\n MountOverrides count: " + MountOverrides.Count));
}
private void Update()
{
//IL_0071: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
FVRFireArmMagazine val = ((!TriggerWell.UsesSecondaryMagSlots) ? FireArm.Magazine : FireArm.SecondaryMagazineSlots[TriggerWell.SecondaryMagSlotIndex].Magazine);
if ((Object)(object)val == (Object)(object)m_lastMag)
{
return;
}
Debug.Log((object)("[SecondaryMagPos] UPDATE — Mag changed.\n New mag: " + ((!((Object)(object)val != (Object)null)) ? "NULL" : (((Object)val).name + " | Type: " + val.MagazineType))));
if ((Object)(object)val != (Object)null)
{
bool flag = false;
for (int i = 0; i < MountOverrides.Count; i++)
{
if (MountOverrides[i].MagazineType == val.MagazineType && MountOverrides[i].MountPosProxy != null)
{
ApplyOverride(MountOverrides[i]);
flag = true;
break;
}
}
if (!flag)
{
Debug.Log((object)"[SecondaryMagPos] No match — restoring defaults.");
RestoreDefaults();
}
}
else
{
Debug.Log((object)"[SecondaryMagPos] Mag ejected — restoring defaults.");
RestoreDefaults();
}
m_lastMag = val;
}
private void ApplyOverride(MagMountEntry entry)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
UnityEngineExtensions.GoToTransformProxy(m_defaultMountPos, entry.MountPosProxy);
if (entry.EjectPosProxy != null)
{
UnityEngineExtensions.GoToTransformProxy(m_defaultEjectPos, entry.EjectPosProxy);
}
Debug.Log((object)("[SecondaryMagPos] OVERRIDE APPLIED:\n MountPos moved to: " + ((Object)entry.MountPos).name + "\n World pos: " + m_defaultMountPos.position));
}
private void RestoreDefaults()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
UnityEngineExtensions.GoToTransformProxy(m_defaultMountPos, m_defaultMountProxy);
UnityEngineExtensions.GoToTransformProxy(m_defaultEjectPos, m_defaultEjectProxy);
Debug.Log((object)("[SecondaryMagPos] RESTORE:\n MountPos restored to: " + ((Object)m_defaultMountPos).name + "\n World pos: " + m_defaultMountPos.position));
}
}
public class InvertClosedBolt : MonoBehaviour
{
public Transform OptionalLockPointOverride;
private void Start()
{
//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)
ClosedBolt component = ((Component)this).GetComponent<ClosedBolt>();
if ((Object)(object)component == (Object)null)
{
Debug.LogWarning((object)"[InvertClosedBolt] No ClosedBolt component found on this GameObject.");
return;
}
Transform point_Bolt_Forward = component.Point_Bolt_Forward;
component.Point_Bolt_Forward = component.Point_Bolt_Rear;
component.Point_Bolt_Rear = point_Bolt_Forward;
if ((Object)(object)OptionalLockPointOverride != (Object)null)
{
component.Point_Bolt_LockPoint = OptionalLockPointOverride;
}
SetPrivateFloat(component, "m_boltZ_forward", LocalZ(component.Point_Bolt_Forward));
SetPrivateFloat(component, "m_boltZ_rear", LocalZ(component.Point_Bolt_Rear));
SetPrivateFloat(component, "m_boltZ_lock", LocalZ(component.Point_Bolt_LockPoint));
SetPrivateFloat(component, "m_boltZ_current", ((Component)component).transform.localPosition.z);
if (component.UsesAKSafetyLock && (Object)(object)component.Point_Bolt_SafetyLock != (Object)null)
{
SetPrivateFloat(component, "m_boltZ_safetylock", LocalZ(component.Point_Bolt_SafetyLock));
}
component.SnapToRear();
component.UpdateBolt();
}
private static float LocalZ(Transform t)
{
//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)
return (!((Object)(object)t != (Object)null)) ? 0f : t.localPosition.z;
}
private static void SetPrivateFloat(ClosedBolt cb, string name, float value)
{
typeof(ClosedBolt).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(cb, value);
}
}
internal class AutoReleaseOnMagLoad : MonoBehaviour
{
private FVRFireArm weapon;
private Handgun handgun;
private bool wasLoaded;
public void Start()
{
weapon = ((Component)this).GetComponent<FVRFireArm>();
if (!((Object)(object)weapon == (Object)null) && weapon is Handgun)
{
ref Handgun reference = ref handgun;
FVRFireArm obj = weapon;
reference = (Handgun)(object)((obj is Handgun) ? obj : null);
}
}
public void FixedUpdate()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Invalid comparison between Unknown and I4
if ((Object)(object)handgun != (Object)null)
{
if ((Object)(object)weapon.Magazine != (Object)null)
{
if (weapon.Magazine.HasARound())
{
if ((int)handgun.Slide.CurPos >= 2 && !wasLoaded)
{
handgun.Slide.ImpartFiringImpulse();
wasLoaded = true;
}
}
else
{
wasLoaded = false;
}
}
else
{
wasLoaded = false;
}
}
else
{
wasLoaded = false;
}
}
}