using System;
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 ModularWorkshop;
using OtherLoader;
using Sodalite.Api;
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 EjectionChanger : MonoBehaviour, IPartFireArmRequirement
{
[Header("Ejection Config")]
public Vector3 NewEjectionSpeed;
public Vector3 NewEjectionSpin;
private Vector3 _origEjectionSpeed;
private Vector3 _origEjectionSpin;
private ClosedBoltWeapon _ejectionFirearm;
public FVRFireArm FireArm
{
get
{
return (FVRFireArm)(object)_ejectionFirearm;
}
set
{
if ((Object)(object)_ejectionFirearm != (Object)null)
{
RemoveEjection();
}
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((value is ClosedBoltWeapon) ? value : null);
if ((Object)(object)val != (Object)null)
{
ApplyEjection(val);
}
else
{
_ejectionFirearm = null;
}
}
}
private void ApplyEjection(ClosedBoltWeapon firearm)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
_ejectionFirearm = firearm;
if (!((Object)(object)_ejectionFirearm == (Object)null))
{
_origEjectionSpeed = _ejectionFirearm.EjectionSpeed;
_origEjectionSpin = _ejectionFirearm.EjectionSpin;
_ejectionFirearm.EjectionSpeed = NewEjectionSpeed;
_ejectionFirearm.EjectionSpin = NewEjectionSpin;
Debug.Log((object)"EjectionChanger: Applying new ejection values.");
}
}
private void RemoveEjection()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
Debug.Log((object)"EjectionChanger: Reverting ejection values.");
if (!((Object)(object)_ejectionFirearm == (Object)null))
{
_ejectionFirearm.EjectionSpeed = _origEjectionSpeed;
_ejectionFirearm.EjectionSpin = _origEjectionSpin;
_ejectionFirearm = null;
}
}
}
namespace Volks.ModulAR2_LantacUpper;
[BepInPlugin("Volks.ModulAR2_LantacUpper", "ModulAR2_LantacUpper", "1.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.2")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class ModulAR2_LantacUpperPlugin : 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.ModulAR2_LantacUpper");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modular2_lantacupper"));
OtherLoader.RegisterDirectLoad(BasePath, "Volks.ModulAR2_LantacUpper", "", "", "modullantac", "");
}
}
public class ForwardAssist : FVRInteractiveObject
{
[Header("Animation Settings")]
public Transform TargetTransform;
public Vector3 StartPosition;
public Vector3 EndPosition;
public Vector3 StartRotation;
public Vector3 EndRotation;
public float MoveSpeed = 10f;
public float ResetDelay = 0.2f;
[Header("Audio Settings")]
public AudioEvent PokeAudioEvent;
public FVRPooledAudioType AudioType = (FVRPooledAudioType)0;
private float m_animFloat = 0f;
private bool m_isPoked = false;
private float m_resetTimer = 0f;
protected void Awake()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).Awake();
if ((Object)(object)TargetTransform == (Object)null)
{
TargetTransform = ((Component)this).transform;
}
if (StartPosition == Vector3.zero)
{
StartPosition = TargetTransform.localPosition;
}
if (StartRotation == Vector3.zero)
{
StartRotation = TargetTransform.localEulerAngles;
}
}
public override void Poke(FVRViveHand hand)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (PokeAudioEvent != null)
{
SM.PlayCoreSound(AudioType, PokeAudioEvent, ((Component)this).transform.position);
}
m_isPoked = true;
m_resetTimer = ResetDelay;
}
private void Update()
{
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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)
if (m_isPoked)
{
m_animFloat = Mathf.MoveTowards(m_animFloat, 1f, Time.deltaTime * MoveSpeed);
m_resetTimer -= Time.deltaTime;
if (m_resetTimer <= 0f)
{
m_isPoked = false;
}
}
else
{
m_animFloat = Mathf.MoveTowards(m_animFloat, 0f, Time.deltaTime * MoveSpeed);
}
if ((Object)(object)TargetTransform != (Object)null)
{
TargetTransform.localPosition = Vector3.Lerp(StartPosition, EndPosition, m_animFloat);
TargetTransform.localEulerAngles = Vector3.Lerp(StartRotation, EndRotation, m_animFloat);
}
}
}
public class SafetyToggle : FVRInteractiveObject
{
public ClosedBoltWeapon Weapon;
public Transform SelctorSwitch;
public Axis Axis;
public InterpStyle InterpStyle;
[Tooltip("Index in Weapon.FireSelector_Modes that this secondary toggle will override (e.g. 1)")]
public int ModeIndexToSub = 1;
public FireSelectorMode[] Modes;
private int CurModeIndex;
private FireSelectorMode[] _backupModes;
private FireSelectorMode[] _backupModes2;
private bool _isGloballySafe;
public override void Awake()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).Awake();
if (Modes == null || Modes.Length < 2)
{
Modes = (FireSelectorMode[])(object)new FireSelectorMode[2];
FireSelectorMode[] modes = Modes;
FireSelectorMode val = new FireSelectorMode();
val.SelectorPosition = 0f;
val.ModeType = (FireSelectorModeType)0;
val.BurstAmount = 0;
val.ARStyleBurst = false;
val.EngagementDelay = 0f;
modes[0] = val;
FireSelectorMode[] modes2 = Modes;
val = new FireSelectorMode();
val.SelectorPosition = 0f;
val.ModeType = (FireSelectorModeType)1;
val.BurstAmount = 1;
val.ARStyleBurst = false;
val.EngagementDelay = 0f;
modes2[1] = val;
}
if ((Object)(object)Weapon != (Object)null && Weapon.FireSelector_Modes != null && ModeIndexToSub >= 0 && ModeIndexToSub < Weapon.FireSelector_Modes.Length)
{
FireSelectorMode val2 = Weapon.FireSelector_Modes[ModeIndexToSub];
if ((int)val2.ModeType == 0)
{
CurModeIndex = 0;
}
else
{
CurModeIndex = 1;
FireSelectorMode[] modes3 = Modes;
FireSelectorMode val = new FireSelectorMode();
val.SelectorPosition = val2.SelectorPosition;
val.ModeType = val2.ModeType;
val.BurstAmount = val2.BurstAmount;
val.ARStyleBurst = val2.ARStyleBurst;
val.EngagementDelay = val2.EngagementDelay;
modes3[1] = val;
}
if ((Object)(object)SelctorSwitch != (Object)null)
{
((FVRPhysicalObject)Weapon).SetAnimatedComponent(SelctorSwitch, Modes[CurModeIndex].SelectorPosition, InterpStyle, Axis);
}
}
}
public override void SimpleInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).SimpleInteraction(hand);
CycleMode();
}
private void CycleMode()
{
if (!((Object)(object)Weapon == (Object)null) && Weapon.FireSelector_Modes != null && ModeIndexToSub >= 0 && ModeIndexToSub < Weapon.FireSelector_Modes.Length && Modes != null && Modes.Length >= 2)
{
CurModeIndex++;
if (CurModeIndex >= Modes.Length)
{
CurModeIndex = 0;
}
if (CurModeIndex == 0)
{
EnableGlobalSafe();
}
else
{
DisableGlobalSafeAndRestore();
}
((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)15, 1f);
}
}
private void EnableGlobalSafe()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//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_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//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_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
FireSelectorMode[] fireSelector_Modes = Weapon.FireSelector_Modes;
_backupModes = (FireSelectorMode[])(object)new FireSelectorMode[fireSelector_Modes.Length];
for (int i = 0; i < fireSelector_Modes.Length; i++)
{
FireSelectorMode val = fireSelector_Modes[i];
FireSelectorMode[] backupModes = _backupModes;
int num = i;
FireSelectorMode val2 = new FireSelectorMode();
val2.SelectorPosition = val.SelectorPosition;
val2.ModeType = val.ModeType;
val2.BurstAmount = val.BurstAmount;
val2.ARStyleBurst = val.ARStyleBurst;
val2.EngagementDelay = val.EngagementDelay;
backupModes[num] = val2;
}
if (Weapon.FireSelector_Modes2 != null)
{
FireSelectorMode[] fireSelector_Modes2 = Weapon.FireSelector_Modes2;
_backupModes2 = (FireSelectorMode[])(object)new FireSelectorMode[fireSelector_Modes2.Length];
for (int j = 0; j < fireSelector_Modes2.Length; j++)
{
FireSelectorMode val3 = fireSelector_Modes2[j];
FireSelectorMode[] backupModes2 = _backupModes2;
int num2 = j;
FireSelectorMode val2 = new FireSelectorMode();
val2.SelectorPosition = val3.SelectorPosition;
val2.ModeType = val3.ModeType;
val2.BurstAmount = val3.BurstAmount;
val2.ARStyleBurst = val3.ARStyleBurst;
val2.EngagementDelay = val3.EngagementDelay;
backupModes2[num2] = val2;
}
}
else
{
_backupModes2 = null;
}
for (int k = 0; k < Weapon.FireSelector_Modes.Length; k++)
{
Weapon.FireSelector_Modes[k].ModeType = (FireSelectorModeType)0;
Weapon.FireSelector_Modes[k].BurstAmount = 0;
}
if (Weapon.FireSelector_Modes2 != null)
{
for (int l = 0; l < Weapon.FireSelector_Modes2.Length; l++)
{
Weapon.FireSelector_Modes2[l].ModeType = (FireSelectorModeType)0;
Weapon.FireSelector_Modes2[l].BurstAmount = 0;
}
}
float selectorPosition = Modes[0].SelectorPosition;
if ((Object)(object)SelctorSwitch != (Object)null)
{
((FVRPhysicalObject)Weapon).SetAnimatedComponent(SelctorSwitch, selectorPosition, InterpStyle, Axis);
}
Weapon.ResetCamBurst();
_isGloballySafe = true;
Debug.Log((object)"SafetyToggle: Global safe enabled.");
}
private void DisableGlobalSafeAndRestore()
{
//IL_005d: 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_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
if (!_isGloballySafe)
{
ApplyModeToWeapon(1);
return;
}
if (_backupModes != null)
{
int num = Math.Min(_backupModes.Length, Weapon.FireSelector_Modes.Length);
for (int i = 0; i < num; i++)
{
Weapon.FireSelector_Modes[i].ModeType = _backupModes[i].ModeType;
Weapon.FireSelector_Modes[i].BurstAmount = _backupModes[i].BurstAmount;
Weapon.FireSelector_Modes[i].ARStyleBurst = _backupModes[i].ARStyleBurst;
Weapon.FireSelector_Modes[i].EngagementDelay = _backupModes[i].EngagementDelay;
Weapon.FireSelector_Modes[i].SelectorPosition = _backupModes[i].SelectorPosition;
}
}
if (_backupModes2 != null && Weapon.FireSelector_Modes2 != null)
{
int num2 = Math.Min(_backupModes2.Length, Weapon.FireSelector_Modes2.Length);
for (int j = 0; j < num2; j++)
{
Weapon.FireSelector_Modes2[j].ModeType = _backupModes2[j].ModeType;
Weapon.FireSelector_Modes2[j].BurstAmount = _backupModes2[j].BurstAmount;
Weapon.FireSelector_Modes2[j].ARStyleBurst = _backupModes2[j].ARStyleBurst;
Weapon.FireSelector_Modes2[j].EngagementDelay = _backupModes2[j].EngagementDelay;
Weapon.FireSelector_Modes2[j].SelectorPosition = _backupModes2[j].SelectorPosition;
}
}
float selectorPosition = Modes[1].SelectorPosition;
if (Weapon.FireSelector_Modes != null && ModeIndexToSub >= 0 && ModeIndexToSub < Weapon.FireSelector_Modes.Length)
{
selectorPosition = Weapon.FireSelector_Modes[ModeIndexToSub].SelectorPosition;
}
if ((Object)(object)SelctorSwitch != (Object)null)
{
((FVRPhysicalObject)Weapon).SetAnimatedComponent(SelctorSwitch, selectorPosition, InterpStyle, Axis);
}
Weapon.ResetCamBurst();
_isGloballySafe = false;
Debug.Log((object)"SafetyToggle: Global safe disabled, original modes restored.");
}
private void ApplyModeToWeapon(int modeIndex)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
FireSelectorMode val = Modes[modeIndex];
if ((Object)(object)SelctorSwitch != (Object)null)
{
((FVRPhysicalObject)Weapon).SetAnimatedComponent(SelctorSwitch, val.SelectorPosition, InterpStyle, Axis);
}
FireSelectorMode val2 = Weapon.FireSelector_Modes[ModeIndexToSub];
val2.ModeType = val.ModeType;
val2.BurstAmount = val.BurstAmount;
val2.ARStyleBurst = val.ARStyleBurst;
val2.EngagementDelay = val.EngagementDelay;
val2.SelectorPosition = val.SelectorPosition;
if (Weapon.FireSelector_Modes2 != null && ModeIndexToSub >= 0 && ModeIndexToSub < Weapon.FireSelector_Modes2.Length)
{
FireSelectorMode val3 = Weapon.FireSelector_Modes2[ModeIndexToSub];
val3.ModeType = val2.ModeType;
val3.BurstAmount = val2.BurstAmount;
val3.ARStyleBurst = val2.ARStyleBurst;
val3.EngagementDelay = val2.EngagementDelay;
val3.SelectorPosition = val2.SelectorPosition;
}
Weapon.ResetCamBurst();
}
}
public class AudioConsistencyEnforcer : MonoBehaviour
{
[Header("Audio Profiles")]
public FVRFirearmAudioSet BaseHandlingAudioProfile;
private FVRFireArm _firearm;
private FVRFirearmAudioSet _lastAudioClipSet;
private void Awake()
{
_firearm = ((Component)this).GetComponent<FVRFireArm>();
if ((Object)(object)_firearm != (Object)null && (Object)(object)_firearm.AudioClipSet != (Object)null)
{
_lastAudioClipSet = _firearm.AudioClipSet;
BaseHandlingAudioProfile = ScriptableObject.CreateInstance<FVRFirearmAudioSet>();
SaveBaseHandlingAudio(_lastAudioClipSet);
}
else
{
Debug.LogError((object)"AudioConsistencyEnforcer: No FVRFireArm or AudioClipSet found on the object!");
}
}
private void LateUpdate()
{
if ((Object)(object)_firearm == (Object)null)
{
return;
}
FVRFirearmAudioSet audioClipSet = _firearm.AudioClipSet;
if ((Object)(object)audioClipSet == (Object)null)
{
Debug.LogWarning((object)"AudioConsistencyEnforcer: AudioClipSet is null!");
return;
}
if ((Object)(object)audioClipSet != (Object)(object)_lastAudioClipSet)
{
_lastAudioClipSet = audioClipSet;
}
EnforceHandlingSounds(audioClipSet);
}
private void SaveBaseHandlingAudio(FVRFirearmAudioSet source)
{
BaseHandlingAudioProfile.BoltRelease = source.BoltRelease;
BaseHandlingAudioProfile.BoltSlideBack = source.BoltSlideBack;
BaseHandlingAudioProfile.BoltSlideForward = source.BoltSlideForward;
BaseHandlingAudioProfile.BoltSlideBackHeld = source.BoltSlideBackHeld;
BaseHandlingAudioProfile.BoltSlideBackLocked = source.BoltSlideBackLocked;
BaseHandlingAudioProfile.BreachOpen = source.BreachOpen;
BaseHandlingAudioProfile.BreachClose = source.BreachClose;
BaseHandlingAudioProfile.CatchOnSear = source.CatchOnSear;
BaseHandlingAudioProfile.ChamberManual = source.ChamberManual;
BaseHandlingAudioProfile.FireSelector = source.FireSelector;
BaseHandlingAudioProfile.HammerHit = source.HammerHit;
BaseHandlingAudioProfile.HandleBack = source.HandleBack;
BaseHandlingAudioProfile.HandleBackEmpty = source.HandleBackEmpty;
BaseHandlingAudioProfile.HandleForward = source.HandleForward;
BaseHandlingAudioProfile.HandleForwardEmpty = source.HandleForwardEmpty;
BaseHandlingAudioProfile.HandleUp = source.HandleUp;
BaseHandlingAudioProfile.HandleDown = source.HandleDown;
BaseHandlingAudioProfile.HandleGrab = source.HandleGrab;
BaseHandlingAudioProfile.Prefire = source.Prefire;
BaseHandlingAudioProfile.Safety = source.Safety;
BaseHandlingAudioProfile.TriggerReset = source.TriggerReset;
BaseHandlingAudioProfile.TopCoverRelease = source.TopCoverRelease;
BaseHandlingAudioProfile.TopCoverUp = source.TopCoverUp;
BaseHandlingAudioProfile.TopCoverDown = source.TopCoverDown;
BaseHandlingAudioProfile.StockOpen = source.StockOpen;
BaseHandlingAudioProfile.StockClosed = source.StockClosed;
BaseHandlingAudioProfile.BipodOpen = source.BipodOpen;
BaseHandlingAudioProfile.BipodClosed = source.BipodClosed;
BaseHandlingAudioProfile.BeltGrab = source.BeltGrab;
BaseHandlingAudioProfile.BeltRelease = source.BeltRelease;
BaseHandlingAudioProfile.BeltSeat = source.BeltSeat;
BaseHandlingAudioProfile.BeltSettle = source.BeltSettle;
Debug.Log((object)"AudioConsistencyEnforcer: Base handling audio saved successfully!");
}
private void EnforceHandlingSounds(FVRFirearmAudioSet targetProfile)
{
targetProfile.BoltRelease = BaseHandlingAudioProfile.BoltRelease;
targetProfile.BoltSlideBack = BaseHandlingAudioProfile.BoltSlideBack;
targetProfile.BoltSlideForward = BaseHandlingAudioProfile.BoltSlideForward;
targetProfile.BoltSlideBackHeld = BaseHandlingAudioProfile.BoltSlideBackHeld;
targetProfile.BoltSlideBackLocked = BaseHandlingAudioProfile.BoltSlideBackLocked;
targetProfile.BreachOpen = BaseHandlingAudioProfile.BreachOpen;
targetProfile.BreachClose = BaseHandlingAudioProfile.BreachClose;
targetProfile.CatchOnSear = BaseHandlingAudioProfile.CatchOnSear;
targetProfile.ChamberManual = BaseHandlingAudioProfile.ChamberManual;
targetProfile.FireSelector = BaseHandlingAudioProfile.FireSelector;
targetProfile.HammerHit = BaseHandlingAudioProfile.HammerHit;
targetProfile.HandleBack = BaseHandlingAudioProfile.HandleBack;
targetProfile.HandleBackEmpty = BaseHandlingAudioProfile.HandleBackEmpty;
targetProfile.HandleForward = BaseHandlingAudioProfile.HandleForward;
targetProfile.HandleForwardEmpty = BaseHandlingAudioProfile.HandleForwardEmpty;
targetProfile.HandleUp = BaseHandlingAudioProfile.HandleUp;
targetProfile.HandleDown = BaseHandlingAudioProfile.HandleDown;
targetProfile.HandleGrab = BaseHandlingAudioProfile.HandleGrab;
targetProfile.Prefire = BaseHandlingAudioProfile.Prefire;
targetProfile.Safety = BaseHandlingAudioProfile.Safety;
targetProfile.TriggerReset = BaseHandlingAudioProfile.TriggerReset;
targetProfile.TopCoverRelease = BaseHandlingAudioProfile.TopCoverRelease;
targetProfile.TopCoverUp = BaseHandlingAudioProfile.TopCoverUp;
targetProfile.TopCoverDown = BaseHandlingAudioProfile.TopCoverDown;
targetProfile.StockOpen = BaseHandlingAudioProfile.StockOpen;
targetProfile.StockClosed = BaseHandlingAudioProfile.StockClosed;
targetProfile.BipodOpen = BaseHandlingAudioProfile.BipodOpen;
targetProfile.BipodClosed = BaseHandlingAudioProfile.BipodClosed;
targetProfile.BeltGrab = BaseHandlingAudioProfile.BeltGrab;
targetProfile.BeltRelease = BaseHandlingAudioProfile.BeltRelease;
targetProfile.BeltSeat = BaseHandlingAudioProfile.BeltSeat;
targetProfile.BeltSettle = BaseHandlingAudioProfile.BeltSettle;
}
}
public class BoltActionDustCover : FVRInteractiveObject
{
public FVRFireArm BoltActionRifle;
public BoltActionRifle_Handle BoltActionRifle_Handle;
public Transform DustCoverGeo;
private bool m_isOpen;
public float OpenRot;
public float ClosedRot;
public float RotSpeed = 360f;
private float m_curRot;
private float m_tarRot;
public AudioEvent AudEvent_CoverOpen;
public AudioEvent AudEvent_CoverClose;
public override void Awake()
{
((FVRInteractiveObject)this).Awake();
m_curRot = ClosedRot;
m_tarRot = ClosedRot;
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
if ((Object)(object)BoltActionRifle_Handle != (Object)null && (int)BoltActionRifle_Handle.HandleRot == 2)
{
if (m_isOpen)
{
Close();
}
else
{
Open();
}
}
else if ((Object)(object)BoltActionRifle_Handle != (Object)null && (int)BoltActionRifle_Handle.HandleRot == 0 && m_isOpen)
{
Close();
}
}
private void ToggleDustCoverState()
{
if (m_isOpen)
{
Close();
}
else
{
Open();
}
}
public override void FVRUpdate()
{
//IL_0029: 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)
((FVRInteractiveObject)this).FVRUpdate();
if (!m_isOpen && (Object)(object)BoltActionRifle_Handle != (Object)null && (int)BoltActionRifle_Handle.HandleRot == 0)
{
Open();
}
if (Mathf.Abs(m_tarRot - m_curRot) > 0.01f)
{
m_curRot = Mathf.MoveTowards(m_curRot, m_tarRot, Time.deltaTime * RotSpeed);
if ((Object)(object)DustCoverGeo != (Object)null)
{
DustCoverGeo.localEulerAngles = new Vector3(0f, 0f, m_curRot);
}
}
}
private void Open()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (!m_isOpen)
{
m_isOpen = true;
m_tarRot = OpenRot;
RotSpeed = 1900f;
if (AudEvent_CoverOpen != null && (Object)(object)BoltActionRifle != (Object)null)
{
BoltActionRifle.PlayAudioAsHandling(AudEvent_CoverOpen, ((Component)this).transform.position);
}
}
}
private void Close()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (m_isOpen)
{
m_isOpen = false;
m_tarRot = ClosedRot;
RotSpeed = 800f;
if (AudEvent_CoverClose != null && (Object)(object)BoltActionRifle != (Object)null)
{
BoltActionRifle.PlayAudioAsHandling(AudEvent_CoverClose, ((Component)this).transform.position);
}
}
}
}