using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using H3VRUtils;
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]
public class FireAttachableFireSelector : MonoBehaviour
{
[Header("Selector Settings")]
public Transform selectorTransform;
public Vector3 onRotation = new Vector3(0f, 45f, 0f);
private Quaternion startRot;
private bool isOn;
private FVRPhysicalObject rootFPO;
private 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)
if ((Object)(object)selectorTransform == (Object)null)
{
selectorTransform = ((Component)this).transform;
}
startRot = selectorTransform.localRotation;
rootFPO = ((Component)this).GetComponentInParent<FVRPhysicalObject>();
if ((Object)(object)rootFPO == (Object)null)
{
Debug.LogError((object)"[FireSelector] No FVRPhysicalObject found in parents!");
}
}
private void Update()
{
//IL_007b: 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_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)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rootFPO == (Object)null) && ((FVRInteractiveObject)rootFPO).IsHeld && !((Object)(object)((FVRInteractiveObject)rootFPO).m_hand == (Object)null))
{
HandleInput(((FVRInteractiveObject)rootFPO).m_hand);
selectorTransform.localRotation = ((!isOn) ? startRot : (startRot * Quaternion.Euler(onRotation)));
}
}
private void HandleInput(FVRViveHand hand)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_005f: Unknown result type (might be due to invalid IL or missing references)
HandInput input = hand.Input;
if (hand.IsInStreamlinedMode)
{
if (input.BYButtonDown)
{
isOn = !isOn;
}
}
else if (input.TouchpadDown && ((Vector2)(ref input.TouchpadAxes)).magnitude > 0.2f && Vector2.Angle(input.TouchpadAxes, Vector2.left) <= 45f)
{
isOn = !isOn;
}
}
}
namespace Volks.20x28mmB_Ammo;
[BepInPlugin("Volks.20x28mmB_Ammo", "20x28mmB_Ammo", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class 20x28mmB_AmmoPlugin : 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.20x28mmB_Ammo");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.20x28mmB_Ammo", "", "", "20x28mmb_ammo", "");
}
}
public class AltGrip_Rear : FVRAlternateGrip
{
[Header("Rear Grip Pose (world)")]
public Transform RearPosePoint;
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0037: 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)
((FVRAlternateGrip)this).UpdateInteraction(hand);
if ((Object)(object)((FVRInteractiveObject)this).PoseOverride != (Object)null && (Object)(object)RearPosePoint != (Object)null)
{
((FVRInteractiveObject)this).PoseOverride.SetPositionAndRotation(RearPosePoint.position, RearPosePoint.rotation);
}
}
}
public class BreakOpenFlareGun_NoHammerSafe : BreakOpenFlareGun
{
public enum LatchAxisType
{
X,
Y,
Z
}
private float m_triggerFloat;
private bool m_hasTriggerReset = true;
[Header("Safety (ClosedBolt-style)")]
public bool HasSafety = true;
public Transform SafetySelector;
public Axis SafetyAxis = (Axis)0;
public InterpStyle SafetyInterpStyle = (InterpStyle)1;
public float SafetyOffPosition = 0f;
public float SafetyOnPosition = 1f;
public bool SafetyOn = false;
[Header("Auto‑eject on latch open")]
public FVRInteractiveObject LatchObject;
public Transform LatchVisual;
public LatchAxisType LatchAxis = LatchAxisType.Z;
public float LatchEjectAngleThreshold = 30f;
public ? EjectAxis = 1;
public float EjectOffset = 0.06f;
public Vector3 EjectVelocity = new Vector3(0f, 0f, 0.12f);
public Vector3 EjectAngular = Vector3.zero;
private bool m_prevLatchOpen = false;
private float m_latchBaseAngle = 0f;
private const float TriggerFiringThreshold = 0.8f;
private const float TriggerResetThreshold = 0.4f;
public override void Awake()
{
//IL_0045: 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)
((BreakOpenFlareGun)this).Awake();
base.CocksOnOpen = false;
base.CanCockHammer = false;
base.HasVisibleHammer = false;
base.Hammer = null;
base.CanUnlatch = false;
if ((Object)(object)LatchVisual != (Object)null)
{
m_latchBaseAngle = NormalizeAngle(GetAxisAngle(LatchVisual.localEulerAngles, LatchAxis));
}
else if ((Object)(object)LatchObject != (Object)null)
{
Transform val = FindLatchVisualFromObject(LatchObject);
if ((Object)(object)val != (Object)null)
{
LatchVisual = val;
m_latchBaseAngle = NormalizeAngle(GetAxisAngle(LatchVisual.localEulerAngles, LatchAxis));
}
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_004d: 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_0075: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
if (((FVRPhysicalObject)this).IsAltHeld)
{
return;
}
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown && HasSafety)
{
ToggleSafety();
}
}
else
{
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.left) <= 45f && HasSafety)
{
ToggleSafety();
}
}
m_triggerFloat = hand.Input.TriggerFloat;
if ((Object)(object)base.Trigger != (Object)null)
{
float num = Mathf.Lerp(base.TriggerForwardBackRots.x, base.TriggerForwardBackRots.y, m_triggerFloat);
base.Trigger.localEulerAngles = new Vector3(num, 0f, 0f);
}
if (!m_hasTriggerReset && m_triggerFloat <= 0.4f)
{
m_hasTriggerReset = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
}
if ((!HasSafety || !SafetyOn) && m_triggerFloat >= 0.8f && m_hasTriggerReset && !IsLatchOpen())
{
m_hasTriggerReset = false;
FireWithoutHammer();
}
}
public void ToggleSafety()
{
//IL_0065: 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)
if (HasSafety)
{
SafetyOn = !SafetyOn;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
if ((Object)(object)SafetySelector != (Object)null)
{
float num = ((!SafetyOn) ? SafetyOffPosition : SafetyOnPosition);
((FVRPhysicalObject)this).SetAnimatedComponent(SafetySelector, num, SafetyInterpStyle, SafetyAxis);
}
}
}
private void FireWithoutHammer()
{
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.Chamber == (Object)null || !base.Chamber.Fire())
{
return;
}
try
{
((FVRFireArm)this).Fire(base.Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
}
catch (Exception)
{
try
{
((BreakOpenFlareGun)this).Fire();
}
catch
{
}
}
((FVRFireArm)this).FireMuzzleSmoke();
try
{
if ((Object)(object)base.Chamber != (Object)null && (Object)(object)base.Chamber.GetRound() != (Object)null)
{
((FVRFireArm)this).PlayAudioGunShot(base.Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
}
}
catch
{
}
try
{
bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
try
{
((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
}
catch
{
}
}
catch
{
}
try
{
if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
{
base.Chamber.IsSpent = false;
base.Chamber.UpdateProxyDisplay();
}
else if ((Object)(object)base.Chamber.GetRound() != (Object)null && base.Chamber.GetRound().IsCaseless)
{
base.Chamber.SetRound((FVRFireArmRound)null, false);
}
if (base.DeletesCartridgeOnFire)
{
base.Chamber.SetRound((FVRFireArmRound)null, false);
}
}
catch
{
}
}
public override void FVRUpdate()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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)
((BreakOpenFlareGun)this).FVRUpdate();
if (HasSafety && (Object)(object)SafetySelector != (Object)null)
{
float num = ((!SafetyOn) ? SafetyOffPosition : SafetyOnPosition);
((FVRPhysicalObject)this).SetAnimatedComponent(SafetySelector, num, SafetyInterpStyle, SafetyAxis);
}
bool flag = false;
if ((Object)(object)LatchVisual != (Object)null)
{
float num2 = NormalizeAngle(GetAxisAngle(LatchVisual.localEulerAngles, LatchAxis));
float num3 = Mathf.Abs(NormalizeAngle(num2 - m_latchBaseAngle));
flag = num3 >= Mathf.Abs(LatchEjectAngleThreshold);
}
else if ((Object)(object)LatchObject != (Object)null)
{
Type type = ((object)LatchObject).GetType();
PropertyInfo property = type.GetProperty("IsOpen", BindingFlags.Instance | BindingFlags.Public);
if ((object)property != null && (object)property.PropertyType == typeof(bool))
{
try
{
flag = (bool)property.GetValue(LatchObject, null);
}
catch
{
flag = false;
}
}
else
{
FieldInfo field = type.GetField("IsOpen", BindingFlags.Instance | BindingFlags.Public);
if ((object)field != null && (object)field.FieldType == typeof(bool))
{
try
{
flag = (bool)field.GetValue(LatchObject);
}
catch
{
flag = false;
}
}
else
{
MethodInfo method = type.GetMethod("IsOpen", BindingFlags.Instance | BindingFlags.Public);
if ((object)method != null && (object)method.ReturnType == typeof(bool) && method.GetParameters().Length == 0)
{
try
{
flag = (bool)method.Invoke(LatchObject, null);
}
catch
{
flag = false;
}
}
}
}
}
if (flag && !m_prevLatchOpen)
{
((MonoBehaviour)this).StartCoroutine(DelayedEjectOneFrame());
}
m_prevLatchOpen = flag;
}
private IEnumerator DelayedEjectOneFrame()
{
yield return null;
TryAutoEjectSpent();
}
private void TryAutoEjectSpent()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//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)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_007b: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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_00b2: 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_00c7: 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)
//IL_00e1: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!((Object)(object)base.Chamber == (Object)null) && base.Chamber.IsFull && base.Chamber.IsSpent)
{
_ = ((Component)base.Chamber).transform;
Vector3 ejectDirection = (Vector3)((BreakOpenFlareGun_NoHammerSafe)EjectAxis).GetEjectDirection();
Vector3 val = ((Component)base.Chamber).transform.position + ejectDirection * Mathf.Abs(EjectOffset);
Vector3 val2 = ejectDirection * Mathf.Abs(EjectVelocity.z) + ((Component)base.Chamber).transform.up * EjectVelocity.y + ((Component)base.Chamber).transform.right * EjectVelocity.x;
FVRFireArmRound val3 = base.Chamber.EjectRound(val, val2, EjectAngular, false);
}
}
catch (Exception)
{
}
}
private ? GetEjectDirection()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_0054: 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_0060: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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)
return /*Error near IL_0001: ldarg 2 (out-of-bounds)*/switch
{
(?)0L => ((Transform)/*Error near IL_0020: ldarg 1 (out-of-bounds)*/).forward,
(?)1L => -((Transform)/*Error near IL_002c: ldarg 1 (out-of-bounds)*/).forward,
(?)2L => ((Transform)/*Error near IL_003d: ldarg 1 (out-of-bounds)*/).right,
(?)3L => -((Transform)/*Error near IL_0049: ldarg 1 (out-of-bounds)*/).right,
(?)4L => ((Transform)/*Error near IL_005a: ldarg 1 (out-of-bounds)*/).up,
_ => -((Transform)/*Error near IL_0066: ldarg 1 (out-of-bounds)*/).up,
};
}
private float GetAxisAngle(Vector3 euler, LatchAxisType axis)
{
return axis switch
{
LatchAxisType.X => euler.x,
LatchAxisType.Y => euler.y,
_ => euler.z,
};
}
private float NormalizeAngle(float a)
{
while (a > 180f)
{
a -= 360f;
}
while (a < -180f)
{
a += 360f;
}
return a;
}
private Transform FindLatchVisualFromObject(FVRInteractiveObject obj)
{
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
if ((Object)(object)obj == (Object)null)
{
return null;
}
Type type = ((object)obj).GetType();
string[] array = new string[5] { "LatchVisual", "LatchTransform", "DustCoverGeo", "DustCover", "Latch" };
string[] array2 = array;
foreach (string name in array2)
{
FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public);
if ((object)field != null && (object)field.FieldType == typeof(Transform))
{
try
{
return (Transform)field.GetValue(obj);
}
catch
{
}
}
PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public);
if ((object)property != null && (object)property.PropertyType == typeof(Transform))
{
try
{
return (Transform)property.GetValue(obj, null);
}
catch
{
}
}
}
MeshRenderer componentInChildren = ((Component)obj).GetComponentInChildren<MeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
return ((Component)componentInChildren).transform;
}
SkinnedMeshRenderer componentInChildren2 = ((Component)obj).GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
return ((Component)componentInChildren2).transform;
}
return null;
}
private bool IsLatchOpen()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
bool result = false;
if ((Object)(object)LatchVisual != (Object)null)
{
float num = NormalizeAngle(GetAxisAngle(LatchVisual.localEulerAngles, LatchAxis));
float num2 = Mathf.Abs(NormalizeAngle(num - m_latchBaseAngle));
result = num2 >= Mathf.Abs(LatchEjectAngleThreshold);
}
else if ((Object)(object)LatchObject != (Object)null)
{
Type type = ((object)LatchObject).GetType();
PropertyInfo property = type.GetProperty("IsOpen", BindingFlags.Instance | BindingFlags.Public);
if ((object)property != null && (object)property.PropertyType == typeof(bool))
{
try
{
result = (bool)property.GetValue(LatchObject, null);
}
catch
{
result = false;
}
}
else
{
FieldInfo field = type.GetField("IsOpen", BindingFlags.Instance | BindingFlags.Public);
if ((object)field != null && (object)field.FieldType == typeof(bool))
{
try
{
result = (bool)field.GetValue(LatchObject);
}
catch
{
result = false;
}
}
else
{
MethodInfo method = type.GetMethod("IsOpen", BindingFlags.Instance | BindingFlags.Public);
if ((object)method != null && (object)method.ReturnType == typeof(bool) && method.GetParameters().Length == 0)
{
try
{
result = (bool)method.Invoke(LatchObject, null);
}
catch
{
result = false;
}
}
}
}
}
return result;
}
}
public class Pansarvarnsgevar_Latch : FVRInteractiveObject
{
public enum LatchAxis
{
X,
Y,
Z
}
public enum State
{
Closed,
Middle,
Open
}
public enum PGLatchState
{
Closed,
Middle,
Open
}
public Transform LatchVisual;
public Transform BreechPivot;
public Vector3 BreechClosedLocalEuler;
public Vector3 BreechOpenLocalEuler;
public float RotMin = 0f;
public float RotMax = 90f;
public bool IsMinOpen = false;
public float UnlockRotMin = 0f;
public float UnlockRotMax = 15f;
public float UnlockThreshold = 10f;
public float RotateSpeed = 900f;
public float UnlockSpeed = 900f;
public AudioEvent AudEvent_Open;
public AudioEvent AudEvent_Close;
public bool DebugLatch;
private float m_curRot;
private float m_tarRot;
private float m_curUnlockRot;
private float m_tarUnlockRot;
private bool m_isUnlocked;
private Vector3 m_baseLocalEuler;
public LatchAxis RotateAxis = LatchAxis.Y;
public LatchAxis RotateReferenceAxis = LatchAxis.Z;
public LatchAxis UnlockAxis = LatchAxis.X;
public LatchAxis UnlockReferenceAxis = LatchAxis.Z;
private State m_state = State.Closed;
public PGLatchState LState
{
get
{
return (PGLatchState)m_state;
}
set
{
m_state = (State)value;
}
}
protected void Awake()
{
//IL_005f: 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_0064: 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)
((FVRInteractiveObject)this).Awake();
m_curRot = GetClosedRot();
m_tarRot = m_curRot;
m_curUnlockRot = UnlockRotMin;
m_tarUnlockRot = m_curUnlockRot;
m_baseLocalEuler = ((!((Object)(object)LatchVisual != (Object)null)) ? ((Component)this).transform.localEulerAngles : LatchVisual.localEulerAngles);
if (DebugLatch)
{
Debug.Log((object)string.Concat("[Pansarvarnsgevar_Latch] Awake - baseLocalEuler=", m_baseLocalEuler, " LatchVisual=", (!Object.op_Implicit((Object)(object)LatchVisual)) ? "null" : ((Object)LatchVisual).name));
}
}
public override bool IsInteractable()
{
bool flag = ((FVRInteractiveObject)this).IsInteractable();
if (DebugLatch)
{
Debug.Log((object)("[Pansarvarnsgevar_Latch] IsInteractable -> " + flag));
}
return flag;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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_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_002c: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).UpdateInteraction(hand);
Transform transform = ((Component)this).transform;
Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)this).transform.position;
float signedAngle = GetSignedAngle(val, GetAxisVector(UnlockReferenceAxis, transform), GetAxisVector(UnlockAxis, transform));
signedAngle = (m_tarUnlockRot = Mathf.Clamp(signedAngle, UnlockRotMin, UnlockRotMax));
float signedAngle2 = GetSignedAngle(val, GetAxisVector(RotateReferenceAxis, transform), GetAxisVector(RotateAxis, transform));
signedAngle2 = Mathf.Clamp(signedAngle2, RotMin, RotMax);
if (DebugLatch)
{
Debug.Log((object)("[Pansarvarnsgevar_Latch] UpdateInteraction unlock=" + signedAngle + " rot=" + signedAngle2 + " isUnlocked=" + m_isUnlocked + " state=" + m_state));
}
if (m_state == State.Closed && !m_isUnlocked)
{
if (!(m_tarUnlockRot >= UnlockThreshold))
{
m_tarRot = GetClosedRot();
return;
}
m_isUnlocked = true;
if (DebugLatch)
{
Debug.Log((object)"[Pansarvarnsgevar_Latch] Unlocked by push");
}
}
m_tarRot = signedAngle2;
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).EndInteraction(hand);
float num = Mathf.Abs(m_curRot - RotMin);
float num2 = Mathf.Abs(m_curRot - RotMax);
m_tarRot = ((!(num < num2)) ? RotMax : RotMin);
m_isUnlocked = false;
m_tarUnlockRot = UnlockRotMin;
if (DebugLatch)
{
Debug.Log((object)("[Pansarvarnsgevar_Latch] EndInteraction snapped to " + m_tarRot));
}
}
protected void FVRUpdate()
{
((FVRInteractiveObject)this).FVRUpdate();
if (m_state == State.Closed)
{
m_tarUnlockRot = UnlockRotMin;
m_isUnlocked = false;
}
if (Mathf.Abs(m_curRot - m_tarRot) > 0.001f || Mathf.Abs(m_curUnlockRot - m_tarUnlockRot) > 0.001f)
{
m_curRot = Mathf.MoveTowards(m_curRot, m_tarRot, Time.deltaTime * RotateSpeed);
m_curUnlockRot = Mathf.MoveTowards(m_curUnlockRot, m_tarUnlockRot, Time.deltaTime * UnlockSpeed);
ApplyLatchRotation();
float num = Mathf.Abs(m_curRot - RotMin);
float num2 = Mathf.Abs(m_curRot - RotMax);
State state = m_state;
if (num < 1f)
{
m_state = (IsMinOpen ? State.Open : State.Closed);
}
else if (num2 < 1f)
{
m_state = ((!IsMinOpen) ? State.Open : State.Closed);
}
else
{
m_state = State.Middle;
}
if (m_state != state)
{
if (DebugLatch)
{
Debug.Log((object)string.Concat("[Pansarvarnsgevar_Latch] State changed ", state, " -> ", m_state));
}
if (m_state == State.Open)
{
if (AudEvent_Open == null)
{
}
}
else if (m_state == State.Closed && AudEvent_Close == null)
{
}
}
}
UpdateBreechPivot();
}
private void ApplyLatchRotation()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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)
Vector3 v = m_baseLocalEuler;
if (RotateAxis == UnlockAxis)
{
SetAxisValue(ref v, RotateAxis, m_curRot + m_curUnlockRot);
}
else
{
SetAxisValue(ref v, RotateAxis, m_curRot);
SetAxisValue(ref v, UnlockAxis, m_curUnlockRot);
}
Transform val = ((!((Object)(object)LatchVisual != (Object)null)) ? ((Component)this).transform : LatchVisual);
val.localRotation = Quaternion.Euler(v);
if (DebugLatch)
{
Debug.Log((object)string.Concat("[Pansarvarnsgevar_Latch] Applied: ", v, " -> ", (!Object.op_Implicit((Object)(object)val)) ? "null" : ((Object)val).name));
}
}
private void LateUpdate()
{
//IL_0018: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)LatchVisual == (Object)null))
{
Vector3 v = m_baseLocalEuler;
if (RotateAxis == UnlockAxis)
{
SetAxisValue(ref v, RotateAxis, m_curRot + m_curUnlockRot);
}
else
{
SetAxisValue(ref v, RotateAxis, m_curRot);
SetAxisValue(ref v, UnlockAxis, m_curUnlockRot);
}
LatchVisual.localRotation = Quaternion.Euler(v);
}
}
private void UpdateBreechPivot()
{
//IL_004a: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)BreechPivot == (Object)null))
{
float num = ((!IsMinOpen) ? RotMax : RotMin);
float closedRot = GetClosedRot();
float num2 = Mathf.InverseLerp(closedRot, num, m_curRot);
Vector3 localEulerAngles = Vector3.Lerp(BreechClosedLocalEuler, BreechOpenLocalEuler, num2);
BreechPivot.localEulerAngles = localEulerAngles;
}
}
private float GetClosedRot()
{
return (!IsMinOpen) ? RotMin : RotMax;
}
private Vector3 GetAxisVector(LatchAxis axis, Transform basis)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0025: 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_0031: Unknown result type (might be due to invalid IL or missing references)
return (Vector3)(axis switch
{
LatchAxis.X => basis.right,
LatchAxis.Y => basis.up,
_ => basis.forward,
});
}
private void SetAxisValue(ref Vector3 v, LatchAxis axis, float value)
{
switch (axis)
{
case LatchAxis.X:
v.x = value;
break;
case LatchAxis.Y:
v.y = value;
break;
default:
v.z = value;
break;
}
}
public float GetSignedAngle(Vector3 from, Vector3 to, Vector3 axis)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_001b: 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_0028: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.ProjectOnPlane(from, axis);
from = ((Vector3)(ref val)).normalized;
Vector3 val2 = Vector3.Cross(axis, to);
float num = Mathf.Sign(Vector3.Dot(from, val2));
float num2 = Vector3.Angle(from, to);
return num2 * num;
}
public bool IsOpen()
{
return m_state == State.Open;
}
}
public class Pansarvarnsgevar_Launcher : FVRFireArm
{
public enum Axis
{
X,
Y,
Z
}
public enum AnimateMode
{
Rotation,
Translation
}
private List<Animator> m_disabledAnimators = new List<Animator>();
private List<bool> m_disabledAnimatorsPrevState = new List<bool>();
public FVRFireArmChamber Chamber;
public Pansarvarnsgevar_ShellEject ShellInsertEject;
public Pansarvarnsgevar_Latch TailLatch;
public Transform Trigger;
public AnimateMode TriggerAnimateMode = AnimateMode.Rotation;
public Axis TriggerAxis = Axis.X;
public float TriggerFiringThreshold = 0.8f;
public float TriggerResetThreshold = 0.4f;
public float Trigger_ForwardValue;
public float Trigger_RearwardValue;
public Transform SafetyLever;
public bool SafetyOn;
public AnimateMode SafetyAnimateMode = AnimateMode.Rotation;
public Axis SafetyAxis = Axis.X;
public float SafetyOnValue;
public float SafetyOffValue;
private float m_triggerFloat;
private float m_lastTriggerFloat;
private bool m_hasTriggerReset;
private Vector3 m_triggerBaseLocalEuler;
private Vector3 m_triggerBaseLocalPos;
private Vector3 m_safetyBaseLocalEuler;
private Vector3 m_safetyBaseLocalPos;
public AudioEvent AudEvent_BackSound;
public Transform COM;
public bool DebugSafetyInput;
public bool DebugSafetyAnim;
public bool DebugTriggerInput;
public bool DebugTriggerAnim;
protected void Awake()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).Awake();
base.FChambers.Add(Chamber);
((FVRPhysicalObject)this).RootRigidbody.centerOfMass = COM.localPosition;
ValidateAndAssignVisual(ref Trigger, ref m_triggerBaseLocalEuler, ref m_triggerBaseLocalPos, "trigger");
ValidateAndAssignVisual(ref SafetyLever, ref m_safetyBaseLocalEuler, ref m_safetyBaseLocalPos, "safety");
}
private void ValidateAndAssignVisual(ref Transform t, ref Vector3 baseEuler, ref Vector3 basePos, string hint)
{
//IL_00be: 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_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)
if ((Object)(object)t == (Object)null)
{
Transform val = FindChildByNameHint(((Component)this).transform, hint);
if ((Object)(object)val != (Object)null)
{
t = val;
Debug.Log((object)("[Pansarvarnsgevar_Launcher] Auto-assigned " + hint + " -> " + ((Object)val).name));
}
}
if (!((Object)(object)t != (Object)null))
{
return;
}
if (!((Object)(object)((Component)t).GetComponent<MeshRenderer>() != (Object)null) && !((Object)(object)((Component)t).GetComponent<SkinnedMeshRenderer>() != (Object)null))
{
Transform val2 = FindFirstMeshChild(t);
if ((Object)(object)val2 != (Object)null)
{
Debug.Log((object)("[Pansarvarnsgevar_Launcher] Repointing " + hint + " to mesh child: " + ((Object)val2).name));
t = val2;
}
}
baseEuler = t.localEulerAngles;
basePos = t.localPosition;
Animator componentInParent = ((Component)t).GetComponentInParent<Animator>();
if ((Object)(object)componentInParent != (Object)null && ((Behaviour)componentInParent).enabled)
{
m_disabledAnimators.Add(componentInParent);
m_disabledAnimatorsPrevState.Add(((Behaviour)componentInParent).enabled);
((Behaviour)componentInParent).enabled = false;
Debug.LogWarning((object)("[Pansarvarnsgevar_Launcher] Disabled Animator on '" + ((Object)((Component)componentInParent).gameObject).name + "' to allow manual trigger/safety animation. It will be restored on destroy."));
}
}
private Transform FindChildByNameHint(Transform root, string hint)
{
hint = hint.ToLowerInvariant();
Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
foreach (Transform val in componentsInChildren)
{
if (((Object)val).name.ToLowerInvariant().Contains(hint))
{
return val;
}
}
return null;
}
private Transform FindFirstMeshChild(Transform root)
{
MeshRenderer componentInChildren = ((Component)root).GetComponentInChildren<MeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
return ((Component)componentInChildren).transform;
}
SkinnedMeshRenderer componentInChildren2 = ((Component)root).GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
return ((Component)componentInChildren2).transform;
}
return null;
}
protected void FVRUpdate()
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).FVRUpdate();
Chamber.IsAccessible = (Object)(object)TailLatch != (Object)null && TailLatch.IsOpen();
float num = Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat);
if (Mathf.Abs(m_triggerFloat - m_lastTriggerFloat) > 0.0001f)
{
m_lastTriggerFloat = m_triggerFloat;
ApplyAnimatedAxis(Trigger, TriggerAnimateMode, TriggerAxis, num, m_triggerBaseLocalPos, m_triggerBaseLocalEuler);
if (DebugTriggerAnim)
{
Debug.Log((object)("[Pansarvarnsgevar_Launcher] TriggerAnim applied - value=" + num + " m_triggerFloat=" + m_triggerFloat + " target=" + ((!((Object)(object)Trigger != (Object)null)) ? "null" : ((Object)Trigger).name)));
}
}
float num2 = ((!SafetyOn) ? SafetyOffValue : SafetyOnValue);
Transform val = ((!((Object)(object)SafetyLever != (Object)null)) ? ((Component)this).transform : SafetyLever);
ApplyAnimatedAxis(val, SafetyAnimateMode, SafetyAxis, num2, m_safetyBaseLocalPos, m_safetyBaseLocalEuler);
if (DebugSafetyAnim)
{
Debug.Log((object)("[Pansarvarnsgevar_Launcher] SafetyAnim applied - value=" + num2 + " SafetyOn=" + SafetyOn + " target=" + ((Object)val).name));
}
}
private void LateUpdate()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Trigger != (Object)null)
{
Vector3 v = m_triggerBaseLocalEuler;
float num = Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat);
SetAxisValue(ref v, TriggerAxis, num);
Trigger.localEulerAngles = v;
if (DebugTriggerAnim)
{
Debug.Log((object)string.Concat("[Pansarvarnsgevar_Launcher] LateUpdate applied Trigger.euler = ", v, " (value=", num, ")"));
}
((MonoBehaviour)this).StartCoroutine(CheckOverwriteRotation(Trigger, Quaternion.Euler(v), "Launcher.Trigger"));
}
Transform val = ((!((Object)(object)SafetyLever != (Object)null)) ? ((Component)this).transform : SafetyLever);
if ((Object)(object)val != (Object)null)
{
Vector3 v2 = m_safetyBaseLocalEuler;
float num2 = ((!SafetyOn) ? SafetyOffValue : SafetyOnValue);
SetAxisValue(ref v2, SafetyAxis, num2);
val.localEulerAngles = v2;
if (DebugSafetyAnim)
{
Debug.Log((object)string.Concat("[Pansarvarnsgevar_Launcher] LateUpdate applied Safety.euler = ", v2, " (value=", num2, ") target=", ((Object)val).name));
}
((MonoBehaviour)this).StartCoroutine(CheckOverwriteRotation(val, Quaternion.Euler(v2), "Launcher.Safety"));
}
}
private IEnumerator CheckOverwriteRotation(Transform t, Quaternion expected, string name)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
yield return (object)new WaitForEndOfFrame();
if ((Object)(object)t == (Object)null || !(Quaternion.Angle(t.localRotation, expected) > 0.1f))
{
yield break;
}
Debug.LogWarning((object)string.Concat("[Pansarvarnsgevar_Launcher] Transform overwritten next frame: ", name, " Expected=", ((Quaternion)(ref expected)).eulerAngles, " Actual=", t.localEulerAngles));
MeshRenderer componentInChildren = ((Component)t).GetComponentInChildren<MeshRenderer>();
SkinnedMeshRenderer componentInChildren2 = ((Component)t).GetComponentInChildren<SkinnedMeshRenderer>();
Transform val = null;
if ((Object)(object)componentInChildren != (Object)null)
{
val = ((Component)componentInChildren).transform;
}
else if ((Object)(object)componentInChildren2 != (Object)null)
{
val = ((Component)componentInChildren2).transform;
}
if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)t)
{
Debug.Log((object)("[Pansarvarnsgevar_Launcher] Found mesh child '" + ((Object)val).name + "'. Reassigning target to it and applying rotation."));
if (name.Contains("Trigger"))
{
Trigger = val;
m_triggerBaseLocalEuler = val.localEulerAngles;
m_triggerBaseLocalPos = val.localPosition;
}
else if (name.Contains("Safety"))
{
SafetyLever = val;
m_safetyBaseLocalEuler = val.localEulerAngles;
m_safetyBaseLocalPos = val.localPosition;
}
Vector3 v = ((!name.Contains("Trigger")) ? m_safetyBaseLocalEuler : m_triggerBaseLocalEuler);
float value = (name.Contains("Trigger") ? Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat) : ((!SafetyOn) ? SafetyOffValue : SafetyOnValue));
SetAxisValue(ref v, (!name.Contains("Trigger")) ? SafetyAxis : TriggerAxis, value);
((!name.Contains("Trigger")) ? SafetyLever : Trigger).localEulerAngles = v;
}
}
private void ApplyAnimatedAxis(Transform target, AnimateMode mode, Axis axis, float value, Vector3 basePos, Vector3 baseEuler)
{
//IL_0040: 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_004f: 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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)target == (Object)null)
{
Debug.LogWarning((object)"[Pansarvarnsgevar_Launcher] ApplyAnimatedAxis - target is null!");
}
else if (mode == AnimateMode.Rotation)
{
Vector3 v = baseEuler;
SetAxisValue(ref v, axis, value);
target.localEulerAngles = v;
}
else
{
Vector3 v2 = basePos;
SetAxisValue(ref v2, axis, value);
target.localPosition = v2;
}
}
private void SetAxisValue(ref Vector3 v, Axis axis, float value)
{
switch (axis)
{
case Axis.X:
v.x = value;
break;
case Axis.Y:
v.y = value;
break;
default:
v.z = value;
break;
}
}
public void FixCOM()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)COM == (Object)null || (Object)(object)((FVRPhysicalObject)this).RootRigidbody == (Object)null)
{
Debug.LogWarning((object)"[Pansarvarnsgevar_Launcher] FixCOM skipped: COM or RootRigidbody null");
}
else
{
((FVRPhysicalObject)this).RootRigidbody.centerOfMass = COM.localPosition;
}
}
}
public class Pansarvarnsgevar_ShellEject : FVRInteractiveObject
{
public enum ChamberSlideState
{
In,
Middle,
Out
}
public Pansarvarnsgevar_Launcher PG;
public AudioEvent AudEvent_ShellInStart;
public AudioEvent AudEvent_ShellIn;
public AudioEvent AudEvent_ShellOutStart;
public AudioEvent AudEvent_ShellOut;
public Transform ChamberPoint_Back;
public Transform ChamberPoint_Forward;
public Collider Col;
public bool AllowEmptySlide = true;
public ChamberSlideState CSState = ChamberSlideState.Out;
private float m_curZ;
private float m_tarZ;
public float ZThreshold = 0.02f;
private float m_timeHeld;
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)
((FVRInteractiveObject)this).Awake();
m_curZ = ChamberPoint_Back.localPosition.z;
m_tarZ = m_curZ;
}
public override bool IsInteractable()
{
return PG.TailLatch.LState == Pansarvarnsgevar_Latch.PGLatchState.Open && (AllowEmptySlide || PG.Chamber.IsFull) && ((FVRInteractiveObject)this).IsInteractable();
}
public void AutoEjectIfChambered()
{
//IL_0034: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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)
if (PG.Chamber.IsFull)
{
SetSlideToBack();
((FVRFireArm)PG).PlayAudioAsHandling(AudEvent_ShellOut, ((Component)this).transform.position);
PG.Chamber.EjectRound(((Component)ChamberPoint_Back).transform.position, ChamberPoint_Back.forward * 0.1f, Vector3.zero, false);
PG.FixCOM();
}
}
private void SetSlideToBack()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
m_curZ = ChamberPoint_Back.localPosition.z;
m_tarZ = m_curZ;
((Component)PG.Chamber).transform.localPosition = new Vector3(((Component)PG.Chamber).transform.localPosition.x, ((Component)PG.Chamber).transform.localPosition.y, m_curZ);
CSState = ChamberSlideState.Out;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0019: 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_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_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)
((FVRInteractiveObject)this).UpdateInteraction(hand);
float tarZ = Mathf.Clamp(((Component)PG).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z, ChamberPoint_Back.localPosition.z, ChamberPoint_Forward.localPosition.z);
m_tarZ = tarZ;
}
public override void EndInteraction(FVRViveHand hand)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0039: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).EndInteraction(hand);
float num = Mathf.Abs(m_curZ - ChamberPoint_Back.localPosition.z);
float num2 = Mathf.Abs(m_curZ - ChamberPoint_Forward.localPosition.z);
if (num < ZThreshold * 2f)
{
m_tarZ = ChamberPoint_Back.localPosition.z;
}
else if (num2 < ZThreshold * 2f)
{
m_tarZ = ChamberPoint_Forward.localPosition.z;
}
}
public override void BeginInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).BeginInteraction(hand);
m_timeHeld = 0f;
}
protected void FVRUpdate()
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: 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_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: 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)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: 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)
((FVRInteractiveObject)this).FVRUpdate();
m_timeHeld += Time.deltaTime;
if (!(Mathf.Abs(m_curZ - m_tarZ) > 0.001f))
{
return;
}
m_curZ = Mathf.MoveTowards(m_curZ, m_tarZ, Time.deltaTime * 1f);
((Component)PG.Chamber).transform.localPosition = new Vector3(((Component)PG.Chamber).transform.localPosition.x, ((Component)PG.Chamber).transform.localPosition.y, m_curZ);
float num = Mathf.Abs(m_curZ - ChamberPoint_Back.localPosition.z);
float num2 = Mathf.Abs(m_curZ - ChamberPoint_Forward.localPosition.z);
ChamberSlideState cSState = CSState;
if (num < ZThreshold)
{
CSState = ChamberSlideState.Out;
}
else if (num2 < ZThreshold)
{
CSState = ChamberSlideState.In;
}
else
{
CSState = ChamberSlideState.Middle;
}
if (CSState == ChamberSlideState.Out && cSState != ChamberSlideState.Out)
{
((FVRFireArm)PG).PlayAudioAsHandling(AudEvent_ShellOut, ((Component)this).transform.position);
if (m_timeHeld > 0.2f)
{
FVRFireArmRound val = PG.Chamber.EjectRound(((Component)ChamberPoint_Back).transform.position, ChamberPoint_Back.forward * 0.1f, Vector3.zero, false);
if (((FVRInteractiveObject)this).IsHeld)
{
FVRViveHand hand = base.m_hand;
hand.ForceSetInteractable((FVRInteractiveObject)(object)val);
((FVRInteractiveObject)val).BeginInteraction(hand);
}
PG.FixCOM();
}
}
else if (CSState == ChamberSlideState.In && cSState != ChamberSlideState.In)
{
((FVRFireArm)PG).PlayAudioAsHandling(AudEvent_ShellIn, ((Component)this).transform.position);
((FVRInteractiveObject)this).ForceBreakInteraction();
PG.FixCOM();
}
else if (CSState == ChamberSlideState.Middle && cSState == ChamberSlideState.In)
{
((FVRFireArm)PG).PlayAudioAsHandling(AudEvent_ShellOutStart, ((Component)this).transform.position);
}
else if (CSState == ChamberSlideState.Middle && cSState == ChamberSlideState.Out)
{
((FVRFireArm)PG).PlayAudioAsHandling(AudEvent_ShellInStart, ((Component)this).transform.position);
}
}
}
public class RearStabilizerGrip : FVRAlternateGrip
{
public override bool IsInteractable()
{
return (Object)(object)base.PrimaryObject != (Object)null && ((FVRInteractiveObject)base.PrimaryObject).IsInteractable();
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).PlayGrabSound(!((FVRInteractiveObject)this).IsHeld, hand);
if (base.PrimaryObject is FVRFireArm)
{
FVRPhysicalObject primaryObject = base.PrimaryObject;
FVRFireArm val = (FVRFireArm)(object)((primaryObject is FVRFireArm) ? primaryObject : null);
if ((Object)(object)((FVRPhysicalObject)val).Bipod != (Object)null && ((FVRPhysicalObject)val).Bipod.IsBipodActive)
{
((FVRPhysicalObject)val).Bipod.Deactivate();
}
}
base.m_wasGrabbedFromAttachableForegrip = false;
base.m_lastGrabbedInGrip = null;
if (((FVRInteractiveObject)base.PrimaryObject).IsHeld && !base.PrimaryObject.IsAltHeld)
{
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = false;
if (((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)(object)hand && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
((FVRInteractiveObject)this).m_hand.EndInteractionIfHeld((FVRInteractiveObject)(object)this);
}
((FVRInteractiveObject)this).IsHeld = true;
((FVRInteractiveObject)this).m_hand = hand;
((FVRInteractiveObject)this).triggerCooldown = 0.5f;
if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform == (Object)null)
{
((FVRInteractiveObject)this).m_grabPointTransform = new GameObject("interpRot").transform;
}
((FVRInteractiveObject)this).m_grabPointTransform.SetParent(((FVRInteractiveObject)this).Transform);
((FVRInteractiveObject)this).m_grabPointTransform.position = ((FVRInteractiveObject)this).m_handPos;
((FVRInteractiveObject)this).m_grabPointTransform.rotation = ((FVRInteractiveObject)this).m_handRot;
((FVRInteractiveObject)this).m_pos_interp_tick = 0f;
((FVRInteractiveObject)this).m_rot_interp_tick = 0f;
if (base.FunctionalityEnabled)
{
base.PrimaryObject.AltGrip = (FVRAlternateGrip)(object)this;
}
}
else
{
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = false;
if (((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)(object)hand && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
((FVRInteractiveObject)this).m_hand.EndInteractionIfHeld((FVRInteractiveObject)(object)this);
}
((FVRInteractiveObject)this).IsHeld = true;
((FVRInteractiveObject)this).m_hand = hand;
((FVRInteractiveObject)this).triggerCooldown = 0.5f;
if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform == (Object)null)
{
((FVRInteractiveObject)this).m_grabPointTransform = new GameObject("interpRot").transform;
}
((FVRInteractiveObject)this).m_grabPointTransform.SetParent(((FVRInteractiveObject)this).Transform);
((FVRInteractiveObject)this).m_grabPointTransform.position = ((FVRInteractiveObject)this).m_handPos;
((FVRInteractiveObject)this).m_grabPointTransform.rotation = ((FVRInteractiveObject)this).m_handRot;
((FVRInteractiveObject)this).m_pos_interp_tick = 0f;
((FVRInteractiveObject)this).m_rot_interp_tick = 0f;
if (base.FunctionalityEnabled)
{
base.PrimaryObject.AltGrip = (FVRAlternateGrip)(object)this;
}
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRAlternateGrip)this).UpdateInteraction(hand);
if ((Object)(object)base.PrimaryObject != (Object)null && !((FVRInteractiveObject)base.PrimaryObject).IsHeld && !base.PrimaryObject.IsAltHeld)
{
((FVRInteractiveObject)this).ForceBreakInteraction();
}
}
}
public class FireFromMainHand : MonoBehaviour
{
public enum SelectorPosition
{
Safe,
UnderbarrelSingle,
UnderbarrelFullAuto,
MainSingle
}
[Serializable]
public class TriggerAnim
{
public Transform Trigger;
public AnimateMode Mode = AnimateMode.Rotation;
public Axis Axis = Axis.X;
public float ForwardValue;
public float RearwardValue;
[HideInInspector]
public Vector3 BaseLocalPos;
[HideInInspector]
public Vector3 BaseLocalEuler;
}
public enum Axis
{
X,
Y,
Z
}
public enum AnimateMode
{
Rotation,
Translation
}
public BoltActionRifle MainRifle;
public AttachableClosedBoltWeapon Underbarrel;
public AudioEvent SwitchSound;
[Header("Underbarrel Attachment (optional override)")]
public FVRFireArmAttachment UnderbarrelAttachment;
[Header("Master Selector")]
public Transform MasterSelector;
public Vector3[] MasterSelectorRotations = (Vector3[])(object)new Vector3[4];
public int MasterSelectorAxis = 2;
[Header("Trigger Animation")]
public TriggerAnim MainTriggerAnim = new TriggerAnim();
public TriggerAnim UnderbarrelTriggerAnim = new TriggerAnim();
[Header("Mode Overrides (-1 = auto)")]
public int[] MainModeOverrides = new int[4] { -1, -1, -1, -1 };
public int[] UnderbarrelModeOverrides = new int[4] { -1, -1, -1, -1 };
[Header("Underbarrel Control")]
public bool ForceUnderbarrelHeld = false;
public bool UseUpdateInteractionForUnderbarrel = true;
public bool DebugInput;
public bool DebugSelector;
public bool DebugAnimation;
private SelectorPosition selectorPos = SelectorPosition.Safe;
private int mainSafeIdx = -1;
private int mainSingleIdx = -1;
private int ubSafeIdx = -1;
private int ubSingleIdx = -1;
private int ubFullIdx = -1;
private FVRFireArmAttachment m_cachedUnderbarrelAttachment;
private bool m_loggedMissingUnderbarrelAttachment;
private float m_cachedTriggerFloat;
private bool m_hasActiveHand;
public void Awake()
{
if ((Object)(object)MainRifle == (Object)null)
{
Debug.LogError((object)"[FireFromMainHand] MainRifle reference is missing. Disabling script.");
((Behaviour)this).enabled = false;
return;
}
if ((Object)(object)Underbarrel == (Object)null)
{
Debug.LogError((object)"[FireFromMainHand] Underbarrel reference is missing. Disabling script.");
((Behaviour)this).enabled = false;
return;
}
MainRifle.HasFireSelectorButton = false;
Underbarrel.HasFireSelectorButton = false;
CacheTriggerAnim(ref MainTriggerAnim);
CacheTriggerAnim(ref UnderbarrelTriggerAnim);
CacheSelectorIndices();
ApplySelectorState();
if (DebugInput || DebugSelector || DebugAnimation)
{
Debug.Log((object)("[FireFromMainHand] Awake complete. MainRifle: " + ((Object)MainRifle).name + " Underbarrel: " + ((Object)Underbarrel).name));
}
}
private void Update()
{
if ((Object)(object)MainRifle == (Object)null || (Object)(object)Underbarrel == (Object)null)
{
if (DebugInput)
{
Debug.LogWarning((object)"[FireFromMainHand] MainRifle or Underbarrel is null in Update.");
}
return;
}
if (!((FVRInteractiveObject)MainRifle).IsHeld || (Object)(object)((FVRInteractiveObject)MainRifle).m_hand == (Object)null)
{
ClearUnderbarrelHeldState();
if (DebugInput)
{
Debug.Log((object)"[FireFromMainHand] Main rifle not held or hand missing.");
}
return;
}
FVRViveHand hand = ((FVRInteractiveObject)MainRifle).m_hand;
m_cachedTriggerFloat = hand.Input.TriggerFloat;
m_hasActiveHand = true;
bool flag = selectorPos == SelectorPosition.UnderbarrelSingle || selectorPos == SelectorPosition.UnderbarrelFullAuto;
SyncUnderbarrelHeldState(hand, flag);
if (flag)
{
FVRFireArmAttachment underbarrelAttachment = GetUnderbarrelAttachment();
if ((Object)(object)underbarrelAttachment != (Object)null)
{
if (!((FVRInteractiveObject)underbarrelAttachment).IsHeld)
{
((FVRInteractiveObject)underbarrelAttachment).BeginInteraction(hand);
if (DebugInput)
{
Debug.Log((object)"[FireFromMainHand] Began interaction with underbarrel attachment.");
}
}
((FVRInteractiveObject)underbarrelAttachment).UpdateInteraction(hand);
((AttachableFirearm)Underbarrel).ProcessInput(hand, false, (FVRInteractiveObject)(object)underbarrelAttachment);
if (DebugInput)
{
Debug.Log((object)("[FireFromMainHand] Processed input for underbarrel. TriggerFloat: " + m_cachedTriggerFloat));
}
}
else
{
LogMissingUnderbarrelAttachmentOnce();
}
}
else
{
FVRFireArmAttachment underbarrelAttachment2 = GetUnderbarrelAttachment();
if ((Object)(object)underbarrelAttachment2 != (Object)null && ((FVRInteractiveObject)underbarrelAttachment2).IsHeld)
{
((FVRInteractiveObject)underbarrelAttachment2).EndInteraction(hand);
if (DebugInput)
{
Debug.Log((object)"[FireFromMainHand] Ended interaction with underbarrel attachment.");
}
}
}
if (ShouldAdvanceSelector(hand))
{
AdvanceSelector();
}
}
private void LateUpdate()
{
if (m_hasActiveHand)
{
ApplyTriggerAnim(MainTriggerAnim, m_cachedTriggerFloat);
ApplyTriggerAnim(UnderbarrelTriggerAnim, m_cachedTriggerFloat);
if (DebugInput || DebugAnimation)
{
Debug.Log((object)("[FireFromMainHand] LateUpdate - TriggerFloat=" + m_cachedTriggerFloat + " MainTrigger=" + (MainTriggerAnim != null && (Object)(object)MainTriggerAnim.Trigger != (Object)null) + " UnderbarrelTrigger=" + (UnderbarrelTriggerAnim != null && (Object)(object)UnderbarrelTriggerAnim.Trigger != (Object)null)));
}
m_hasActiveHand = false;
}
}
private void OnDisable()
{
ClearUnderbarrelHeldState();
if (DebugInput)
{
Debug.Log((object)"[FireFromMainHand] OnDisable - Cleared underbarrel state.");
}
}
private void OnDestroy()
{
ClearUnderbarrelHeldState();
if (DebugInput)
{
Debug.Log((object)"[FireFromMainHand] OnDestroy - Cleared underbarrel state.");
}
}
private void ClearUnderbarrelHeldState()
{
if (ForceUnderbarrelHeld && !((Object)(object)Underbarrel == (Object)null))
{
SetPrivateField(Underbarrel, "m_hand", null);
SetPrivateField(Underbarrel, "m_isHeld", false);
FVRFireArmAttachment underbarrelAttachment = GetUnderbarrelAttachment();
if ((Object)(object)underbarrelAttachment != (Object)null)
{
SetPrivateField(underbarrelAttachment, "m_hand", null);
SetPrivateField(underbarrelAttachment, "m_isHeld", false);
}
if (DebugInput)
{
Debug.Log((object)"[FireFromMainHand] Cleared underbarrel held state.");
}
}
}
private void SyncUnderbarrelHeldState(FVRViveHand hand, bool isHeld)
{
if (ForceUnderbarrelHeld && !((Object)(object)Underbarrel == (Object)null))
{
bool flag = isHeld && (Object)(object)hand != (Object)null;
SetPrivateField(Underbarrel, "m_hand", (!flag) ? null : hand);
SetPrivateField(Underbarrel, "m_isHeld", flag);
FVRFireArmAttachment underbarrelAttachment = GetUnderbarrelAttachment();
if ((Object)(object)underbarrelAttachment != (Object)null)
{
SetPrivateField(underbarrelAttachment, "m_hand", (!flag) ? null : hand);
SetPrivateField(underbarrelAttachment, "m_isHeld", flag);
}
if (DebugInput)
{
Debug.Log((object)("[FireFromMainHand] Synced underbarrel held state: " + flag));
}
}
}
private void CacheTriggerAnim(ref TriggerAnim anim)
{
//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_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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
if (anim == null || (Object)(object)anim.Trigger == (Object)null)
{
if (DebugAnimation)
{
Debug.LogWarning((object)"[FireFromMainHand] TriggerAnim or Trigger is null, skipping cache.");
}
return;
}
anim.BaseLocalEuler = anim.Trigger.localEulerAngles;
anim.BaseLocalPos = anim.Trigger.localPosition;
if (DebugAnimation)
{
Debug.Log((object)string.Concat("[FireFromMainHand] Cached trigger anim for ", ((Object)anim.Trigger).name, " - BaseEuler: ", anim.BaseLocalEuler, " BasePos: ", anim.BaseLocalPos));
}
}
private void ApplyTriggerAnim(TriggerAnim anim, float triggerFloat)
{
//IL_00d2: 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_00ed: 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_0043: 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_014c: 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)
if (anim == null || (Object)(object)anim.Trigger == (Object)null)
{
return;
}
float num = Mathf.Lerp(anim.ForwardValue, anim.RearwardValue, triggerFloat);
if (anim.Mode == AnimateMode.Rotation)
{
Vector3 v = anim.BaseLocalEuler;
SetAxisValue(ref v, anim.Axis, num);
anim.Trigger.localEulerAngles = v;
if (DebugAnimation)
{
Debug.Log((object)string.Concat("[FireFromMainHand] Applied trigger rotation to ", ((Object)anim.Trigger).name, " - Axis: ", anim.Axis, " Value: ", num, " Euler: ", v));
}
}
else
{
Vector3 v2 = anim.BaseLocalPos;
SetAxisValue(ref v2, anim.Axis, num);
anim.Trigger.localPosition = v2;
if (DebugAnimation)
{
Debug.Log((object)string.Concat("[FireFromMainHand] Applied trigger translation to ", ((Object)anim.Trigger).name, " - Axis: ", anim.Axis, " Value: ", num, " Pos: ", v2));
}
}
}
private void SetAxisValue(ref Vector3 v, Axis axis, float value)
{
switch (axis)
{
case Axis.X:
v.x = value;
break;
case Axis.Y:
v.y = value;
break;
default:
v.z = value;
break;
}
}
private FVRFireArmAttachment GetUnderbarrelAttachment()
{
if ((Object)(object)Underbarrel == (Object)null)
{
return null;
}
if ((Object)(object)UnderbarrelAttachment != (Object)null)
{
return UnderbarrelAttachment;
}
if ((Object)(object)((AttachableFirearm)Underbarrel).Attachment != (Object)null)
{
return (FVRFireArmAttachment)(object)((AttachableFirearm)Underbarrel).Attachment;
}
if ((Object)(object)m_cachedUnderbarrelAttachment == (Object)null)
{
m_cachedUnderbarrelAttachment = ((Component)Underbarrel).GetComponentInParent<FVRFireArmAttachment>();
if (DebugAnimation && (Object)(object)m_cachedUnderbarrelAttachment != (Object)null)
{
Debug.Log((object)("[FireFromMainHand] Cached underbarrel attachment: " + ((Object)m_cachedUnderbarrelAttachment).name));
}
}
return m_cachedUnderbarrelAttachment;
}
private void LogMissingUnderbarrelAttachmentOnce()
{
if (!m_loggedMissingUnderbarrelAttachment)
{
m_loggedMissingUnderbarrelAttachment = true;
Debug.LogWarning((object)"[FireFromMainHand] Underbarrel attachment is null; selector/input routing will not work. Check UnderbarrelAttachment field or component hierarchy.");
}
}
private bool ShouldAdvanceSelector(FVRViveHand hand)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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)
if (!CanToggleSelector())
{
return false;
}
if (hand.IsInStreamlinedMode)
{
return hand.Input.BYButtonDown;
}
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
return hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.1f && Vector2.Angle(touchpadAxes, Vector2.left) <= 45f;
}
private bool CanToggleSelector()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Invalid comparison between Unknown and I4
if ((Object)(object)MainRifle == (Object)null)
{
return false;
}
if (MainRifle.RequiresHammerUncockedToToggleFireSelector && MainRifle.IsHammerCocked)
{
if (DebugSelector)
{
Debug.Log((object)"[FireFromMainHand] Cannot toggle: hammer cocked.");
}
return false;
}
if ((Object)(object)MainRifle.BoltHandle != (Object)null)
{
if (((FVRInteractiveObject)MainRifle.BoltHandle).IsHeld)
{
if (DebugSelector)
{
Debug.Log((object)"[FireFromMainHand] Cannot toggle: bolt handle held.");
}
return false;
}
if ((int)MainRifle.CurBoltHandleState != 0)
{
if (DebugSelector)
{
Debug.Log((object)"[FireFromMainHand] Cannot toggle: bolt not forward.");
}
return false;
}
if ((int)MainRifle.BoltHandle.HandleRot != 2)
{
if (DebugSelector)
{
Debug.Log((object)"[FireFromMainHand] Cannot toggle: bolt not down.");
}
return false;
}
}
return true;
}
private void AdvanceSelector()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
selectorPos = (SelectorPosition)((int)(selectorPos + 1) % 4);
if (SwitchSound != null)
{
SM.PlayGenericSound(SwitchSound, ((Component)this).transform.position);
}
ApplySelectorState();
if (DebugSelector)
{
Debug.Log((object)("[FireFromMainHand] Advanced selector to: " + selectorPos));
}
}
private void CacheSelectorIndices()
{
if (MainRifle.FireSelector_Modes == null || MainRifle.FireSelector_Modes.Length == 0)
{
Debug.LogError((object)"[FireFromMainHand] Main rifle has no selector modes. Disabling script.");
((Behaviour)this).enabled = false;
return;
}
if (Underbarrel.FireSelector_Modes == null || Underbarrel.FireSelector_Modes.Length == 0)
{
Debug.LogError((object)"[FireFromMainHand] Underbarrel has no selector modes. Disabling script.");
((Behaviour)this).enabled = false;
return;
}
mainSafeIdx = FindMainIndex((FireSelectorModeType)0);
mainSingleIdx = FindMainIndex((FireSelectorModeType)1);
ubSafeIdx = FindUnderbarrelIndex((FireSelectorModeType)0);
ubSingleIdx = FindUnderbarrelIndex((FireSelectorModeType)1);
ubFullIdx = FindUnderbarrelIndex((FireSelectorModeType)3);
if (DebugSelector)
{
Debug.Log((object)("[FireFromMainHand] Cached indices - MainSafe: " + mainSafeIdx + " MainSingle: " + mainSingleIdx + " UBSafe: " + ubSafeIdx + " UBSingle: " + ubSingleIdx + " UBFull: " + ubFullIdx));
}
}
private void ApplySelectorState()
{
int mainOverrideIndex = GetMainOverrideIndex(selectorPos);
int underbarrelOverrideIndex = GetUnderbarrelOverrideIndex(selectorPos);
if (mainOverrideIndex < 0)
{
switch (selectorPos)
{
case SelectorPosition.Safe:
case SelectorPosition.UnderbarrelSingle:
case SelectorPosition.UnderbarrelFullAuto:
mainOverrideIndex = mainSafeIdx;
break;
case SelectorPosition.MainSingle:
mainOverrideIndex = mainSingleIdx;
break;
}
}
if (underbarrelOverrideIndex < 0)
{
switch (selectorPos)
{
case SelectorPosition.Safe:
case SelectorPosition.MainSingle:
underbarrelOverrideIndex = ubSafeIdx;
break;
case SelectorPosition.UnderbarrelSingle:
underbarrelOverrideIndex = ubSingleIdx;
break;
case SelectorPosition.UnderbarrelFullAuto:
underbarrelOverrideIndex = ubFullIdx;
break;
}
}
if (DebugSelector)
{
Debug.Log((object)string.Concat("[FireFromMainHand] Applying selector state - Pos: ", selectorPos, " mainIdx=", mainOverrideIndex, " ubIdx=", underbarrelOverrideIndex));
}
SetMainSelector(mainOverrideIndex);
SetUnderbarrelSelector(underbarrelOverrideIndex);
AnimateMasterSelector();
}
private int GetMainOverrideIndex(SelectorPosition pos)
{
if (MainModeOverrides == null || MainModeOverrides.Length <= (int)pos)
{
return -1;
}
return MainModeOverrides[(int)pos];
}
private int GetUnderbarrelOverrideIndex(SelectorPosition pos)
{
if (UnderbarrelModeOverrides == null || UnderbarrelModeOverrides.Length <= (int)pos)
{
return -1;
}
return UnderbarrelModeOverrides[(int)pos];
}
private void AnimateMasterSelector()
{
//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_006a: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MasterSelector == (Object)null || MasterSelectorRotations == null || MasterSelectorRotations.Length <= (int)selectorPos)
{
if (DebugSelector)
{
Debug.LogWarning((object)"[FireFromMainHand] MasterSelector or rotations not set up.");
}
return;
}
Vector3 val = MasterSelector.localEulerAngles;
Vector3 val2 = MasterSelectorRotations[(int)selectorPos];
switch (MasterSelectorAxis)
{
case 0:
val.x = val2.x;
break;
case 1:
val.y = val2.y;
break;
case 2:
val.z = val2.z;
break;
default:
val = val2;
break;
}
MasterSelector.localEulerAngles = val;
if (DebugSelector)
{
Debug.Log((object)("[FireFromMainHand] Animated master selector to " + val));
}
}
private int FindMainIndex(FireSelectorModeType type)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < MainRifle.FireSelector_Modes.Length; i++)
{
if (MainRifle.FireSelector_Modes[i].ModeType == type)
{
return i;
}
}
Debug.LogWarning((object)string.Concat("[FireFromMainHand] Main rifle missing selector mode ", type, ". Available modes: ", MainRifle.FireSelector_Modes.Length));
return -1;
}
private int FindUnderbarrelIndex(FireSelectorModeType type)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < Underbarrel.FireSelector_Modes.Length; i++)
{
if (Underbarrel.FireSelector_Modes[i].ModeType == type)
{
return i;
}
}
Debug.LogWarning((object)string.Concat("[FireFromMainHand] Underbarrel missing selector mode ", type, ". Available modes: ", Underbarrel.FireSelector_Modes.Length));
return -1;
}
private void SetMainSelector(int idx)
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
if (idx < 0 || idx >= MainRifle.FireSelector_Modes.Length)
{
if (DebugSelector)
{
Debug.LogWarning((object)("[FireFromMainHand] Invalid main selector index: " + idx));
}
return;
}
SetPrivateInt(MainRifle, "m_fireSelectorMode", idx);
if ((Object)(object)MainRifle.FireSelector_Display != (Object)null)
{
float selectorPosition = MainRifle.FireSelector_Modes[idx].SelectorPosition;
((FVRPhysicalObject)MainRifle).SetAnimatedComponent(MainRifle.FireSelector_Display, selectorPosition, MainRifle.FireSelector_InterpStyle, MainRifle.FireSelector_Axis);
if (DebugAnimation)
{
Debug.Log((object)("[FireFromMainHand] Animated main selector display to pos " + selectorPosition + " on " + ((Object)MainRifle.FireSelector_Display).name));
}
}
else if (DebugAnimation)
{
Debug.LogWarning((object)"[FireFromMainHand] Main rifle FireSelector_Display is null, cannot animate.");
}
if (MainRifle.UsesSecondFireSelectorChange && (Object)(object)MainRifle.FireSelector_Display_Secondary != (Object)null && MainRifle.FireSelector_Modes_Secondary != null && idx < MainRifle.FireSelector_Modes_Secondary.Length)
{
float selectorPosition2 = MainRifle.FireSelector_Modes_Secondary[idx].SelectorPosition;
((FVRPhysicalObject)MainRifle).SetAnimatedComponent(MainRifle.FireSelector_Display_Secondary, selectorPosition2, MainRifle.FireSelector_InterpStyle_Secondary, MainRifle.FireSelector_Axis_Secondary);
if (DebugAnimation)
{
Debug.Log((object)("[FireFromMainHand] Animated main selector secondary display to pos " + selectorPosition2));
}
}
if (DebugSelector)
{
Debug.Log((object)string.Concat("[FireFromMainHand] Set main selector to index ", idx, " (", MainRifle.FireSelector_Modes[idx].ModeType, ")"));
}
}
private void SetUnderbarrelSelector(int idx)
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
if (idx < 0 || idx >= Underbarrel.FireSelector_Modes.Length)
{
if (DebugSelector)
{
Debug.LogWarning((object)("[FireFromMainHand] Invalid underbarrel selector index: " + idx));
}
return;
}
SetPrivateInt(Underbarrel, "m_fireSelectorMode", idx);
FVRFireArmAttachment underbarrelAttachment = GetUnderbarrelAttachment();
if ((Object)(object)underbarrelAttachment == (Object)null)
{
LogMissingUnderbarrelAttachmentOnce();
return;
}
if ((Object)(object)Underbarrel.FireSelectorSwitch != (Object)null)
{
float selectorPosition = Underbarrel.FireSelector_Modes[idx].SelectorPosition;
((FVRPhysicalObject)underbarrelAttachment).SetAnimatedComponent(Underbarrel.FireSelectorSwitch, selectorPosition, Underbarrel.FireSelector_InterpStyle, Underbarrel.FireSelector_Axis);
if (DebugAnimation)
{
Debug.Log((object)("[FireFromMainHand] Animated underbarrel selector switch to pos " + selectorPosition + " on " + ((Object)Underbarrel.FireSelectorSwitch).name));
}
}
else if (DebugAnimation)
{
Debug.LogWarning((object)"[FireFromMainHand] Underbarrel FireSelectorSwitch is null, cannot animate.");
}
if ((Object)(object)Underbarrel.FireSelectorSwitch2 != (Object)null && Underbarrel.FireSelector_Modes2 != null && idx < Underbarrel.FireSelector_Modes2.Length)
{
float selectorPosition2 = Underbarrel.FireSelector_Modes2[idx].SelectorPosition;
((FVRPhysicalObject)underbarrelAttachment).SetAnimatedComponent(Underbarrel.FireSelectorSwitch2, selectorPosition2, Underbarrel.FireSelector_InterpStyle2, Underbarrel.FireSelector_Axis2);
if (DebugAnimation)
{
Debug.Log((object)("[FireFromMainHand] Animated underbarrel selector switch2 to pos " + selectorPosition2));
}
}
if (DebugSelector)
{
Debug.Log((object)string.Concat("[FireFromMainHand] Set underbarrel selector to index ", idx, " (", Underbarrel.FireSelector_Modes[idx].ModeType, ")"));
}
}
private void SetPrivateInt(object obj, string fieldName, int value)
{
Type type = obj.GetType();
FieldInfo fieldInfo = null;
while ((object)type != null && (object)fieldInfo == null)
{
fieldInfo = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
type = type.BaseType;
}
if ((object)fieldInfo != null)
{
fieldInfo.SetValue(obj, value);
if (DebugSelector)
{
Debug.Log((object)("[FireFromMainHand] Set private int " + fieldName + " to " + value + " on " + obj.GetType()));
}
}
else
{
Debug.LogWarning((object)string.Concat("[FireFromMainHand] Could not find field ", fieldName, " on ", obj.GetType(), ". Check field name or access."));
}
}
private void SetPrivateField(object obj, string fieldName, object value)
{
if (obj == null)
{
if (DebugInput)
{
Debug.LogWarning((object)("[FireFromMainHand] SetPrivateField: obj is null for field " + fieldName));
}
return;
}
Type type = obj.GetType();
FieldInfo fieldInfo = null;
while ((object)type != null && (object)fieldInfo == null)
{
fieldInfo = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
type = type.BaseType;
}
if ((object)fieldInfo != null)
{
fieldInfo.SetValue(obj, value);
if (DebugInput)
{
Debug.Log((object)("[FireFromMainHand] Set private field " + fieldName + " on " + obj.GetType()));
}
}
else
{
Debug.LogWarning((object)("[FireFromMainHand] Could not find field " + fieldName + " on " + obj.GetType()));
}
}
}
public class QTS11_Rifle : BoltActionRifle
{
public enum SelectorPosition
{
Safe,
UnderbarrelSingle,
UnderbarrelFullAuto,
MainSingle
}
[Header("QTS-11 Dual Weapon System")]
public AttachableClosedBoltWeapon Underbarrel;
public AudioEvent SwitchSound;
[Header("Master Selector Visual")]
public Transform MasterSelectorSwitch;
public float[] MasterSelectorPositions = new float[4];
public InterpStyle MasterSelectorInterpStyle = (InterpStyle)1;
public Axis MasterSelectorAxis = (Axis)2;
[Header("Debug")]
public bool DebugSelector;
private SelectorPosition m_selectorPos = SelectorPosition.Safe;
private int m_mainSafeIdx = -1;
private int m_mainSingleIdx = -1;
private int m_ubSafeIdx = -1;
private int m_ubSingleIdx = -1;
private int m_ubFullIdx = -1;
private Vector3 m_masterSelectorRestEuler;
public override void Awake()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
((BoltActionRifle)this).Awake();
base.HasFireSelectorButton = false;
base.FireSelector_Display = null;
if ((Object)(object)MasterSelectorSwitch != (Object)null)
{
m_masterSelectorRestEuler = MasterSelectorSwitch.localEulerAngles;
}
if ((Object)(object)Underbarrel != (Object)null)
{
Underbarrel.HasFireSelectorButton = false;
CacheSelectorIndices();
SetPrivateField(Underbarrel, "m_hasTriggerReset", true);
}
ApplySelectorState();
}
public override void UpdateInteraction(FVRViveHand hand)
{
if (ShouldAdvanceSelector(hand))
{
AdvanceSelector();
}
if ((m_selectorPos == SelectorPosition.UnderbarrelSingle || m_selectorPos == SelectorPosition.UnderbarrelFullAuto) && (Object)(object)Underbarrel != (Object)null)
{
UpdateInteraction_BaseOnly(hand);
((AttachableFirearm)Underbarrel).ProcessInput(hand, true, (FVRInteractiveObject)(object)this);
int num = ((m_selectorPos != SelectorPosition.UnderbarrelSingle) ? m_ubFullIdx : m_ubSingleIdx);
if (num >= 0)
{
SetPrivateField(Underbarrel, "m_fireSelectorMode", num);
}
if (hand.Input.TriggerFloat < 0.15f)
{
SetPrivateField(Underbarrel, "m_hasTriggerReset", true);
}
}
else
{
((BoltActionRifle)this).UpdateInteraction(hand);
}
}
private void UpdateInteraction_BaseOnly(FVRViveHand hand)
{
((FVRInteractiveObject)this).IsHeld = true;
((FVRInteractiveObject)this).m_hand = hand;
if (!((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat < 0.15f)
{
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = true;
}
if (((FVRInteractiveObject)this).triggerCooldown > 0f)
{
((FVRInteractiveObject)this).triggerCooldown = ((FVRInteractiveObject)this).triggerCooldown - Time.deltaTime;
}
}
private bool ShouldAdvanceSelector(FVRViveHand hand)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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)
if (hand.IsInStreamlinedMode)
{
return hand.Input.BYButtonDown;
}
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
return hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.left) <= 45f;
}
private void AdvanceSelector()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
m_selectorPos = (SelectorPosition)((int)(m_selectorPos + 1) % 4);
if (SwitchSound != null)
{
SM.PlayGenericSound(SwitchSound, ((Component)this).transform.position);
}
ApplySelectorState();
if ((m_selectorPos == SelectorPosition.UnderbarrelSingle || m_selectorPos == SelectorPosition.UnderbarrelFullAuto) && (Object)(object)Underbarrel != (Object)null)
{
SetPrivateField(Underbarrel, "m_hasTriggerReset", true);
}
if (DebugSelector)
{
Debug.Log((object)("[QTS11] Selector -> " + m_selectorPos));
}
}
private void ApplySelectorState()
{
int mainSelector;
int underbarrelSelector;
switch (m_selectorPos)
{
case SelectorPosition.Safe:
mainSelector = m_mainSafeIdx;
underbarrelSelector = m_ubSafeIdx;
break;
case SelectorPosition.UnderbarrelSingle:
mainSelector = m_mainSafeIdx;
underbarrelSelector = m_ubSingleIdx;
break;
case SelectorPosition.UnderbarrelFullAuto:
mainSelector = m_mainSafeIdx;
underbarrelSelector = m_ubFullIdx;
break;
case SelectorPosition.MainSingle:
mainSelector = m_mainSingleIdx;
underbarrelSelector = m_ubSafeIdx;
break;
default:
mainSelector = m_mainSafeIdx;
underbarrelSelector = m_ubSafeIdx;
break;
}
SetMainSelector(mainSelector);
SetUnderbarrelSelector(underbarrelSelector);
AnimateMasterSelector();
}
private void SetMainSelector(int idx)
{
//IL_0061: 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)
if (idx >= 0 && base.FireSelector_Modes != null && idx < base.FireSelector_Modes.Length)
{
SetPrivateField(this, "m_fireSelectorMode", idx);
if ((Object)(object)base.FireSelector_Display != (Object)null)
{
float selectorPosition = base.FireSelector_Modes[idx].SelectorPosition;
((FVRPhysicalObject)this).SetAnimatedComponent(base.FireSelector_Display, selectorPosition, base.FireSelector_InterpStyle, base.FireSelector_Axis);
}
}
}
private void SetUnderbarrelSelector(int idx)
{
if (!((Object)(object)Underbarrel == (Object)null) && idx >= 0 && Underbarrel.FireSelector_Modes != null && idx < Underbarrel.FireSelector_Modes.Length)
{
SetPrivateField(Underbarrel, "m_fireSelectorMode", idx);
}
}
private void AnimateMasterSelector()
{
//IL_004c: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)MasterSelectorSwitch == (Object)null) && MasterSelectorPositions != null && (int)m_selectorPos < MasterSelectorPositions.Length)
{
float num = MasterSelectorPositions[(int)m_selectorPos];
((FVRPhysicalObject)this).SetAnimatedComponent(MasterSelectorSwitch, num, MasterSelectorInterpStyle, MasterSelectorAxis);
if (DebugSelector)
{
Debug.Log((object)string.Concat("[QTS11] AnimateMasterSelector - pos=", m_selectorPos, " target=", num, " result=", MasterSelectorSwitch.localEulerAngles));
}
}
}
private void CacheSelectorIndices()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Invalid comparison between Unknown and I4
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Invalid comparison between Unknown and I4
if (base.FireSelector_Modes != null)
{
for (int i = 0; i < base.FireSelector_Modes.Length; i++)
{
if ((int)base.FireSelector_Modes[i].ModeType == 0)
{
m_mainSafeIdx = i;
}
if ((int)base.FireSelector_Modes[i].ModeType == 1)
{
m_mainSingleIdx = i;
}
}
}
if (Underbarrel.FireSelector_Modes != null)
{
for (int j = 0; j < Underbarrel.FireSelector_Modes.Length; j++)
{
if ((int)Underbarrel.FireSelector_Modes[j].ModeType == 0)
{
m_ubSafeIdx = j;
}
if ((int)Underbarrel.FireSelector_Modes[j].ModeType == 1)
{
m_ubSingleIdx = j;
}
if ((int)Underbarrel.FireSelector_Modes[j].ModeType == 3)
{
m_ubFullIdx = j;
}
}
}
if (DebugSelector)
{
Debug.Log((object)("[QTS11] Indices - MainSafe:" + m_mainSafeIdx + " MainSingle:" + m_mainSingleIdx + " UBSafe:" + m_ubSafeIdx + " UBSingle:" + m_ubSingleIdx + " UBFull:" + m_ubFullIdx));
}
}
private void SetPrivateField(object obj, string fieldName, object value)
{
if (obj != null)
{
Type type = obj.GetType();
FieldInfo fieldInfo = null;
while ((object)type != null && (object)fieldInfo == null)
{
fieldInfo = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
type = type.BaseType;
}
if ((object)fieldInfo != null)
{
fieldInfo.SetValue(obj, value);
}
else if (DebugSelector)
{
Debug.LogWarning((object)("[QTS11] SetPrivateField: field '" + fieldName + "' not found on " + obj.GetType().Name));
}
}
}
}
public class DM34Destroy : MonoBehaviour
{
public FVRPhysicalObject triggerDestroy;
public FVRFireArmChamber chamber;
private bool isTimerStarted;
public float timeBeforedestruction;
private float timer = 1f;
private void FixedUpdate()
{
if (!chamber.IsFull && !isTimerStarted)
{
isTimerStarted = true;
timer = timeBeforedestruction;
}
if (((FVRInteractiveObject)triggerDestroy).IsHeld)
{
timer = timeBeforedestruction;
}
if (isTimerStarted)
{
timer -= Time.fixedDeltaTime;
}
if (timer <= 0f)
{
Object.Destroy((Object)(object)((Component)triggerDestroy).gameObject);
}
}
}
public class SpawnEffect : MonoBehaviour
{
public float spawnEffectTime = 2f;
public float pause = 1f;
public AnimationCurve fadeIn;
private ParticleSystem ps;
private float timer = 0f;
private Renderer _renderer;
private int shaderProperty;
private void Start()
{
//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)
shaderProperty = Shader.PropertyToID("_cutoff");
_renderer = ((Component)this).GetComponent<Renderer>();
ps = ((Component)this).GetComponentInChildren<ParticleSystem>();
MainModule main = ps.main;
((MainModule)(ref main)).duration = spawnEffectTime;
ps.Play();
}
private void Update()
{
if (timer < spawnEffectTime + pause)
{
timer += Time.deltaTime;
}
else
{
ps.Play();
timer = 0f;
}
_renderer.material.SetFloat(shaderProperty, fadeIn.Evaluate(Mathf.InverseLerp(0f, spawnEffectTime, timer)));
}
}
[CreateAssetMenu]
public class RampAsset : ScriptableObject
{
public Gradient gradient = new Gradient();
public int size = 16;
public bool up = false;
public bool overwriteExisting = true;
}