

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using FistVR;
using On.FistVR;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AFMoMCL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AFMoMCL")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9f4f98b3-2996-4dea-a7e4-95e5620c5734")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AndrewFTW;
public class FireSubprojAtTime : MonoBehaviour
{
[Serializable]
public class c_TangentMunition
{
public enum SubmunitionType
{
GameObject,
Projectile,
Rigidbody,
StickyBomb,
MeleeThrown,
Demonade
}
public enum SubmunitionTrajectoryType
{
Random,
RicochetDir,
Backwards,
Forwards,
ForwardsCone
}
public enum SubmunitionSpawnLogic
{
Outside,
Inside,
On
}
public List<GameObject> Prefabs;
public int NumToSpawn;
public SubmunitionTrajectoryType Trajectory;
public SubmunitionType Type;
public SubmunitionSpawnLogic SpawnLogic;
public Vector2 Speed;
public bool usesParentSpeed;
public float ConeLerp = 0.85f;
}
public BallisticProjectile parentRound;
public float timeToFire;
[Header("Tangent Munitions")]
public List<c_TangentMunition> TangentMunitions;
private bool m_hasFiredTangentMunitions;
private float currLifeTime;
public void Awake()
{
Hook();
}
public void Hook()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Debug.Log((object)"Hooking Ballistic Projectile");
BallisticProjectile.FixedUpdate += new hook_FixedUpdate(BallisticProjectile_FixedUpdate);
}
public void OnDestroy()
{
Unhook();
}
public void Unhook()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
BallisticProjectile.FixedUpdate -= new hook_FixedUpdate(BallisticProjectile_FixedUpdate);
}
public void Update()
{
}
private void BallisticProjectile_FixedUpdate(orig_FixedUpdate orig, BallisticProjectile self)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0044: 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)
orig.Invoke(self);
if ((Object)(object)self == (Object)(object)parentRound && parentRound.m_dieTimerTick <= 0.05f)
{
Debug.Log((object)"Time to die");
Vector3 normalized = ((Vector3)(ref parentRound.m_velocity)).normalized;
FireTangentMunitions(normalized, normalized, ((Component)this).transform.position, ((Vector3)(ref parentRound.m_velocity)).magnitude);
}
}
public void FireTangentMunitions(Vector3 shatterRicochetDir, Vector3 velNorm, Vector3 hitPoint, float VelocityOverride)
{
//IL_0026: 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)
//IL_0029: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected I4, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Invalid comparison between Unknown and I4
//IL_00b6: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: 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_0137: 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_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected I4, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: 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_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
if (m_hasFiredTangentMunitions)
{
return;
}
m_hasFiredTangentMunitions = true;
for (int i = 0; i < TangentMunitions.Count; i++)
{
c_TangentMunition c_TangentMunition = TangentMunitions[i];
Vector3 val = shatterRicochetDir;
Vector3 val2 = hitPoint;
for (int j = 0; j < c_TangentMunition.NumToSpawn; j++)
{
GameObject val3 = c_TangentMunition.Prefabs[Random.Range(0, c_TangentMunition.Prefabs.Count)];
float num = ((!c_TangentMunition.usesParentSpeed) ? Random.Range(c_TangentMunition.Speed.x, c_TangentMunition.Speed.y) : ((Vector3)(ref parentRound.m_velocity)).magnitude);
SubmunitionTrajectoryType trajectory = c_TangentMunition.Trajectory;
switch ((int)trajectory)
{
case 0:
val = Random.onUnitSphere;
break;
case 2:
val = Vector3.Lerp(-velNorm, shatterRicochetDir, 0.5f);
break;
case 3:
val = velNorm;
break;
case 4:
val = Vector3.Lerp(Random.onUnitSphere, velNorm, c_TangentMunition.ConeLerp);
break;
}
SubmunitionSpawnLogic spawnLogic = c_TangentMunition.SpawnLogic;
if ((int)spawnLogic != 1)
{
if ((int)spawnLogic == 0)
{
val2 += ((RaycastHit)(ref parentRound.m_hit)).normal * 0.001f;
}
}
else
{
val2 -= ((RaycastHit)(ref parentRound.m_hit)).normal * 0.001f;
}
GameObject val4 = Object.Instantiate<GameObject>(val3, val2, Quaternion.LookRotation(val));
SubmunitionType type = c_TangentMunition.Type;
switch ((int)type)
{
case 0:
{
Explosion component2 = val4.GetComponent<Explosion>();
if ((Object)(object)component2 != (Object)null)
{
component2.IFF = parentRound.Source_IFF;
}
ExplosionSound component3 = val4.GetComponent<ExplosionSound>();
if ((Object)(object)component3 != (Object)null)
{
component3.IFF = parentRound.Source_IFF;
}
break;
}
case 1:
{
BallisticProjectile component4 = val4.GetComponent<BallisticProjectile>();
component4.Source_IFF = parentRound.Source_IFF;
component4.Fire(num, val4.transform.forward, (FVRFireArm)null, true);
break;
}
case 2:
val4.GetComponent<Rigidbody>().velocity = val * num;
break;
case 3:
val4.GetComponent<Rigidbody>().velocity = val * VelocityOverride;
if (parentRound.PassesFirearmReferenceToSubmunitions)
{
MF2_StickyBomb component = val4.GetComponent<MF2_StickyBomb>();
component.SetIFF(parentRound.Source_IFF);
if ((Object)(object)component != (Object)null && (Object)(object)parentRound.tempFA != (Object)null && ((ClosedBoltWeapon)/*isinst with value type is only supported in some contexts*/).UsesStickyDetonation)
{
FVRFireArm tempFA = parentRound.tempFA;
((ClosedBoltWeapon)((tempFA is ClosedBoltWeapon) ? tempFA : null)).RegisterStickyBomb(component);
}
}
break;
case 4:
val4.GetComponent<Rigidbody>().velocity = val * Mathf.Max(num, parentRound.m_initialMuzzleVelocity);
break;
case 5:
val4.GetComponent<Rigidbody>().velocity = val * num;
val4.GetComponent<MF2_Demonade>().SetIFF(parentRound.Source_IFF);
break;
}
}
}
}
}using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using FistVR;
using On.FistVR;
using Steamworks;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AFCL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AFCL")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0d6d2429-46d5-466e-9493-dd4d6071a641")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class EnableOnSpecificUser : MonoBehaviour
{
public List<CSteamID> listofUsers;
public GameObject objectToEnable;
public bool disablesOnSucess;
private void Start()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
CSteamID steamID = SteamUser.GetSteamID();
if (listofUsers.Contains(steamID))
{
if (!disablesOnSucess)
{
objectToEnable.SetActive(true);
}
else
{
objectToEnable.SetActive(false);
}
}
}
}
public class MultiEnableLaserPointer : FVRFireArmAttachmentInterface
{
private bool IsOn;
public GameObject BeamEffect;
public GameObject BeamEffect2;
public GameObject BeamHitPoint;
public Transform Aperture;
public LayerMask LM;
private RaycastHit m_hit;
public AudioEvent AudEvent_LaserOnClip;
public AudioEvent AudEvent_LaserOffClip;
public override void Awake()
{
((FVRFireArmAttachmentInterface)this).Awake();
BeamHitPoint.transform.SetParent((Transform)null);
}
public override void OnDestroy()
{
Object.Destroy((Object)(object)BeamHitPoint);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0006: 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_0044: 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)
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown)
{
ToggleOn();
}
}
else if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.25f && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
{
ToggleOn();
}
((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
}
public override void FVRUpdate()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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)
//IL_0036: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_007c: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (IsOn)
{
Vector3 position = Aperture.position + Aperture.forward * 1000f;
float num = 1000f;
if (Physics.Raycast(Aperture.position, Aperture.forward, ref m_hit, 1000f, LayerMask.op_Implicit(LM), (QueryTriggerInteraction)1))
{
position = ((RaycastHit)(ref m_hit)).point;
num = ((RaycastHit)(ref m_hit)).distance;
}
float num2 = num * 0.01f;
float num3 = Mathf.Lerp(0.01f, 0.2f, num2);
BeamHitPoint.transform.position = position;
BeamHitPoint.transform.localScale = new Vector3(num3, num3, num3);
}
}
public override void OnDetach()
{
((FVRFireArmAttachmentInterface)this).OnDetach();
IsOn = false;
BeamHitPoint.SetActive(IsOn);
BeamEffect.SetActive(IsOn);
BeamEffect2.SetActive(IsOn);
}
private void ToggleOn()
{
//IL_0072: 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)
IsOn = !IsOn;
BeamHitPoint.SetActive(IsOn);
BeamEffect.SetActive(IsOn);
BeamEffect2.SetActive(IsOn);
if (IsOn)
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_LaserOnClip, ((Component)this).transform.position);
}
else
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_LaserOffClip, ((Component)this).transform.position);
}
}
}
[ExecuteInEditMode]
public class NightVisionPostEffect : MonoBehaviour
{
public Material nightVisionMat;
public Material bloom;
public bool renderNightVision = true;
public bool renderBloom = true;
[Range(1f, 16f)]
public int iterations = 1;
private const int BoxDownPrefilterPass = 0;
private const int BoxDownPass = 1;
private const int BoxUpPass = 2;
private const int ApplyBloomPass = 3;
private RenderTexture[] textures = (RenderTexture[])(object)new RenderTexture[16];
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
int num = ((Texture)src).width / 2;
int num2 = ((Texture)src).height / 2;
RenderTextureFormat format = src.format;
RenderTexture val = RenderTexture.GetTemporary(num, num2, 0, format);
if (renderNightVision)
{
Graphics.Blit((Texture)(object)src, val, nightVisionMat);
}
else
{
val = src;
}
if (!renderBloom)
{
Graphics.Blit((Texture)(object)val, dest);
RenderTexture.ReleaseTemporary(val);
return;
}
RenderTexture val2 = (textures[0] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val, val2, bloom, 0);
RenderTexture val3 = val2;
for (int i = 1; i < iterations; i++)
{
num /= 2;
num2 /= 2;
if (num2 < 2)
{
break;
}
val2 = (textures[i] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val3, val2, bloom, 1);
val3 = val2;
}
for (int num3 = iterations - 2; num3 >= 0; num3--)
{
val2 = textures[num3];
textures[num3] = null;
Graphics.Blit((Texture)(object)val3, val2, bloom, 2);
RenderTexture.ReleaseTemporary(val3);
val3 = val2;
}
bloom.SetTexture("_SourceTex", (Texture)(object)val);
Graphics.Blit((Texture)(object)val3, dest, bloom, 3);
RenderTexture.ReleaseTemporary(val3);
RenderTexture.ReleaseTemporary(val);
}
}
[ExecuteInEditMode]
public class PostEffectScript : MonoBehaviour
{
public Material mat;
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
Graphics.Blit((Texture)(object)src, dest, mat);
}
}
namespace Cityrobo.AndrewFTW
{
public class ScopeZoomRotate : MonoBehaviour
{
public FVRInteractiveObject AttachmentInterface;
public MeshRenderer scopeLens;
public Camera camera;
public List<float> ZoomFactor;
[Header("Rotation deatails")]
public List<float> Rotation;
public GameObject ObjectToRotate;
[Header("If you want a Screen above the scope that shows the current Magninification, use these two:")]
public GameObject canvas;
public Text text;
private List<float> CorrespondingCameraFOV;
private int currentZoomIndex;
private int currentRotIndex;
private bool hasZoomText;
public void Start()
{
CorrespondingCameraFOV = new List<float>();
Debug.Log((object)((object)camera).ToString());
currentZoomIndex = 0;
currentRotIndex = 0;
if ((Object)(object)text != (Object)null && (Object)(object)canvas != (Object)null)
{
hasZoomText = true;
}
else
{
hasZoomText = false;
}
for (int i = 0; i < ZoomFactor.Count; i++)
{
CorrespondingCameraFOV.Add(53.7f * Mathf.Pow(ZoomFactor[i], -0.9284f) - 0.5035f);
}
Debug.Log((object)CorrespondingCameraFOV.ToString());
RenderTexture targetTexture = camera.targetTexture;
targetTexture = Object.Instantiate<RenderTexture>(targetTexture);
camera.targetTexture = targetTexture;
((Renderer)scopeLens).material.mainTexture = (Texture)(object)targetTexture;
}
public void Update()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
FVRViveHand hand = AttachmentInterface.m_hand;
if ((Object)(object)hand != (Object)null)
{
if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f)
{
PreviousZoom();
}
else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f)
{
NextZoom();
}
if (hasZoomText)
{
canvas.gameObject.SetActive(true);
text.text = $"Zoom: {ZoomFactor[currentZoomIndex].ToString()}x";
}
}
else if (hasZoomText)
{
canvas.gameObject.SetActive(false);
}
}
public void NextZoom()
{
if (currentZoomIndex != ZoomFactor.Count - 1 || currentRotIndex != Rotation.Count - 1)
{
currentZoomIndex++;
currentRotIndex++;
SetZoom();
}
}
public void PreviousZoom()
{
if (currentZoomIndex != 0 || currentRotIndex != 0)
{
currentZoomIndex--;
currentRotIndex--;
SetZoom();
}
}
public void SetZoom()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
Vector3 localEulerAngles = default(Vector3);
((Vector3)(ref localEulerAngles))..ctor((float)currentRotIndex, 0f, 0f);
ObjectToRotate.transform.localEulerAngles = localEulerAngles;
camera.fieldOfView = CorrespondingCameraFOV[currentZoomIndex];
}
public void ChangeElevation()
{
}
}
}
namespace AndrewFTW
{
public class FireSubprojOnTimeOut : MonoBehaviour
{
public BallisticProjectile ParentRound;
public Vector2 FuseTimer;
private float _setFuseTimer;
private float _fuseElapsedTime;
public void Awake()
{
_setFuseTimer = Random.Range(((Vector2)(ref FuseTimer))[0], ((Vector2)(ref FuseTimer))[1]);
}
public void FixedUpdate()
{
if (_fuseElapsedTime >= _setFuseTimer - Time.fixedDeltaTime)
{
ParentRound.MaxRange = 0f;
}
else
{
_fuseElapsedTime += Time.fixedDeltaTime;
}
}
}
public class ProjectileArmingDistance : MonoBehaviour
{
public BallisticProjectile parentRound;
public float armingDistance;
[Header("Armed Subprojectiles")]
public List<Submunition> ArmedMunitions;
public static bool DoesUseArmingDistance;
public void Awake()
{
if (!DoesUseArmingDistance)
{
parentRound.Submunitions = ArmedMunitions;
}
Hook();
}
public void Hook()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Debug.Log((object)"Hooking Ballistic Projectile");
BallisticProjectile.MoveBullet += new hook_MoveBullet(BallisticProjectile_MoveBullet);
}
private void BallisticProjectile_MoveBullet(orig_MoveBullet orig, BallisticProjectile self, float t)
{
orig.Invoke(self, t);
if ((Object)(object)parentRound == (Object)(object)self && self.m_distanceTraveled >= armingDistance)
{
self.Submunitions = ArmedMunitions;
}
}
public void OnDestroy()
{
Unhook();
}
public void Unhook()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
BallisticProjectile.MoveBullet -= new hook_MoveBullet(BallisticProjectile_MoveBullet);
}
}
public class FireSubprojAtTime : MonoBehaviour
{
[Serializable]
public class c_TangentMunition
{
public enum SubmunitionType
{
GameObject,
Projectile,
Rigidbody,
StickyBomb,
MeleeThrown,
Demonade
}
public enum SubmunitionTrajectoryType
{
Random,
RicochetDir,
Backwards,
Forwards,
ForwardsCone
}
public enum SubmunitionSpawnLogic
{
Outside,
Inside,
On
}
public List<GameObject> Prefabs;
public int NumToSpawn;
public SubmunitionTrajectoryType Trajectory;
public SubmunitionType Type;
public SubmunitionSpawnLogic SpawnLogic;
public Vector2 Speed;
public bool usesParentSpeed;
public float ConeLerp = 0.85f;
}
public BallisticProjectile parentRound;
public float timeToFire;
[Header("Tangent Munitions")]
public List<c_TangentMunition> TangentMunitions;
private bool m_hasFiredTangentMunitions;
private float currLifeTime;
public void Awake()
{
Hook();
}
public void Hook()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Debug.Log((object)"Hooking Ballistic Projectile");
BallisticProjectile.FixedUpdate += new hook_FixedUpdate(BallisticProjectile_FixedUpdate);
}
public void OnDestroy()
{
Unhook();
}
public void Unhook()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
BallisticProjectile.FixedUpdate -= new hook_FixedUpdate(BallisticProjectile_FixedUpdate);
}
public void Update()
{
}
private void BallisticProjectile_FixedUpdate(orig_FixedUpdate orig, BallisticProjectile self)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0044: 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)
orig.Invoke(self);
if ((Object)(object)self == (Object)(object)parentRound && parentRound.m_dieTimerTick <= 0.05f)
{
Debug.Log((object)"Time to die");
Vector3 normalized = ((Vector3)(ref parentRound.m_velocity)).normalized;
FireTangentMunitions(normalized, normalized, ((Component)this).transform.position, ((Vector3)(ref parentRound.m_velocity)).magnitude);
}
}
public void FireTangentMunitions(Vector3 shatterRicochetDir, Vector3 velNorm, Vector3 hitPoint, float VelocityOverride)
{
//IL_0026: 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)
//IL_0029: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected I4, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Invalid comparison between Unknown and I4
//IL_00b6: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: 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_0137: 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_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected I4, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: 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_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
if (m_hasFiredTangentMunitions)
{
return;
}
m_hasFiredTangentMunitions = true;
for (int i = 0; i < TangentMunitions.Count; i++)
{
c_TangentMunition c_TangentMunition = TangentMunitions[i];
Vector3 val = shatterRicochetDir;
Vector3 val2 = hitPoint;
for (int j = 0; j < c_TangentMunition.NumToSpawn; j++)
{
GameObject val3 = c_TangentMunition.Prefabs[Random.Range(0, c_TangentMunition.Prefabs.Count)];
float num = ((!c_TangentMunition.usesParentSpeed) ? Random.Range(c_TangentMunition.Speed.x, c_TangentMunition.Speed.y) : ((Vector3)(ref parentRound.m_velocity)).magnitude);
SubmunitionTrajectoryType trajectory = c_TangentMunition.Trajectory;
switch ((int)trajectory)
{
case 0:
val = Random.onUnitSphere;
break;
case 2:
val = Vector3.Lerp(-velNorm, shatterRicochetDir, 0.5f);
break;
case 3:
val = velNorm;
break;
case 4:
val = Vector3.Lerp(Random.onUnitSphere, velNorm, c_TangentMunition.ConeLerp);
break;
}
SubmunitionSpawnLogic spawnLogic = c_TangentMunition.SpawnLogic;
if ((int)spawnLogic != 1)
{
if ((int)spawnLogic == 0)
{
val2 += ((RaycastHit)(ref parentRound.m_hit)).normal * 0.001f;
}
}
else
{
val2 -= ((RaycastHit)(ref parentRound.m_hit)).normal * 0.001f;
}
GameObject val4 = Object.Instantiate<GameObject>(val3, val2, Quaternion.LookRotation(val));
SubmunitionType type = c_TangentMunition.Type;
switch ((int)type)
{
case 0:
{
Explosion component2 = val4.GetComponent<Explosion>();
if ((Object)(object)component2 != (Object)null)
{
component2.IFF = parentRound.Source_IFF;
}
ExplosionSound component3 = val4.GetComponent<ExplosionSound>();
if ((Object)(object)component3 != (Object)null)
{
component3.IFF = parentRound.Source_IFF;
}
break;
}
case 1:
{
BallisticProjectile component4 = val4.GetComponent<BallisticProjectile>();
component4.Source_IFF = parentRound.Source_IFF;
component4.Fire(num, val4.transform.forward, (FVRFireArm)null, true);
break;
}
case 2:
val4.GetComponent<Rigidbody>().velocity = val * num;
break;
case 3:
val4.GetComponent<Rigidbody>().velocity = val * VelocityOverride;
if (parentRound.PassesFirearmReferenceToSubmunitions)
{
MF2_StickyBomb component = val4.GetComponent<MF2_StickyBomb>();
component.SetIFF(parentRound.Source_IFF);
if ((Object)(object)component != (Object)null && (Object)(object)parentRound.tempFA != (Object)null && ((ClosedBoltWeapon)/*isinst with value type is only supported in some contexts*/).UsesStickyDetonation)
{
FVRFireArm tempFA = parentRound.tempFA;
((ClosedBoltWeapon)((tempFA is ClosedBoltWeapon) ? tempFA : null)).RegisterStickyBomb(component);
}
}
break;
case 4:
val4.GetComponent<Rigidbody>().velocity = val * Mathf.Max(num, parentRound.m_initialMuzzleVelocity);
break;
case 5:
val4.GetComponent<Rigidbody>().velocity = val * num;
val4.GetComponent<MF2_Demonade>().SetIFF(parentRound.Source_IFF);
break;
}
}
}
}
}
[BepInPlugin("h3vr.andrew_ftw.afcl", "Another Fucken Code Liberary", "1.0.0")]
internal class AFCL_BepInEx : BaseUnityPlugin
{
public ConfigEntry<bool> DoesUseArmingDistance;
public AFCL_BepInEx()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"AFCL loaded!");
DoesUseArmingDistance = ((BaseUnityPlugin)this).Config.Bind<bool>("Ammunition Settings", "Does_Use_ArmingDistance", true, "Used by ammunition which can require an arming distance, such as 40mm Grenades");
ProjectileArmingDistance.DoesUseArmingDistance = DoesUseArmingDistance.Value;
((BaseUnityPlugin)this).Logger.LogInfo((object)("Arming Distance set to " + DoesUseArmingDistance.Value));
}
}
public class FireSubprojAtDistance : MonoBehaviour
{
[Serializable]
public class c_TangentMunition
{
public enum SubmunitionType
{
GameObject,
Projectile,
Rigidbody,
StickyBomb,
MeleeThrown,
Demonade
}
public enum SubmunitionTrajectoryType
{
Random,
RicochetDir,
Backwards,
Forwards,
ForwardsCone
}
public enum SubmunitionSpawnLogic
{
Outside,
Inside,
On
}
public List<GameObject> Prefabs;
public int NumToSpawn;
public SubmunitionTrajectoryType Trajectory;
public SubmunitionType Type;
public SubmunitionSpawnLogic SpawnLogic;
public Vector2 Speed;
public bool usesParentSpeed;
public float ConeLerp = 0.85f;
}
public BallisticProjectile parentRound;
public float distanceToFire;
[Header("Tangent Munitions")]
public List<c_TangentMunition> TangentMunitions;
private bool m_hasFiredTangentMunitions;
public void Awake()
{
Hook();
}
public void Hook()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Debug.Log((object)"Hooking Ballistic Projectile");
BallisticProjectile.FixedUpdate += new hook_FixedUpdate(BallisticProjectile_FixedUpdate);
}
public void OnDestroy()
{
Unhook();
}
public void Unhook()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
BallisticProjectile.FixedUpdate -= new hook_FixedUpdate(BallisticProjectile_FixedUpdate);
}
private void BallisticProjectile_FixedUpdate(orig_FixedUpdate orig, BallisticProjectile self)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if ((Object)(object)self == (Object)(object)parentRound && parentRound.m_distanceTraveled >= distanceToFire)
{
Vector3 normalized = ((Vector3)(ref parentRound.m_velocity)).normalized;
FireTangentMunitions(normalized, normalized, ((Component)this).transform.position, ((Vector3)(ref parentRound.m_velocity)).magnitude);
}
}
public void FireTangentMunitions(Vector3 shatterRicochetDir, Vector3 velNorm, Vector3 hitPoint, float VelocityOverride)
{
//IL_0026: 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)
//IL_0029: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected I4, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Invalid comparison between Unknown and I4
//IL_00b6: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: 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_0137: 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_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected I4, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: 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_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
if (m_hasFiredTangentMunitions)
{
return;
}
m_hasFiredTangentMunitions = true;
for (int i = 0; i < TangentMunitions.Count; i++)
{
c_TangentMunition c_TangentMunition = TangentMunitions[i];
Vector3 val = shatterRicochetDir;
Vector3 val2 = hitPoint;
for (int j = 0; j < c_TangentMunition.NumToSpawn; j++)
{
GameObject val3 = c_TangentMunition.Prefabs[Random.Range(0, c_TangentMunition.Prefabs.Count)];
float num = ((!c_TangentMunition.usesParentSpeed) ? Random.Range(c_TangentMunition.Speed.x, c_TangentMunition.Speed.y) : ((Vector3)(ref parentRound.m_velocity)).magnitude);
SubmunitionTrajectoryType trajectory = c_TangentMunition.Trajectory;
switch ((int)trajectory)
{
case 0:
val = Random.onUnitSphere;
break;
case 2:
val = Vector3.Lerp(-velNorm, shatterRicochetDir, 0.5f);
break;
case 3:
val = velNorm;
break;
case 4:
val = Vector3.Lerp(Random.onUnitSphere, velNorm, c_TangentMunition.ConeLerp);
break;
}
SubmunitionSpawnLogic spawnLogic = c_TangentMunition.SpawnLogic;
if ((int)spawnLogic != 1)
{
if ((int)spawnLogic == 0)
{
val2 += ((RaycastHit)(ref parentRound.m_hit)).normal * 0.001f;
}
}
else
{
val2 -= ((RaycastHit)(ref parentRound.m_hit)).normal * 0.001f;
}
GameObject val4 = Object.Instantiate<GameObject>(val3, val2, Quaternion.LookRotation(val));
SubmunitionType type = c_TangentMunition.Type;
switch ((int)type)
{
case 0:
{
Explosion component2 = val4.GetComponent<Explosion>();
if ((Object)(object)component2 != (Object)null)
{
component2.IFF = parentRound.Source_IFF;
}
ExplosionSound component3 = val4.GetComponent<ExplosionSound>();
if ((Object)(object)component3 != (Object)null)
{
component3.IFF = parentRound.Source_IFF;
}
break;
}
case 1:
{
BallisticProjectile component4 = val4.GetComponent<BallisticProjectile>();
component4.Source_IFF = parentRound.Source_IFF;
component4.Fire(num, val4.transform.forward, (FVRFireArm)null, true);
break;
}
case 2:
val4.GetComponent<Rigidbody>().velocity = val * num;
break;
case 3:
val4.GetComponent<Rigidbody>().velocity = val * VelocityOverride;
if (parentRound.PassesFirearmReferenceToSubmunitions)
{
MF2_StickyBomb component = val4.GetComponent<MF2_StickyBomb>();
component.SetIFF(parentRound.Source_IFF);
if ((Object)(object)component != (Object)null && (Object)(object)parentRound.tempFA != (Object)null && ((ClosedBoltWeapon)/*isinst with value type is only supported in some contexts*/).UsesStickyDetonation)
{
FVRFireArm tempFA = parentRound.tempFA;
((ClosedBoltWeapon)((tempFA is ClosedBoltWeapon) ? tempFA : null)).RegisterStickyBomb(component);
}
}
break;
case 4:
val4.GetComponent<Rigidbody>().velocity = val * Mathf.Max(num, parentRound.m_initialMuzzleVelocity);
break;
case 5:
val4.GetComponent<Rigidbody>().velocity = val * num;
val4.GetComponent<MF2_Demonade>().SetIFF(parentRound.Source_IFF);
break;
}
}
}
}
}
}
namespace Plugin.src
{
public class AutoBolt : FVRFireArm
{
public enum ZPos
{
Forward,
Middle,
Rear
}
public enum HammerCockType
{
OnBack,
OnUp,
OnClose,
OnForward
}
public enum FireSelectorModeType
{
Safe,
Single
}
[Serializable]
public class FireSelectorMode
{
public float SelectorPosition;
public FireSelectorModeType ModeType;
public bool IsBoltLocked;
}
private bool debug;
[Header("BoltActionRifle Config")]
public FVRFireArmChamber Chamber;
public bool HasMagEjectionButton = true;
public bool HasFireSelectorButton = true;
public AutoBoltHandle BoltHandle;
public float BoltLerp;
public bool BoltMovingForward;
public AutoBoltHandle.BoltActionHandleState CurBoltHandleState;
public AutoBoltHandle.BoltActionHandleState LastBoltHandleState;
[Header("Hammer Config")]
public bool HasVisualHammer;
public Transform Hammer;
public float HammerUncocked;
public float HammerCocked;
private bool m_isHammerCocked;
public HammerCockType CockType;
private FVRFirearmMovingProxyRound m_proxy;
[Header("Round Positions Config")]
public Transform Extraction_MagazinePos;
public Transform Extraction_ChamberPos;
public Transform Extraction_Ejecting;
public Transform EjectionPos;
public float UpwardEjectionForce;
public float RightwardEjectionForce = 2f;
public float XSpinEjectionTorque = 80f;
public Transform Muzzle;
public GameObject ReloadTriggerWell;
[Header("Control Config")]
public float TriggerResetThreshold = 0.1f;
public float TriggerFiringThreshold = 0.8f;
private float m_triggerFloat;
private bool m_hasTriggerCycled;
private bool m_isMagReleasePressed;
public Transform Trigger_Display;
public float Trigger_ForwardValue;
public float Trigger_RearwardValue;
public InterpStyle TriggerInterpStyle = (InterpStyle)1;
public Transform Trigger_Display2;
public float Trigger_ForwardValue2;
public float Trigger_RearwardValue2;
public InterpStyle TriggerInterpStyle2 = (InterpStyle)1;
public Transform MagReleaseButton_Display;
public Axis MagReleaseAxis;
public InterpStyle MagReleaseInterpStyle = (InterpStyle)1;
public float MagReleasePressedValue;
public float MagReleaseUnpressedValue;
private float m_magReleaseCurValue;
private float m_magReleaseTarValue;
private Vector2 TouchPadAxes = Vector2.zero;
public Transform FireSelector_Display;
public Axis FireSelector_Axis;
public InterpStyle FireSelector_InterpStyle = (InterpStyle)1;
public FireSelectorMode[] FireSelector_Modes;
private int m_fireSelectorMode;
public bool RequiresHammerUncockedToToggleFireSelector;
public bool UsesSecondFireSelectorChange;
public Transform FireSelector_Display_Secondary;
public Axis FireSelector_Axis_Secondary;
public InterpStyle FireSelector_InterpStyle_Secondary = (InterpStyle)1;
public FireSelectorMode[] FireSelector_Modes_Secondary;
[Header("Special Features")]
public bool EjectsMagazineOnEmpty;
public bool PlaysExtraTailOnShot;
public FVRTailSoundClass ExtraTail = (FVRTailSoundClass)8;
private bool justFired;
private bool isLerping1;
private bool isLerping2;
private bool doneLerp1;
private float startTime;
private float journeyLengthBolt1;
private float journeyLengthStock1;
private float journeyLengthBolt2;
private float journeyLengthStock2;
private bool obj1Complete;
private bool obj2Complete;
private bool obj1Complete2;
private bool obj2Complete2;
private bool beginLerp2;
[Header("Lerp Speed >1")]
public float lerpSpeedboltUp = 0.5f;
public float lerpSpeedboltBack = 0.5f;
public float lerpSpeedStockF = 0.5f;
public float lerpSpeedStockR = 0.5f;
[Header("Things to Lerp")]
public GameObject boltObject;
public GameObject stockObject;
[Header("BoltPoints")]
public Transform boltPt1;
public Transform boltPt2;
public Transform boltPt3;
[Header("Stock Points")]
public Transform stockPt1;
public Transform stockPt2;
[Header("Reciprocating Barrel")]
public bool HasReciprocatingBarrel;
public G11RecoilingSystem RecoilSystem;
private bool m_isQuickboltTouching;
private Vector2 lastTPTouchPoint = Vector2.zero;
public bool IsHammerCocked => m_isHammerCocked;
public bool HasExtractedRound()
{
return m_proxy.IsFull;
}
public override void Awake()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
((FVRFireArm)this).Awake();
if (base.UsesClips && (Object)(object)base.ClipTrigger != (Object)null)
{
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear)
{
if (!base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(true);
}
}
else if (base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(false);
}
}
GameObject val = new GameObject("m_proxyRound");
m_proxy = val.AddComponent<FVRFirearmMovingProxyRound>();
m_proxy.Init(((Component)this).transform);
}
public bool CanBoltMove()
{
if (FireSelector_Modes.Length >= 1)
{
return !FireSelector_Modes[m_fireSelectorMode].IsBoltLocked;
}
return true;
}
public override int GetTutorialState()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if ((int)FireSelector_Modes[m_fireSelectorMode].ModeType == 0)
{
return 4;
}
if (Chamber.IsFull)
{
if (Chamber.IsSpent)
{
return 0;
}
if ((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
{
return 6;
}
return 5;
}
if (!((Object)(object)base.Magazine != (Object)null) || base.Magazine.HasARound())
{
return 3;
}
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Forward || CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Mid)
{
return 0;
}
if ((Object)(object)base.Clip != (Object)null)
{
return 2;
}
if (!base.Magazine.IsFull())
{
return 1;
}
return 3;
}
public override void BeginInteraction(FVRViveHand hand)
{
((FVRFireArm)this).BeginInteraction(hand);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Invalid comparison between Unknown and I4
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0484: Unknown result type (might be due to invalid IL or missing references)
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Unknown result type (might be due to invalid IL or missing references)
//IL_045b: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
TouchPadAxes = hand.Input.TouchpadAxes;
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
m_triggerFloat = hand.Input.TriggerFloat;
}
if (!m_hasTriggerCycled)
{
if (m_triggerFloat >= TriggerFiringThreshold)
{
m_hasTriggerCycled = true;
}
}
else if (m_triggerFloat <= TriggerResetThreshold)
{
m_hasTriggerCycled = false;
}
m_isMagReleasePressed = false;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
if (hand.IsInStreamlinedMode)
{
if (HasFireSelectorButton && hand.Input.BYButtonDown)
{
ToggleFireSelector();
}
if (HasMagEjectionButton && hand.Input.AXButtonPressed)
{
m_isMagReleasePressed = true;
}
flag3 = true;
if ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive)
{
flag3 = false;
}
if (!CanBoltMove())
{
flag2 = false;
flag3 = false;
}
if (flag3 && !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hasTriggeredUpSinceBegin && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).IsHeld && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Input.BYButtonDown && BoltHandle.UsesQuickRelease && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward)
{
flag = true;
}
}
else
{
if (HasMagEjectionButton && hand.Input.TouchpadPressed && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && ((Vector2)(ref TouchPadAxes)).magnitude > 0.3f && Vector2.Angle(TouchPadAxes, Vector2.down) <= 45f)
{
m_isMagReleasePressed = true;
}
if ((int)GM.Options.QuickbeltOptions.BoltActionModeSetting == 0)
{
flag3 = true;
}
if ((int)GM.Options.QuickbeltOptions.BoltActionModeSetting == 1)
{
flag2 = true;
}
if (GM.Options.ControlOptions.UseGunRigMode2)
{
flag2 = true;
flag3 = true;
}
if ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive)
{
flag2 = true;
flag3 = false;
}
if (!CanBoltMove())
{
flag2 = false;
flag3 = false;
}
if (IsHammerCocked && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward && BoltHandle.HandleRot == AutoBoltHandle.BoltActionHandleRot.Down)
{
flag2 = false;
}
if (hand.Input.TouchpadDown && ((Vector2)(ref TouchPadAxes)).magnitude > 0.1f)
{
if (flag3 && Vector2.Angle(TouchPadAxes, Vector2.right) <= 45f && BoltHandle.UsesQuickRelease && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward)
{
flag = true;
}
else if (Vector2.Angle(TouchPadAxes, Vector2.left) <= 45f && HasFireSelectorButton)
{
ToggleFireSelector();
}
}
}
if (m_isMagReleasePressed)
{
ReleaseMag();
if ((Object)(object)ReloadTriggerWell != (Object)null)
{
ReloadTriggerWell.SetActive(false);
}
}
else if ((Object)(object)ReloadTriggerWell != (Object)null)
{
ReloadTriggerWell.SetActive(true);
}
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !flag && flag2)
{
if (((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && !((FVRPhysicalObject)this).IsAltHeld) || GM.Options.ControlOptions.UseGunRigMode2 || ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive))
{
if (hand.Input.TouchpadTouched)
{
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (((Vector2)(ref touchpadAxes)).magnitude > 0.1f)
{
bool isQuickboltTouching = m_isQuickboltTouching;
if (Vector2.Angle(touchpadAxes, Vector2.right + Vector2.up) < 90f && !m_isQuickboltTouching)
{
m_isQuickboltTouching = true;
}
if (m_isQuickboltTouching && isQuickboltTouching)
{
float sAngle = GetSAngle(touchpadAxes, lastTPTouchPoint, hand.CMode);
BoltHandle.DriveBolt((0f - sAngle) / 90f);
}
lastTPTouchPoint = touchpadAxes;
}
else
{
lastTPTouchPoint = Vector2.zero;
}
}
else
{
lastTPTouchPoint = Vector2.zero;
}
}
if (m_isQuickboltTouching)
{
Debug.DrawLine(((Component)BoltHandle.BoltActionHandleRoot).transform.position, ((Component)BoltHandle.BoltActionHandleRoot).transform.position + 0.1f * new Vector3(lastTPTouchPoint.x, lastTPTouchPoint.y, 0f), Color.blue);
}
}
if (hand.Input.TouchpadTouchUp)
{
m_isQuickboltTouching = false;
lastTPTouchPoint = Vector2.zero;
}
FiringSystem();
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (flag && !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
{
m_isQuickboltTouching = false;
lastTPTouchPoint = Vector2.zero;
hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
hand.HandMadeGrabReleaseSound();
hand.EndInteractionIfHeld((FVRInteractiveObject)(object)this);
((FVRInteractiveObject)this).EndInteraction(hand);
((FVRInteractiveObject)BoltHandle).BeginInteraction(hand);
hand.ForceSetInteractable((FVRInteractiveObject)(object)BoltHandle);
BoltHandle.TPInitiate();
}
}
public float GetSignedAngle(Vector2 from, Vector2 to)
{
//IL_0002: 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_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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(from.y, 0f - from.x);
Vector2 normalized = ((Vector2)(ref val)).normalized;
float num = Mathf.Sign(Vector2.Dot(from, normalized));
return Vector2.Angle(from, to) * num;
}
private float GetSAngle(Vector2 v1, Vector2 v2, ControlMode m)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_0018: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
if ((int)m == 3)
{
return (v1.y - v2.y) * 130f;
}
float num = Mathf.Sign(v1.x * v2.y - v1.y * v2.x);
return Vector2.Angle(v1, v2) * num;
}
public override void EndInteraction(FVRViveHand hand)
{
//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)
m_triggerFloat = 0f;
m_hasTriggerCycled = false;
m_isMagReleasePressed = false;
m_isQuickboltTouching = false;
lastTPTouchPoint = Vector2.zero;
((FVRFireArm)this).EndInteraction(hand);
}
public void SetHasTriggeredUp()
{
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = true;
}
public void CockHammer()
{
if (!m_isHammerCocked)
{
m_isHammerCocked = true;
if (HasVisualHammer)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerCocked, (InterpStyle)0, (Axis)2);
}
}
}
public void DropHammer()
{
if (IsHammerCocked)
{
m_isHammerCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
Fire();
if (HasVisualHammer)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerUncocked, (InterpStyle)0, (Axis)2);
}
}
}
protected virtual void ToggleFireSelector()
{
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
if ((RequiresHammerUncockedToToggleFireSelector && IsHammerCocked) || ((FVRInteractiveObject)BoltHandle).IsHeld || CurBoltHandleState != 0 || BoltHandle.HandleRot != AutoBoltHandle.BoltActionHandleRot.Down || FireSelector_Modes.Length <= 1)
{
return;
}
m_fireSelectorMode++;
if (m_fireSelectorMode >= FireSelector_Modes.Length)
{
m_fireSelectorMode -= FireSelector_Modes.Length;
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
if ((Object)(object)FireSelector_Display != (Object)null)
{
((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display, FireSelector_Modes[m_fireSelectorMode].SelectorPosition, FireSelector_InterpStyle, FireSelector_Axis);
if (UsesSecondFireSelectorChange)
{
((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display_Secondary, FireSelector_Modes_Secondary[m_fireSelectorMode].SelectorPosition, FireSelector_InterpStyle_Secondary, FireSelector_Axis_Secondary);
}
}
}
public void ReleaseMag()
{
if ((Object)(object)base.Magazine != (Object)null)
{
m_magReleaseCurValue = MagReleasePressedValue;
((FVRFireArm)this).EjectMag(false);
}
}
public FireSelectorMode GetFiringMode()
{
return FireSelector_Modes[m_fireSelectorMode];
}
protected virtual void FiringSystem()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if ((int)FireSelector_Modes[m_fireSelectorMode].ModeType != 0 && !((FVRPhysicalObject)this).IsAltHeld && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward && BoltHandle.HandleRot != 0 && m_hasTriggerCycled)
{
DropHammer();
}
}
public bool Fire()
{
//IL_0069: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: 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)
_ = FireSelector_Modes[m_fireSelectorMode];
if (!Chamber.Fire())
{
return false;
}
((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
((FVRFireArm)this).FireMuzzleSmoke();
bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag2 = ((FVRFireArm)this).IsForegripStabilized();
bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
FVRSoundEnvironment currentSoundEnvironment = GM.CurrentPlayerBody.GetCurrentSoundEnvironment();
((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), currentSoundEnvironment, 1f);
justFired = true;
if (PlaysExtraTailOnShot)
{
AudioEvent tailSet = SM.GetTailSet(ExtraTail, currentSoundEnvironment);
base.m_pool_tail.PlayClipVolumePitchOverride(tailSet, ((Component)this).transform.position, tailSet.VolumeRange * 1f, base.AudioClipSet.TailPitchMod_Main * tailSet.PitchRange.x, (AudioMixerGroup)null);
}
if (HasReciprocatingBarrel)
{
RecoilSystem.Recoil(false);
}
Chamber.IsAccessible = true;
return true;
}
public void Update()
{
//IL_000b: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0468: Unknown result type (might be due to invalid IL or missing references)
//IL_049f: Unknown result type (might be due to invalid IL or missing references)
//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_057d: Unknown result type (might be due to invalid IL or missing references)
//IL_059d: Unknown result type (might be due to invalid IL or missing references)
if (BoltHandle.BoltActionHandleRoot.localPosition.z <= Vector3.Lerp(BoltHandle.Point_Forward.localPosition, BoltHandle.Point_Rearward.localPosition, 0.5f).z && BoltHandle.BoltActionHandle.localEulerAngles.z < BoltHandle.UnlockThreshold && debug)
{
Debug.Log((object)"This is working?");
}
if (!justFired)
{
return;
}
if (!isLerping1 && !doneLerp1)
{
obj1Complete2 = false;
obj2Complete2 = false;
if (debug)
{
Debug.Log((object)"Begin Lerp 1");
}
startTime = Time.time;
journeyLengthBolt1 = Vector3.Distance(boltPt1.localPosition, boltPt2.localPosition);
if (debug)
{
Debug.Log((object)("journeylengthbolt" + journeyLengthBolt1));
}
journeyLengthStock1 = Vector3.Distance(stockPt1.localPosition, stockPt2.localPosition);
isLerping1 = true;
stockObject.transform.localPosition = ((Component)stockPt1).transform.localPosition;
boltObject.transform.localPosition = ((Component)boltPt1).transform.localPosition;
}
if (isLerping1)
{
float num = (Time.time - startTime) * lerpSpeedboltUp;
float num2 = (Time.time - startTime) * lerpSpeedStockF;
float num3 = num / journeyLengthBolt1;
float num4 = num2 / journeyLengthStock1;
if (debug)
{
Debug.Log((object)"these values dont help have a nice egg instead ()");
}
if (!obj1Complete)
{
if (debug)
{
Debug.Log((object)"lerping bolt1");
}
boltObject.transform.localPosition = Vector3.Lerp(boltPt1.localPosition, boltPt2.localPosition, num3);
BoltHandle.ManipulateBoltUsingPosition(boltObject.transform.position, touchpadDrive: true);
}
if (!obj2Complete)
{
if (debug)
{
Debug.Log((object)"Lerping Stock 1");
}
stockObject.transform.localPosition = Vector3.Lerp(stockPt1.localPosition, stockPt2.localPosition, num4);
}
if (num3 >= 1f)
{
obj1Complete = true;
if (debug)
{
Debug.Log((object)"Bolts done pt1");
}
}
if (num4 >= 1f)
{
obj2Complete = true;
if (debug)
{
Debug.Log((object)"Stocks done pt1");
}
}
if (obj1Complete && obj2Complete)
{
if (debug)
{
Debug.Log((object)"LERP1 IS DONE IT SHOULDNT BE BEING CALLED ANYMORE");
}
isLerping1 = false;
beginLerp2 = true;
doneLerp1 = true;
}
}
if (!isLerping2 && beginLerp2)
{
if (debug)
{
Debug.Log((object)"Begin Lerp 2");
}
startTime = Time.time;
journeyLengthBolt2 = Vector3.Distance(boltPt2.localPosition, boltPt3.localPosition);
journeyLengthStock2 = Vector3.Distance(stockPt2.localPosition, stockPt1.localPosition);
boltObject.transform.localPosition = ((Component)boltPt2).transform.localPosition;
stockObject.transform.localPosition = ((Component)stockPt2).transform.localPosition;
isLerping2 = true;
beginLerp2 = false;
obj1Complete = false;
obj2Complete = false;
}
if (!isLerping2)
{
return;
}
float num5 = (Time.time - startTime) * lerpSpeedboltBack;
float num6 = (Time.time - startTime) * lerpSpeedStockR;
float num7 = num5 / journeyLengthBolt2;
float num8 = num6 / journeyLengthStock2;
if (debug)
{
Debug.Log((object)"Lerp: the flamethrower! The kids love this one");
}
if (!obj1Complete2)
{
if (debug)
{
Debug.Log((object)"lerping bolt2");
}
boltObject.transform.localPosition = Vector3.Lerp(boltPt2.localPosition, boltPt3.localPosition, num7);
BoltHandle.ManipulateBoltUsingPosition(boltObject.transform.position, touchpadDrive: true);
}
if (!obj2Complete2)
{
if (debug)
{
Debug.Log((object)"Lerping Stock 2");
}
stockObject.transform.localPosition = Vector3.Lerp(stockPt2.localPosition, stockPt1.localPosition, num8);
}
if (num7 >= 1f)
{
obj1Complete2 = true;
if (debug)
{
Debug.Log((object)"Bolts done pt2");
}
boltObject.transform.localPosition = ((Component)boltPt3).transform.localPosition;
UpdateBolt(AutoBoltHandle.BoltActionHandleState.Rear, 1f);
Chamber.IsAccessible = true;
}
if (num8 >= 1f)
{
stockObject.transform.localPosition = ((Component)stockPt1).transform.localPosition;
obj2Complete2 = true;
if (debug)
{
Debug.Log((object)"Stocks done pt2");
}
}
if (obj1Complete2 && obj2Complete2)
{
boltObject.transform.localPosition = ((Component)boltPt3).transform.localPosition;
stockObject.transform.localPosition = ((Component)stockPt1).transform.localPosition;
if (debug)
{
Debug.Log((object)"All done the autobolt shit");
}
BoltHandle.DriveBolt(1f);
isLerping2 = false;
justFired = false;
doneLerp1 = false;
}
}
public override void FVRFixedUpdate()
{
((FVRFireArm)this).FVRFixedUpdate();
UpdateComponentDisplay();
}
private void UpdateComponentDisplay()
{
//IL_000f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Invalid comparison between Unknown and I4
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Invalid comparison between Unknown and I4
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Invalid comparison between Unknown and I4
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Trigger_Display != (Object)null)
{
if ((int)TriggerInterpStyle == 0)
{
Trigger_Display.localPosition = new Vector3(0f, 0f, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat));
}
else if ((int)TriggerInterpStyle == 1)
{
Trigger_Display.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), 0f, 0f);
}
}
if ((Object)(object)Trigger_Display2 != (Object)null)
{
if ((int)TriggerInterpStyle == 0)
{
Trigger_Display2.localPosition = new Vector3(0f, 0f, Mathf.Lerp(Trigger_ForwardValue2, Trigger_RearwardValue2, m_triggerFloat));
}
else if ((int)TriggerInterpStyle == 1)
{
Trigger_Display2.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_ForwardValue2, Trigger_RearwardValue2, m_triggerFloat), 0f, 0f);
}
}
if ((Object)(object)MagReleaseButton_Display != (Object)null)
{
Vector3 zero = Vector3.zero;
if (m_isMagReleasePressed)
{
m_magReleaseTarValue = MagReleasePressedValue;
}
else
{
m_magReleaseTarValue = MagReleaseUnpressedValue;
}
m_magReleaseCurValue = Mathf.Lerp(m_magReleaseCurValue, m_magReleaseTarValue, Time.deltaTime * 4f);
float magReleaseCurValue = m_magReleaseCurValue;
Axis magReleaseAxis = MagReleaseAxis;
if ((int)magReleaseAxis != 0)
{
if ((int)magReleaseAxis != 1)
{
if ((int)magReleaseAxis == 2)
{
zero.z = magReleaseCurValue;
}
}
else
{
zero.y = magReleaseCurValue;
}
}
else
{
zero.x = magReleaseCurValue;
}
InterpStyle magReleaseInterpStyle = MagReleaseInterpStyle;
if ((int)magReleaseInterpStyle != 0)
{
if ((int)magReleaseInterpStyle == 1)
{
MagReleaseButton_Display.localEulerAngles = zero;
}
}
else
{
MagReleaseButton_Display.localPosition = zero;
}
}
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Forward)
{
base.IsBreachOpenForGasOut = false;
}
else
{
base.IsBreachOpenForGasOut = true;
}
}
public void UpdateBolt(AutoBoltHandle.BoltActionHandleState State, float lerp)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Invalid comparison between Unknown and I4
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: 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)
CurBoltHandleState = State;
BoltLerp = lerp;
if (CurBoltHandleState != 0 && !m_proxy.IsFull && !Chamber.IsFull)
{
Chamber.IsAccessible = true;
}
else
{
Chamber.IsAccessible = false;
}
if (base.UsesClips && (Object)(object)base.ClipTrigger != (Object)null)
{
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear)
{
if (!base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(true);
}
}
else if (base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(false);
}
}
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear && LastBoltHandleState != AutoBoltHandle.BoltActionHandleState.Rear)
{
if ((int)CockType == 0)
{
CockHammer();
}
if (Chamber.IsFull)
{
if (debug)
{
Debug.Log((object)"This should only be happing if it was manually cycled");
}
Chamber.EjectRound(EjectionPos.position, ((Component)this).transform.right * RightwardEjectionForce + ((Component)this).transform.up * UpwardEjectionForce, ((Component)this).transform.right * XSpinEjectionTorque, false);
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f);
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)41, 1f);
}
BoltMovingForward = true;
}
else if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Forward && LastBoltHandleState != 0)
{
if ((int)CockType == 3)
{
CockHammer();
}
if (m_proxy.IsFull && !Chamber.IsFull)
{
Chamber.SetRound(m_proxy.Round, false);
m_proxy.ClearProxy();
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f);
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)40, 1f);
}
BoltMovingForward = false;
}
else if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Mid && LastBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear && (Object)(object)base.Magazine != (Object)null)
{
if (!m_proxy.IsFull && base.Magazine.HasARound() && !Chamber.IsFull)
{
GameObject fromPrefabReference = base.Magazine.RemoveRound(false);
m_proxy.SetFromPrefabReference(fromPrefabReference);
}
if (EjectsMagazineOnEmpty && !base.Magazine.HasARound())
{
((FVRFireArm)this).EjectMag(false);
}
}
if (m_proxy.IsFull)
{
m_proxy.ProxyRound.position = Vector3.Lerp(Extraction_ChamberPos.position, Extraction_MagazinePos.position, BoltLerp);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(Extraction_ChamberPos.rotation, Extraction_MagazinePos.rotation, BoltLerp);
}
if (Chamber.IsFull)
{
Chamber.ProxyRound.position = Vector3.Lerp(Extraction_ChamberPos.position, Extraction_Ejecting.position, BoltLerp);
Chamber.ProxyRound.rotation = Quaternion.Slerp(Extraction_ChamberPos.rotation, Extraction_Ejecting.rotation, BoltLerp);
}
LastBoltHandleState = CurBoltHandleState;
}
public override List<FireArmRoundClass> GetChamberRoundList()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (Chamber.IsFull && !Chamber.IsSpent)
{
return new List<FireArmRoundClass> { Chamber.GetRound().RoundClass };
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count > 0)
{
Chamber.Autochamber(rounds[0]);
}
}
public override List<string> GetFlagList()
{
return null;
}
public override void SetFromFlagList(List<string> flags)
{
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
//IL_00a8: 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)
string empty = string.Empty;
_ = string.Empty;
empty = "HammerState";
if (f.ContainsKey(empty))
{
if (f[empty] == "Cocked")
{
m_isHammerCocked = true;
}
if (HasVisualHammer)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerCocked, (InterpStyle)0, (Axis)2);
}
}
if (FireSelector_Modes.Length > 1)
{
empty = "FireSelectorState";
if (f.ContainsKey(empty))
{
int.TryParse(f[empty], out m_fireSelectorMode);
}
if ((Object)(object)FireSelector_Display != (Object)null)
{
FireSelectorMode val = FireSelector_Modes[m_fireSelectorMode];
((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display, val.SelectorPosition, FireSelector_InterpStyle, FireSelector_Axis);
}
}
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
string key = "HammerState";
string value = "Uncocked";
if (m_isHammerCocked)
{
value = "Cocked";
}
dictionary.Add(key, value);
if (FireSelector_Modes.Length > 1)
{
key = "FireSelectorState";
value = m_fireSelectorMode.ToString();
dictionary.Add(key, value);
}
return dictionary;
}
}
public class AutoBoltHandle : FVRInteractiveObject
{
public enum BoltActionHandleState
{
Forward,
Mid,
Rear
}
public enum BoltActionHandleRot
{
Up,
Mid,
Down
}
public AutoBolt Rifle;
public bool UsesQuickRelease;
public Transform BoltActionHandleRoot;
public Transform BoltActionHandle;
public float BaseRotOffset;
private float rotAngle;
public float MinRot;
public float MaxRot;
public float UnlockThreshold = 70f;
public Transform Point_Forward;
public Transform Point_Rearward;
public Vector3 HandPosOffset = new Vector3(0f, 0f, 0f);
private bool m_wasTPInitiated;
public bool UsesExtraRotationPiece;
public Transform ExtraRotationPiece;
public BoltActionHandleState HandleState;
public BoltActionHandleState LastHandleState;
public BoltActionHandleRot HandleRot = BoltActionHandleRot.Down;
public BoltActionHandleRot LastHandleRot = BoltActionHandleRot.Down;
private Vector3 m_localHandPos_BoltDown;
private Vector3 m_localHandPos_BoltUp;
private Vector3 m_localHandPos_BoltBack;
private float fakeBoltDrive;
public override void Awake()
{
((FVRInteractiveObject)this).Awake();
CalculateHandPoses();
}
public void TPInitiate()
{
m_wasTPInitiated = true;
}
public override void EndInteraction(FVRViveHand hand)
{
m_wasTPInitiated = false;
((FVRInteractiveObject)this).EndInteraction(hand);
}
public override bool IsInteractable()
{
if (Rifle.CanBoltMove())
{
return ((FVRInteractiveObject)this).IsInteractable();
}
return false;
}
private void CalculateHandPoses()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_003c: 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_0065: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00df: 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)
m_localHandPos_BoltDown = ((Component)Rifle).transform.InverseTransformPoint(((Component)this).transform.position);
Vector3 val = ((Component)this).transform.position - BoltActionHandleRoot.position;
val = Quaternion.AngleAxis(Mathf.Abs(MaxRot - MinRot) + 10f, BoltActionHandleRoot.forward) * val;
val += BoltActionHandleRoot.position;
m_localHandPos_BoltUp = ((Component)Rifle).transform.InverseTransformPoint(val);
Vector3 val2 = val + -BoltActionHandleRoot.forward * (0.005f + Vector3.Distance(Point_Forward.position, Point_Rearward.position));
m_localHandPos_BoltBack = ((Component)Rifle).transform.InverseTransformPoint(val2);
}
public override void FVRUpdate()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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)
((FVRInteractiveObject)this).FVRUpdate();
Debug.DrawLine(((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltDown), ((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltUp), Color.red);
Debug.DrawLine(((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltUp), ((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltBack), Color.blue);
}
public void DriveBolt(float amount)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((FVRFireArm)Rifle).Clip != (Object)null)
{
((FVRFireArm)Rifle).EjectClip();
return;
}
fakeBoltDrive += amount;
fakeBoltDrive = Mathf.Clamp(fakeBoltDrive, 0f, 1f);
Vector3 val = ((!(fakeBoltDrive < 0.5f)) ? Vector3.Lerp(m_localHandPos_BoltUp, m_localHandPos_BoltBack, (fakeBoltDrive - 0.5f) * 2f) : Vector3.Slerp(m_localHandPos_BoltDown, m_localHandPos_BoltUp, fakeBoltDrive * 2f));
val = ((Component)Rifle).transform.TransformPoint(val);
ManipulateBoltUsingPosition(val, touchpadDrive: true);
float num = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, BoltActionHandleRoot.localPosition.z);
if (num < 0.05f)
{
HandleState = BoltActionHandleState.Forward;
}
else if (num > 0.95f)
{
HandleState = BoltActionHandleState.Rear;
}
else
{
HandleState = BoltActionHandleState.Mid;
}
Rifle.UpdateBolt(HandleState, num);
LastHandleState = HandleState;
}
public bool ManipulateBoltUsingPosition(Vector3 pos, bool touchpadDrive)
{
//IL_000d: 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_001e: 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)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_005c: 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)
//IL_0067: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Invalid comparison between Unknown and I4
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Invalid comparison between Unknown and I4
bool result = false;
if (HandleState == BoltActionHandleState.Forward)
{
Vector3 val = pos - BoltActionHandle.position;
Vector3 val2 = Vector3.ProjectOnPlane(val, ((Component)BoltActionHandleRoot).transform.forward);
val = ((Vector3)(ref val2)).normalized;
Vector3 right = ((Component)BoltActionHandleRoot).transform.right;
rotAngle = Mathf.Atan2(Vector3.Dot(BoltActionHandleRoot.forward, Vector3.Cross(right, val)), Vector3.Dot(right, val)) * 57.29578f;
rotAngle += BaseRotOffset;
rotAngle = Mathf.Clamp(rotAngle, MinRot, MaxRot);
BoltActionHandle.localEulerAngles = new Vector3(0f, 0f, rotAngle);
if (UsesExtraRotationPiece)
{
ExtraRotationPiece.localEulerAngles = new Vector3(0f, 0f, rotAngle);
}
if (rotAngle >= UnlockThreshold)
{
HandleRot = BoltActionHandleRot.Up;
}
else if (Mathf.Abs(rotAngle - MinRot) < 2f)
{
HandleRot = BoltActionHandleRot.Down;
}
else
{
HandleRot = BoltActionHandleRot.Mid;
}
if (HandleRot == BoltActionHandleRot.Up && LastHandleRot != 0)
{
((FVRFireArm)Rifle).PlayAudioEvent((FirearmAudioEventType)12, 1f);
if ((int)Rifle.CockType == 1)
{
Rifle.CockHammer();
}
}
else if (HandleRot == BoltActionHandleRot.Down && LastHandleRot != BoltActionHandleRot.Down)
{
((FVRFireArm)Rifle).PlayAudioEvent((FirearmAudioEventType)13, 1f);
if ((int)Rifle.CockType == 2)
{
Rifle.CockHammer();
}
result = true;
}
LastHandleRot = HandleRot;
}
if (rotAngle >= UnlockThreshold)
{
Vector3 val3 = HandPosOffset.x * BoltActionHandleRoot.right + HandPosOffset.y * BoltActionHandleRoot.up + HandPosOffset.z * BoltActionHandleRoot.forward;
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Forward.position, Point_Rearward.position, pos - val3);
BoltActionHandleRoot.position = closestValidPoint;
}
return result;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0026: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((FVRFireArm)Rifle).Clip != (Object)null)
{
((FVRFireArm)Rifle).EjectClip();
return;
}
bool num = ManipulateBoltUsingPosition(((HandInput)(ref hand.Input)).Pos, touchpadDrive: false);
float num2 = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, BoltActionHandleRoot.localPosition.z);
if (num2 < 0.05f)
{
HandleState = BoltActionHandleState.Forward;
}
else if (num2 > 0.95f)
{
HandleState = BoltActionHandleState.Rear;
}
else
{
HandleState = BoltActionHandleState.Mid;
}
if ((HandleState != 0 || LastHandleState == BoltActionHandleState.Forward) && HandleState == BoltActionHandleState.Rear)
{
_ = LastHandleState;
_ = 2;
}
Rifle.UpdateBolt(HandleState, num2);
LastHandleState = HandleState;
((FVRInteractiveObject)this).UpdateInteraction(hand);
if (num && UsesQuickRelease && m_wasTPInitiated && (((FVRPhysicalObject)Rifle).IsAltHeld || !((FVRInteractiveObject)Rifle).IsHeld))
{
hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
((FVRInteractiveObject)this).EndInteraction(hand);
((FVRInteractiveObject)Rifle).BeginInteraction(hand);
hand.ForceSetInteractable((FVRInteractiveObject)(object)Rifle);
if (!hand.Input.TriggerPressed)
{
Rifle.SetHasTriggeredUp();
}
}
}
}
public class bangerSwitchInterp
{
public enum Axis
{
X,
Y,
Z
}
private bool m_isLargeAperture = true;
public Transform Flipsight;
public float m_flipsightStartRotX;
public float m_flipsightEndRotX = -90f;
private float m_flipsightCurRotX;
public Axis RotAxis;
private float m_curFlipLerp;
private float m_tarFlipLerp;
private float m_lastFlipLerp;
public BangerSwitch switchToObserve;
}
internal class betterOverheat : MonoBehaviour
{
[GradientHDR]
public Gradient colorGrad;
public Renderer Rend;
public Handgun Hangun;
public AudioEvent AudEvent_Overheat;
public AudioEvent AudEvent_AllSet;
public ParticleSystem PSystem_Overheat;
public ParticleSystem PSystem_Overheat2;
private float m_heat;
public float m_timeSinceLastShot = 1f;
private bool m_isOverheating;
private float m_coolTime = 3.5f;
public GameObject enableWhenHot;
[Header("Heat Per Shot (max 1)")]
public float heatPerShot = 0.1f;
[Header("Cooldown time")]
public float coolDown = 3.5f;
[Header("To Lerp or not to Lerp")]
public bool HasLerp;
[Header("Open Position")]
public Transform pointInterp1;
[Header("Closed Position")]
public Transform pointInterp2;
[Header("Lerp Speed >1")]
public float lerpSpeed = 0.5f;
[Header("Thing to Lerp")]
public GameObject lerpObject;
private bool isLerping;
private float startTime;
private float journeyLength;
private bool isOpen;
private void OnShotFired(FVRFireArm firearm)
{
if ((Object)(object)firearm == (Object)(object)Hangun)
{
AddHeat();
PSystem_Overheat.Emit(5);
PSystem_Overheat2.Emit(5);
}
}
private void AddHeat()
{
m_heat += heatPerShot;
m_timeSinceLastShot = 0f;
if (m_heat >= 1f && !m_isOverheating)
{
Overheat();
}
m_heat = Mathf.Clamp(m_heat, 0f, 1f);
}
private void Overheat()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
enableWhenHot.SetActive(true);
m_isOverheating = true;
((FVRFireArm)Hangun).Magazine.ForceEmpty();
m_coolTime = coolDown;
((FVRFireArm)Hangun).PlayAudioAsHandling(AudEvent_Overheat, ((Component)this).transform.position).FollowThisTransform(((Component)this).transform);
}
private void Reset()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
enableWhenHot.SetActive(false);
m_isOverheating = false;
((FVRFireArm)Hangun).Magazine.ForceFull();
Hangun.DropSlideRelease();
m_heat = 0f;
((FVRFireArm)Hangun).PlayAudioAsHandling(AudEvent_AllSet, ((Component)this).transform.position).FollowThisTransform(((Component)this).transform);
}
private void Update()
{
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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)
Hangun.IsSlideLockExternalHeldDown = false;
Vector3 localPosition;
if (!m_isOverheating)
{
if (HasLerp)
{
if (!isLerping)
{
Debug.Log((object)"roatethinggoooo");
startTime = Time.time;
journeyLength = Vector3.Distance(pointInterp1.localPosition, pointInterp2.localPosition);
isLerping = true;
}
if (isLerping && isOpen)
{
float num = (Time.time - startTime) * lerpSpeed;
float num2 = num / journeyLength;
string[] obj = new string[6]
{
"fraction of journety",
num2.ToString(),
"dist covered",
num.ToString(),
"objloc",
null
};
localPosition = lerpObject.transform.localPosition;
obj[5] = ((object)(Vector3)(ref localPosition)).ToString();
Debug.Log((object)string.Concat(obj));
lerpObject.transform.localPosition = Vector3.Lerp(pointInterp1.localPosition, pointInterp2.localPosition, num2);
if (num2 >= 1f)
{
isLerping = false;
isOpen = false;
}
}
}
if (m_timeSinceLastShot < 0.3f)
{
m_timeSinceLastShot += Time.deltaTime;
}
else if (m_heat > 0f)
{
m_heat -= Time.deltaTime;
}
}
else
{
if (HasLerp)
{
if (!isLerping)
{
Debug.Log((object)"roatethinggoooo");
startTime = Time.time;
journeyLength = Vector3.Distance(pointInterp2.localPosition, pointInterp1.localPosition);
isLerping = true;
}
if (isLerping && !isOpen)
{
float num3 = (Time.time - startTime) * lerpSpeed;
float num4 = num3 / journeyLength;
string[] obj2 = new string[6]
{
"fraction of journety",
num4.ToString(),
"dist covered",
num3.ToString(),
"objloc",
null
};
localPosition = lerpObject.transform.localPosition;
obj2[5] = ((object)(Vector3)(ref localPosition)).ToString();
Debug.Log((object)string.Concat(obj2));
lerpObject.transform.localPosition = Vector3.Lerp(pointInterp2.localPosition, pointInterp1.localPosition, num4);
if (num4 >= 1f)
{
isLerping = false;
isOpen = true;
}
}
}
PSystem_Overheat.Emit(1);
if (m_coolTime > 0f)
{
m_coolTime -= Time.deltaTime;
}
else
{
Reset();
}
}
float num5 = Mathf.Lerp(0.5f, -0.5f, m_heat);
Rend.material.SetColor("_EmissionColor", colorGrad.Evaluate(m_heat));
Rend.material.SetTextureOffset("_IncandescenceMap", new Vector2(0f, num5));
}
private void Start()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
private void OnDisable()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired);
}
}
[RequireComponent(typeof(PMat))]
public class BreakableArmour : MonoBehaviour, IFVRDamageable
{
public MatDef defaultMatdef;
public MatDef brokenMatdef;
public float durability;
public AudioEvent shatter;
public bool isDebug;
private bool playedaudio;
private float damageTaken;
public void Start()
{
((Component)this).GetComponent<PMat>().MatDef = defaultMatdef;
}
public void Update()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (damageTaken >= durability && !playedaudio)
{
((Component)this).GetComponent<PMat>().MatDef = brokenMatdef;
SM.PlayGenericSound(shatter, ((Component)this).transform.position);
playedaudio = true;
}
}
public void Damage(Damage d)
{
damageTaken += d.Dam_TotalKinetic;
if (isDebug)
{
Debug.Log((object)("Damange taken: " + d.Dam_TotalKinetic));
Debug.Log((object)("Total Damange taken: " + damageTaken));
}
}
}
public class EnergySword : FVRMeleeWeapon
{
private Material bladeMat;
public GameObject bladePhys;
public AudioEvent igniteSound;
public AudioEvent retractSound;
[Header("Lerp Speed >1")]
public float lerpSpeed = 0.5f;
public bool isdebug;
public float lungeStrength = 12f;
public float cooldown = 1f;
private bool isLit;
private bool isLerping;
private float startTime;
private float journeyLength;
private bool stable = true;
private bool hasLunged;
private float cooldownTime;
private float lastHealth;
private bool firstRun;
private void Start()
{
//IL_0006: 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_001e: Unknown result type (might be due to invalid IL or missing references)
Color color = bladeMat.color;
color.a = 0f;
bladeMat.color = color;
bladePhys.SetActive(false);
lastHealth = GM.CurrentPlayerBody.GetPlayerHealth();
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_006d: 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)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
if (!isLit)
{
if (isdebug)
{
Debug.Log((object)"turn on bitch");
}
((FVRPhysicalObject)this).Size = (FVRPhysicalObjectSize)5;
isLit = true;
stable = false;
}
else
{
if (isdebug)
{
Debug.Log((object)"turn off bitch");
}
((FVRPhysicalObject)this).Size = (FVRPhysicalObjectSize)1;
isLit = false;
stable = false;
}
}
else if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && isLit)
{
if (isdebug)
{
Debug.Log((object)"YEET");
}
Lunge();
}
}
private void Update()
{
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: 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_0082: 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_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing refeusing System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using FistVR;
using On.FistVR;
using OpenScripts2;
using Steamworks;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AFCL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AFCL")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0d6d2429-46d5-466e-9493-dd4d6071a641")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class EnableOnSpecificUser : MonoBehaviour
{
public enum action
{
Enable,
Disable,
ModifyFirearm
}
public action Action;
public List<CSteamID> listofUsers;
[Header("Object Enable")]
public GameObject objectToEnable;
[Header("Firearm Modify")]
public Handgun Handgun;
public bool HasMagReleaseButton;
private void Start()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
CSteamID steamID = SteamUser.GetSteamID();
if (listofUsers.Contains(steamID))
{
switch (Action)
{
case action.Enable:
objectToEnable.SetActive(true);
break;
case action.Disable:
objectToEnable.SetActive(false);
break;
case action.ModifyFirearm:
Handgun.HasMagReleaseInput = true;
break;
}
}
}
}
public class MultiEnableLaserPointer : FVRFireArmAttachmentInterface
{
private bool IsOn;
public GameObject BeamEffect;
public GameObject BeamEffect2;
public GameObject BeamHitPoint;
public Transform Aperture;
public LayerMask LM;
private RaycastHit m_hit;
public AudioEvent AudEvent_LaserOnClip;
public AudioEvent AudEvent_LaserOffClip;
public void Awake()
{
((FVRFireArmAttachmentInterface)this).Awake();
BeamHitPoint.transform.SetParent((Transform)null);
}
public override void OnDestroy()
{
Object.Destroy((Object)(object)BeamHitPoint);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0006: 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_0044: 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)
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown)
{
ToggleOn();
}
}
else if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.25f && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
{
ToggleOn();
}
((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
}
public void FVRUpdate()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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)
//IL_0036: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_007c: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (IsOn)
{
Vector3 position = Aperture.position + Aperture.forward * 1000f;
float num = 1000f;
if (Physics.Raycast(Aperture.position, Aperture.forward, ref m_hit, 1000f, LayerMask.op_Implicit(LM), (QueryTriggerInteraction)1))
{
position = ((RaycastHit)(ref m_hit)).point;
num = ((RaycastHit)(ref m_hit)).distance;
}
float num2 = num * 0.01f;
float num3 = Mathf.Lerp(0.01f, 0.2f, num2);
BeamHitPoint.transform.position = position;
BeamHitPoint.transform.localScale = new Vector3(num3, num3, num3);
}
}
public override void OnDetach()
{
((FVRFireArmAttachmentInterface)this).OnDetach();
IsOn = false;
BeamHitPoint.SetActive(IsOn);
BeamEffect.SetActive(IsOn);
BeamEffect2.SetActive(IsOn);
}
private void ToggleOn()
{
//IL_0072: 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)
IsOn = !IsOn;
BeamHitPoint.SetActive(IsOn);
BeamEffect.SetActive(IsOn);
BeamEffect2.SetActive(IsOn);
if (IsOn)
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_LaserOnClip, ((Component)this).transform.position);
}
else
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_LaserOffClip, ((Component)this).transform.position);
}
}
}
[ExecuteInEditMode]
public class NightVisionPostEffect : MonoBehaviour
{
public Material nightVisionMat;
public Material bloom;
public bool renderNightVision = true;
public bool renderBloom = true;
[Range(1f, 16f)]
public int iterations = 1;
private const int BoxDownPrefilterPass = 0;
private const int BoxDownPass = 1;
private const int BoxUpPass = 2;
private const int ApplyBloomPass = 3;
private RenderTexture[] textures = (RenderTexture[])(object)new RenderTexture[16];
public void wake()
{
((Component)this).GetComponent<Camera>().depthTextureMode = (DepthTextureMode)1;
}
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
int num = ((Texture)src).width / 2;
int num2 = ((Texture)src).height / 2;
RenderTextureFormat format = src.format;
RenderTexture val = RenderTexture.GetTemporary(num, num2, 0, format);
if (renderNightVision)
{
Graphics.Blit((Texture)(object)src, val, nightVisionMat);
}
else
{
val = src;
}
if (!renderBloom)
{
Graphics.Blit((Texture)(object)val, dest);
RenderTexture.ReleaseTemporary(val);
return;
}
RenderTexture val2 = (textures[0] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val, val2, bloom, 0);
RenderTexture val3 = val2;
for (int i = 1; i < iterations; i++)
{
num /= 2;
num2 /= 2;
if (num2 < 2)
{
break;
}
val2 = (textures[i] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val3, val2, bloom, 1);
val3 = val2;
}
for (int num3 = iterations - 2; num3 >= 0; num3--)
{
val2 = textures[num3];
textures[num3] = null;
Graphics.Blit((Texture)(object)val3, val2, bloom, 2);
RenderTexture.ReleaseTemporary(val3);
val3 = val2;
}
bloom.SetTexture("_SourceTex", (Texture)(object)val);
Graphics.Blit((Texture)(object)val3, dest, bloom, 3);
RenderTexture.ReleaseTemporary(val3);
RenderTexture.ReleaseTemporary(val);
}
}
[ExecuteInEditMode]
public class PostEffectScript : MonoBehaviour
{
public Material mat;
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
Graphics.Blit((Texture)(object)src, dest, mat);
}
}
namespace Plugin.src
{
public class AutoBolt : FVRFireArm
{
public enum ZPos
{
Forward,
Middle,
Rear
}
public enum HammerCockType
{
OnBack,
OnUp,
OnClose,
OnForward
}
public enum FireSelectorModeType
{
Safe,
Single
}
[Serializable]
public class FireSelectorMode
{
public float SelectorPosition;
public FireSelectorModeType ModeType;
public bool IsBoltLocked;
}
private bool debug;
[Header("BoltActionRifle Config")]
public FVRFireArmChamber Chamber;
public bool HasMagEjectionButton = true;
public bool HasFireSelectorButton = true;
public AutoBoltHandle BoltHandle;
public float BoltLerp;
public bool BoltMovingForward;
public AutoBoltHandle.BoltActionHandleState CurBoltHandleState;
public AutoBoltHandle.BoltActionHandleState LastBoltHandleState;
[Header("Hammer Config")]
public bool HasVisualHammer;
public Transform Hammer;
public float HammerUncocked;
public float HammerCocked;
private bool m_isHammerCocked;
public HammerCockType CockType;
private FVRFirearmMovingProxyRound m_proxy;
[Header("Round Positions Config")]
public Transform Extraction_MagazinePos;
public Transform Extraction_ChamberPos;
public Transform Extraction_Ejecting;
public Transform EjectionPos;
public float UpwardEjectionForce;
public float RightwardEjectionForce = 2f;
public float XSpinEjectionTorque = 80f;
public Transform Muzzle;
public GameObject ReloadTriggerWell;
[Header("Control Config")]
public float TriggerResetThreshold = 0.1f;
public float TriggerFiringThreshold = 0.8f;
private float m_triggerFloat;
private bool m_hasTriggerCycled;
private bool m_isMagReleasePressed;
public Transform Trigger_Display;
public float Trigger_ForwardValue;
public float Trigger_RearwardValue;
public InterpStyle TriggerInterpStyle = (InterpStyle)1;
public Transform Trigger_Display2;
public float Trigger_ForwardValue2;
public float Trigger_RearwardValue2;
public InterpStyle TriggerInterpStyle2 = (InterpStyle)1;
public Transform MagReleaseButton_Display;
public Axis MagReleaseAxis;
public InterpStyle MagReleaseInterpStyle = (InterpStyle)1;
public float MagReleasePressedValue;
public float MagReleaseUnpressedValue;
private float m_magReleaseCurValue;
private float m_magReleaseTarValue;
private Vector2 TouchPadAxes = Vector2.zero;
public Transform FireSelector_Display;
public Axis FireSelector_Axis;
public InterpStyle FireSelector_InterpStyle = (InterpStyle)1;
public FireSelectorMode[] FireSelector_Modes;
private int m_fireSelectorMode;
public bool RequiresHammerUncockedToToggleFireSelector;
public bool UsesSecondFireSelectorChange;
public Transform FireSelector_Display_Secondary;
public Axis FireSelector_Axis_Secondary;
public InterpStyle FireSelector_InterpStyle_Secondary = (InterpStyle)1;
public FireSelectorMode[] FireSelector_Modes_Secondary;
[Header("Special Features")]
public bool EjectsMagazineOnEmpty;
public bool PlaysExtraTailOnShot;
public FVRTailSoundClass ExtraTail = (FVRTailSoundClass)8;
private bool justFired;
private bool isLerping1;
private bool isLerping2;
private bool doneLerp1;
private float startTime;
private float journeyLengthBolt1;
private float journeyLengthStock1;
private float journeyLengthBolt2;
private float journeyLengthStock2;
private bool obj1Complete;
private bool obj2Complete;
private bool obj1Complete2;
private bool obj2Complete2;
private bool beginLerp2;
[Header("Lerp Speed >1")]
public float lerpSpeedboltUp = 0.5f;
public float lerpSpeedboltBack = 0.5f;
public float lerpSpeedStockF = 0.5f;
public float lerpSpeedStockR = 0.5f;
[Header("Things to Lerp")]
public GameObject boltObject;
public GameObject stockObject;
[Header("BoltPoints")]
public Transform boltPt1;
public Transform boltPt2;
public Transform boltPt3;
[Header("Stock Points")]
public Transform stockPt1;
public Transform stockPt2;
[Header("Reciprocating Barrel")]
public bool HasReciprocatingBarrel;
public G11RecoilingSystem RecoilSystem;
private bool m_isQuickboltTouching;
private Vector2 lastTPTouchPoint = Vector2.zero;
public bool IsHammerCocked => m_isHammerCocked;
public bool HasExtractedRound()
{
return m_proxy.IsFull;
}
public void Awake()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
((FVRFireArm)this).Awake();
if (base.UsesClips && (Object)(object)base.ClipTrigger != (Object)null)
{
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear)
{
if (!base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(true);
}
}
else if (base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(false);
}
}
GameObject val = new GameObject("m_proxyRound");
m_proxy = val.AddComponent<FVRFirearmMovingProxyRound>();
m_proxy.Init(((Component)this).transform);
}
public bool CanBoltMove()
{
if (FireSelector_Modes.Length >= 1)
{
return !FireSelector_Modes[m_fireSelectorMode].IsBoltLocked;
}
return true;
}
public override int GetTutorialState()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if ((int)FireSelector_Modes[m_fireSelectorMode].ModeType == 0)
{
return 4;
}
if (Chamber.IsFull)
{
if (Chamber.IsSpent)
{
return 0;
}
if ((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
{
return 6;
}
return 5;
}
if (!((Object)(object)base.Magazine != (Object)null) || base.Magazine.HasARound())
{
return 3;
}
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Forward || CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Mid)
{
return 0;
}
if ((Object)(object)base.Clip != (Object)null)
{
return 2;
}
if (!base.Magazine.IsFull())
{
return 1;
}
return 3;
}
public override void BeginInteraction(FVRViveHand hand)
{
((FVRFireArm)this).BeginInteraction(hand);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Invalid comparison between Unknown and I4
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0484: Unknown result type (might be due to invalid IL or missing references)
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Unknown result type (might be due to invalid IL or missing references)
//IL_045b: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
TouchPadAxes = hand.Input.TouchpadAxes;
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
m_triggerFloat = hand.Input.TriggerFloat;
}
if (!m_hasTriggerCycled)
{
if (m_triggerFloat >= TriggerFiringThreshold)
{
m_hasTriggerCycled = true;
}
}
else if (m_triggerFloat <= TriggerResetThreshold)
{
m_hasTriggerCycled = false;
}
m_isMagReleasePressed = false;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
if (hand.IsInStreamlinedMode)
{
if (HasFireSelectorButton && hand.Input.BYButtonDown)
{
ToggleFireSelector();
}
if (HasMagEjectionButton && hand.Input.AXButtonPressed)
{
m_isMagReleasePressed = true;
}
flag3 = true;
if ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive)
{
flag3 = false;
}
if (!CanBoltMove())
{
flag2 = false;
flag3 = false;
}
if (flag3 && !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hasTriggeredUpSinceBegin && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).IsHeld && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Input.BYButtonDown && BoltHandle.UsesQuickRelease && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward)
{
flag = true;
}
}
else
{
if (HasMagEjectionButton && hand.Input.TouchpadPressed && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && ((Vector2)(ref TouchPadAxes)).magnitude > 0.3f && Vector2.Angle(TouchPadAxes, Vector2.down) <= 45f)
{
m_isMagReleasePressed = true;
}
if ((int)GM.Options.QuickbeltOptions.BoltActionModeSetting == 0)
{
flag3 = true;
}
if ((int)GM.Options.QuickbeltOptions.BoltActionModeSetting == 1)
{
flag2 = true;
}
if (GM.Options.ControlOptions.UseGunRigMode2)
{
flag2 = true;
flag3 = true;
}
if ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive)
{
flag2 = true;
flag3 = false;
}
if (!CanBoltMove())
{
flag2 = false;
flag3 = false;
}
if (IsHammerCocked && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward && BoltHandle.HandleRot == AutoBoltHandle.BoltActionHandleRot.Down)
{
flag2 = false;
}
if (hand.Input.TouchpadDown && ((Vector2)(ref TouchPadAxes)).magnitude > 0.1f)
{
if (flag3 && Vector2.Angle(TouchPadAxes, Vector2.right) <= 45f && BoltHandle.UsesQuickRelease && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward)
{
flag = true;
}
else if (Vector2.Angle(TouchPadAxes, Vector2.left) <= 45f && HasFireSelectorButton)
{
ToggleFireSelector();
}
}
}
if (m_isMagReleasePressed)
{
ReleaseMag();
if ((Object)(object)ReloadTriggerWell != (Object)null)
{
ReloadTriggerWell.SetActive(false);
}
}
else if ((Object)(object)ReloadTriggerWell != (Object)null)
{
ReloadTriggerWell.SetActive(true);
}
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !flag && flag2)
{
if (((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && !((FVRPhysicalObject)this).IsAltHeld) || GM.Options.ControlOptions.UseGunRigMode2 || ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive))
{
if (hand.Input.TouchpadTouched)
{
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (((Vector2)(ref touchpadAxes)).magnitude > 0.1f)
{
bool isQuickboltTouching = m_isQuickboltTouching;
if (Vector2.Angle(touchpadAxes, Vector2.right + Vector2.up) < 90f && !m_isQuickboltTouching)
{
m_isQuickboltTouching = true;
}
if (m_isQuickboltTouching && isQuickboltTouching)
{
float sAngle = GetSAngle(touchpadAxes, lastTPTouchPoint, hand.CMode);
BoltHandle.DriveBolt((0f - sAngle) / 90f);
}
lastTPTouchPoint = touchpadAxes;
}
else
{
lastTPTouchPoint = Vector2.zero;
}
}
else
{
lastTPTouchPoint = Vector2.zero;
}
}
if (m_isQuickboltTouching)
{
Debug.DrawLine(((Component)BoltHandle.BoltActionHandleRoot).transform.position, ((Component)BoltHandle.BoltActionHandleRoot).transform.position + 0.1f * new Vector3(lastTPTouchPoint.x, lastTPTouchPoint.y, 0f), Color.blue);
}
}
if (hand.Input.TouchpadTouchUp)
{
m_isQuickboltTouching = false;
lastTPTouchPoint = Vector2.zero;
}
FiringSystem();
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (flag && !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
{
m_isQuickboltTouching = false;
lastTPTouchPoint = Vector2.zero;
hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
hand.HandMadeGrabReleaseSound();
hand.EndInteractionIfHeld((FVRInteractiveObject)(object)this);
((FVRInteractiveObject)this).EndInteraction(hand);
((FVRInteractiveObject)BoltHandle).BeginInteraction(hand);
hand.ForceSetInteractable((FVRInteractiveObject)(object)BoltHandle);
BoltHandle.TPInitiate();
}
}
public float GetSignedAngle(Vector2 from, Vector2 to)
{
//IL_0002: 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_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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(from.y, 0f - from.x);
Vector2 normalized = ((Vector2)(ref val)).normalized;
float num = Mathf.Sign(Vector2.Dot(from, normalized));
return Vector2.Angle(from, to) * num;
}
private float GetSAngle(Vector2 v1, Vector2 v2, ControlMode m)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_0018: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
if ((int)m == 3)
{
return (v1.y - v2.y) * 130f;
}
float num = Mathf.Sign(v1.x * v2.y - v1.y * v2.x);
return Vector2.Angle(v1, v2) * num;
}
public override void EndInteraction(FVRViveHand hand)
{
//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)
m_triggerFloat = 0f;
m_hasTriggerCycled = false;
m_isMagReleasePressed = false;
m_isQuickboltTouching = false;
lastTPTouchPoint = Vector2.zero;
((FVRFireArm)this).EndInteraction(hand);
}
public void SetHasTriggeredUp()
{
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = true;
}
public void CockHammer()
{
if (!m_isHammerCocked)
{
m_isHammerCocked = true;
if (HasVisualHammer)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerCocked, (InterpStyle)0, (Axis)2);
}
}
}
public void DropHammer()
{
if (IsHammerCocked)
{
m_isHammerCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
Fire();
if (HasVisualHammer)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerUncocked, (InterpStyle)0, (Axis)2);
}
}
}
protected virtual void ToggleFireSelector()
{
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
if ((RequiresHammerUncockedToToggleFireSelector && IsHammerCocked) || ((FVRInteractiveObject)BoltHandle).IsHeld || CurBoltHandleState != 0 || BoltHandle.HandleRot != AutoBoltHandle.BoltActionHandleRot.Down || FireSelector_Modes.Length <= 1)
{
return;
}
m_fireSelectorMode++;
if (m_fireSelectorMode >= FireSelector_Modes.Length)
{
m_fireSelectorMode -= FireSelector_Modes.Length;
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
if ((Object)(object)FireSelector_Display != (Object)null)
{
((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display, FireSelector_Modes[m_fireSelectorMode].SelectorPosition, FireSelector_InterpStyle, FireSelector_Axis);
if (UsesSecondFireSelectorChange)
{
((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display_Secondary, FireSelector_Modes_Secondary[m_fireSelectorMode].SelectorPosition, FireSelector_InterpStyle_Secondary, FireSelector_Axis_Secondary);
}
}
}
public void ReleaseMag()
{
if ((Object)(object)base.Magazine != (Object)null)
{
m_magReleaseCurValue = MagReleasePressedValue;
((FVRFireArm)this).EjectMag(false);
}
}
public FireSelectorMode GetFiringMode()
{
return FireSelector_Modes[m_fireSelectorMode];
}
protected virtual void FiringSystem()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if ((int)FireSelector_Modes[m_fireSelectorMode].ModeType != 0 && !((FVRPhysicalObject)this).IsAltHeld && BoltHandle.HandleState == AutoBoltHandle.BoltActionHandleState.Forward && BoltHandle.HandleRot != 0 && m_hasTriggerCycled)
{
DropHammer();
}
}
public bool Fire()
{
//IL_0069: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: 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)
_ = FireSelector_Modes[m_fireSelectorMode];
if (!Chamber.Fire())
{
return false;
}
((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
((FVRFireArm)this).FireMuzzleSmoke();
bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
bool flag2 = ((FVRFireArm)this).IsForegripStabilized();
bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
FVRSoundEnvironment currentSoundEnvironment = GM.CurrentPlayerBody.GetCurrentSoundEnvironment();
((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), currentSoundEnvironment, 1f);
justFired = true;
if (PlaysExtraTailOnShot)
{
AudioEvent tailSet = SM.GetTailSet(ExtraTail, currentSoundEnvironment);
base.m_pool_tail.PlayClipVolumePitchOverride(tailSet, ((Component)this).transform.position, tailSet.VolumeRange * 1f, base.AudioClipSet.TailPitchMod_Main * tailSet.PitchRange.x, (AudioMixerGroup)null);
}
if (HasReciprocatingBarrel)
{
RecoilSystem.Recoil(false);
}
Chamber.IsAccessible = true;
return true;
}
public void Update()
{
//IL_000b: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0468: Unknown result type (might be due to invalid IL or missing references)
//IL_049f: Unknown result type (might be due to invalid IL or missing references)
//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_057d: Unknown result type (might be due to invalid IL or missing references)
//IL_059d: Unknown result type (might be due to invalid IL or missing references)
if (BoltHandle.BoltActionHandleRoot.localPosition.z <= Vector3.Lerp(BoltHandle.Point_Forward.localPosition, BoltHandle.Point_Rearward.localPosition, 0.5f).z && BoltHandle.BoltActionHandle.localEulerAngles.z < BoltHandle.UnlockThreshold && debug)
{
Debug.Log((object)"This is working?");
}
if (!justFired)
{
return;
}
if (!isLerping1 && !doneLerp1)
{
obj1Complete2 = false;
obj2Complete2 = false;
if (debug)
{
Debug.Log((object)"Begin Lerp 1");
}
startTime = Time.time;
journeyLengthBolt1 = Vector3.Distance(boltPt1.localPosition, boltPt2.localPosition);
if (debug)
{
Debug.Log((object)("journeylengthbolt" + journeyLengthBolt1));
}
journeyLengthStock1 = Vector3.Distance(stockPt1.localPosition, stockPt2.localPosition);
isLerping1 = true;
stockObject.transform.localPosition = ((Component)stockPt1).transform.localPosition;
boltObject.transform.localPosition = ((Component)boltPt1).transform.localPosition;
}
if (isLerping1)
{
float num = (Time.time - startTime) * lerpSpeedboltUp;
float num2 = (Time.time - startTime) * lerpSpeedStockF;
float num3 = num / journeyLengthBolt1;
float num4 = num2 / journeyLengthStock1;
if (debug)
{
Debug.Log((object)"these values dont help have a nice egg instead ()");
}
if (!obj1Complete)
{
if (debug)
{
Debug.Log((object)"lerping bolt1");
}
boltObject.transform.localPosition = Vector3.Lerp(boltPt1.localPosition, boltPt2.localPosition, num3);
BoltHandle.ManipulateBoltUsingPosition(boltObject.transform.position, touchpadDrive: true);
}
if (!obj2Complete)
{
if (debug)
{
Debug.Log((object)"Lerping Stock 1");
}
stockObject.transform.localPosition = Vector3.Lerp(stockPt1.localPosition, stockPt2.localPosition, num4);
}
if (num3 >= 1f)
{
obj1Complete = true;
if (debug)
{
Debug.Log((object)"Bolts done pt1");
}
}
if (num4 >= 1f)
{
obj2Complete = true;
if (debug)
{
Debug.Log((object)"Stocks done pt1");
}
}
if (obj1Complete && obj2Complete)
{
if (debug)
{
Debug.Log((object)"LERP1 IS DONE IT SHOULDNT BE BEING CALLED ANYMORE");
}
isLerping1 = false;
beginLerp2 = true;
doneLerp1 = true;
}
}
if (!isLerping2 && beginLerp2)
{
if (debug)
{
Debug.Log((object)"Begin Lerp 2");
}
startTime = Time.time;
journeyLengthBolt2 = Vector3.Distance(boltPt2.localPosition, boltPt3.localPosition);
journeyLengthStock2 = Vector3.Distance(stockPt2.localPosition, stockPt1.localPosition);
boltObject.transform.localPosition = ((Component)boltPt2).transform.localPosition;
stockObject.transform.localPosition = ((Component)stockPt2).transform.localPosition;
isLerping2 = true;
beginLerp2 = false;
obj1Complete = false;
obj2Complete = false;
}
if (!isLerping2)
{
return;
}
float num5 = (Time.time - startTime) * lerpSpeedboltBack;
float num6 = (Time.time - startTime) * lerpSpeedStockR;
float num7 = num5 / journeyLengthBolt2;
float num8 = num6 / journeyLengthStock2;
if (debug)
{
Debug.Log((object)"Lerp: the flamethrower! The kids love this one");
}
if (!obj1Complete2)
{
if (debug)
{
Debug.Log((object)"lerping bolt2");
}
boltObject.transform.localPosition = Vector3.Lerp(boltPt2.localPosition, boltPt3.localPosition, num7);
BoltHandle.ManipulateBoltUsingPosition(boltObject.transform.position, touchpadDrive: true);
}
if (!obj2Complete2)
{
if (debug)
{
Debug.Log((object)"Lerping Stock 2");
}
stockObject.transform.localPosition = Vector3.Lerp(stockPt2.localPosition, stockPt1.localPosition, num8);
}
if (num7 >= 1f)
{
obj1Complete2 = true;
if (debug)
{
Debug.Log((object)"Bolts done pt2");
}
boltObject.transform.localPosition = ((Component)boltPt3).transform.localPosition;
UpdateBolt(AutoBoltHandle.BoltActionHandleState.Rear, 1f);
Chamber.IsAccessible = true;
}
if (num8 >= 1f)
{
stockObject.transform.localPosition = ((Component)stockPt1).transform.localPosition;
obj2Complete2 = true;
if (debug)
{
Debug.Log((object)"Stocks done pt2");
}
}
if (obj1Complete2 && obj2Complete2)
{
boltObject.transform.localPosition = ((Component)boltPt3).transform.localPosition;
stockObject.transform.localPosition = ((Component)stockPt1).transform.localPosition;
if (debug)
{
Debug.Log((object)"All done the autobolt shit");
}
BoltHandle.DriveBolt(1f);
isLerping2 = false;
justFired = false;
doneLerp1 = false;
}
}
public void FVRFixedUpdate()
{
((FVRFireArm)this).FVRFixedUpdate();
UpdateComponentDisplay();
}
private void UpdateComponentDisplay()
{
//IL_000f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Invalid comparison between Unknown and I4
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Invalid comparison between Unknown and I4
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Invalid comparison between Unknown and I4
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Trigger_Display != (Object)null)
{
if ((int)TriggerInterpStyle == 0)
{
Trigger_Display.localPosition = new Vector3(0f, 0f, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat));
}
else if ((int)TriggerInterpStyle == 1)
{
Trigger_Display.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), 0f, 0f);
}
}
if ((Object)(object)Trigger_Display2 != (Object)null)
{
if ((int)TriggerInterpStyle == 0)
{
Trigger_Display2.localPosition = new Vector3(0f, 0f, Mathf.Lerp(Trigger_ForwardValue2, Trigger_RearwardValue2, m_triggerFloat));
}
else if ((int)TriggerInterpStyle == 1)
{
Trigger_Display2.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_ForwardValue2, Trigger_RearwardValue2, m_triggerFloat), 0f, 0f);
}
}
if ((Object)(object)MagReleaseButton_Display != (Object)null)
{
Vector3 zero = Vector3.zero;
if (m_isMagReleasePressed)
{
m_magReleaseTarValue = MagReleasePressedValue;
}
else
{
m_magReleaseTarValue = MagReleaseUnpressedValue;
}
m_magReleaseCurValue = Mathf.Lerp(m_magReleaseCurValue, m_magReleaseTarValue, Time.deltaTime * 4f);
float magReleaseCurValue = m_magReleaseCurValue;
Axis magReleaseAxis = MagReleaseAxis;
if ((int)magReleaseAxis != 0)
{
if ((int)magReleaseAxis != 1)
{
if ((int)magReleaseAxis == 2)
{
zero.z = magReleaseCurValue;
}
}
else
{
zero.y = magReleaseCurValue;
}
}
else
{
zero.x = magReleaseCurValue;
}
InterpStyle magReleaseInterpStyle = MagReleaseInterpStyle;
if ((int)magReleaseInterpStyle != 0)
{
if ((int)magReleaseInterpStyle == 1)
{
MagReleaseButton_Display.localEulerAngles = zero;
}
}
else
{
MagReleaseButton_Display.localPosition = zero;
}
}
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Forward)
{
base.IsBreachOpenForGasOut = false;
}
else
{
base.IsBreachOpenForGasOut = true;
}
}
public void UpdateBolt(AutoBoltHandle.BoltActionHandleState State, float lerp)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Invalid comparison between Unknown and I4
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: 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)
CurBoltHandleState = State;
BoltLerp = lerp;
if (CurBoltHandleState != 0 && !m_proxy.IsFull && !Chamber.IsFull)
{
Chamber.IsAccessible = true;
}
else
{
Chamber.IsAccessible = false;
}
if (base.UsesClips && (Object)(object)base.ClipTrigger != (Object)null)
{
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear)
{
if (!base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(true);
}
}
else if (base.ClipTrigger.activeSelf)
{
base.ClipTrigger.SetActive(false);
}
}
if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear && LastBoltHandleState != AutoBoltHandle.BoltActionHandleState.Rear)
{
if ((int)CockType == 0)
{
CockHammer();
}
if (Chamber.IsFull)
{
if (debug)
{
Debug.Log((object)"This should only be happing if it was manually cycled");
}
Chamber.EjectRound(EjectionPos.position, ((Component)this).transform.right * RightwardEjectionForce + ((Component)this).transform.up * UpwardEjectionForce, ((Component)this).transform.right * XSpinEjectionTorque, false);
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f);
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)41, 1f);
}
BoltMovingForward = true;
}
else if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Forward && LastBoltHandleState != 0)
{
if ((int)CockType == 3)
{
CockHammer();
}
if (m_proxy.IsFull && !Chamber.IsFull)
{
Chamber.SetRound(m_proxy.Round, false);
m_proxy.ClearProxy();
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f);
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)40, 1f);
}
BoltMovingForward = false;
}
else if (CurBoltHandleState == AutoBoltHandle.BoltActionHandleState.Mid && LastBoltHandleState == AutoBoltHandle.BoltActionHandleState.Rear && (Object)(object)base.Magazine != (Object)null)
{
if (!m_proxy.IsFull && base.Magazine.HasARound() && !Chamber.IsFull)
{
GameObject fromPrefabReference = base.Magazine.RemoveRound(false);
m_proxy.SetFromPrefabReference(fromPrefabReference);
}
if (EjectsMagazineOnEmpty && !base.Magazine.HasARound())
{
((FVRFireArm)this).EjectMag(false);
}
}
if (m_proxy.IsFull)
{
m_proxy.ProxyRound.position = Vector3.Lerp(Extraction_ChamberPos.position, Extraction_MagazinePos.position, BoltLerp);
m_proxy.ProxyRound.rotation = Quaternion.Slerp(Extraction_ChamberPos.rotation, Extraction_MagazinePos.rotation, BoltLerp);
}
if (Chamber.IsFull)
{
Chamber.ProxyRound.position = Vector3.Lerp(Extraction_ChamberPos.position, Extraction_Ejecting.position, BoltLerp);
Chamber.ProxyRound.rotation = Quaternion.Slerp(Extraction_ChamberPos.rotation, Extraction_Ejecting.rotation, BoltLerp);
}
LastBoltHandleState = CurBoltHandleState;
}
public override List<FireArmRoundClass> GetChamberRoundList()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (Chamber.IsFull && !Chamber.IsSpent)
{
return new List<FireArmRoundClass> { Chamber.GetRound().RoundClass };
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count > 0)
{
Chamber.Autochamber(rounds[0]);
}
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
//IL_00a8: 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)
string empty = string.Empty;
_ = string.Empty;
empty = "HammerState";
if (f.ContainsKey(empty))
{
if (f[empty] == "Cocked")
{
m_isHammerCocked = true;
}
if (HasVisualHammer)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerCocked, (InterpStyle)0, (Axis)2);
}
}
if (FireSelector_Modes.Length > 1)
{
empty = "FireSelectorState";
if (f.ContainsKey(empty))
{
int.TryParse(f[empty], out m_fireSelectorMode);
}
if ((Object)(object)FireSelector_Display != (Object)null)
{
FireSelectorMode val = FireSelector_Modes[m_fireSelectorMode];
((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display, val.SelectorPosition, FireSelector_InterpStyle, FireSelector_Axis);
}
}
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
string key = "HammerState";
string value = "Uncocked";
if (m_isHammerCocked)
{
value = "Cocked";
}
dictionary.Add(key, value);
if (FireSelector_Modes.Length > 1)
{
key = "FireSelectorState";
value = m_fireSelectorMode.ToString();
dictionary.Add(key, value);
}
return dictionary;
}
}
public class AutoBoltHandle : FVRInteractiveObject
{
public enum BoltActionHandleState
{
Forward,
Mid,
Rear
}
public enum BoltActionHandleRot
{
Up,
Mid,
Down
}
public AutoBolt Rifle;
public bool UsesQuickRelease;
public Transform BoltActionHandleRoot;
public Transform BoltActionHandle;
public float BaseRotOffset;
private float rotAngle;
public float MinRot;
public float MaxRot;
public float UnlockThreshold = 70f;
public Transform Point_Forward;
public Transform Point_Rearward;
public Vector3 HandPosOffset = new Vector3(0f, 0f, 0f);
private bool m_wasTPInitiated;
public bool UsesExtraRotationPiece;
public Transform ExtraRotationPiece;
public BoltActionHandleState HandleState;
public BoltActionHandleState LastHandleState;
public BoltActionHandleRot HandleRot = BoltActionHandleRot.Down;
public BoltActionHandleRot LastHandleRot = BoltActionHandleRot.Down;
private Vector3 m_localHandPos_BoltDown;
private Vector3 m_localHandPos_BoltUp;
private Vector3 m_localHandPos_BoltBack;
private float fakeBoltDrive;
public void Awake()
{
((FVRInteractiveObject)this).Awake();
CalculateHandPoses();
}
public void TPInitiate()
{
m_wasTPInitiated = true;
}
public override void EndInteraction(FVRViveHand hand)
{
m_wasTPInitiated = false;
((FVRInteractiveObject)this).EndInteraction(hand);
}
public override bool IsInteractable()
{
if (Rifle.CanBoltMove())
{
return ((FVRInteractiveObject)this).IsInteractable();
}
return false;
}
private void CalculateHandPoses()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_003c: 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_0065: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00df: 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)
m_localHandPos_BoltDown = ((Component)Rifle).transform.InverseTransformPoint(((Component)this).transform.position);
Vector3 val = ((Component)this).transform.position - BoltActionHandleRoot.position;
val = Quaternion.AngleAxis(Mathf.Abs(MaxRot - MinRot) + 10f, BoltActionHandleRoot.forward) * val;
val += BoltActionHandleRoot.position;
m_localHandPos_BoltUp = ((Component)Rifle).transform.InverseTransformPoint(val);
Vector3 val2 = val + -BoltActionHandleRoot.forward * (0.005f + Vector3.Distance(Point_Forward.position, Point_Rearward.position));
m_localHandPos_BoltBack = ((Component)Rifle).transform.InverseTransformPoint(val2);
}
public void FVRUpdate()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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)
((FVRInteractiveObject)this).FVRUpdate();
Debug.DrawLine(((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltDown), ((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltUp), Color.red);
Debug.DrawLine(((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltUp), ((Component)Rifle).transform.TransformPoint(m_localHandPos_BoltBack), Color.blue);
}
public void DriveBolt(float amount)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((FVRFireArm)Rifle).Clip != (Object)null)
{
((FVRFireArm)Rifle).EjectClip();
return;
}
fakeBoltDrive += amount;
fakeBoltDrive = Mathf.Clamp(fakeBoltDrive, 0f, 1f);
Vector3 val = ((!(fakeBoltDrive < 0.5f)) ? Vector3.Lerp(m_localHandPos_BoltUp, m_localHandPos_BoltBack, (fakeBoltDrive - 0.5f) * 2f) : Vector3.Slerp(m_localHandPos_BoltDown, m_localHandPos_BoltUp, fakeBoltDrive * 2f));
val = ((Component)Rifle).transform.TransformPoint(val);
ManipulateBoltUsingPosition(val, touchpadDrive: true);
float num = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, BoltActionHandleRoot.localPosition.z);
if (num < 0.05f)
{
HandleState = BoltActionHandleState.Forward;
}
else if (num > 0.95f)
{
HandleState = BoltActionHandleState.Rear;
}
else
{
HandleState = BoltActionHandleState.Mid;
}
Rifle.UpdateBolt(HandleState, num);
LastHandleState = HandleState;
}
public bool ManipulateBoltUsingPosition(Vector3 pos, bool touchpadDrive)
{
//IL_000d: 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_001e: 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)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_005c: 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)
//IL_0067: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Invalid comparison between Unknown and I4
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Invalid comparison between Unknown and I4
bool result = false;
if (HandleState == BoltActionHandleState.Forward)
{
Vector3 val = pos - BoltActionHandle.position;
Vector3 val2 = Vector3.ProjectOnPlane(val, ((Component)BoltActionHandleRoot).transform.forward);
val = ((Vector3)(ref val2)).normalized;
Vector3 right = ((Component)BoltActionHandleRoot).transform.right;
rotAngle = Mathf.Atan2(Vector3.Dot(BoltActionHandleRoot.forward, Vector3.Cross(right, val)), Vector3.Dot(right, val)) * 57.29578f;
rotAngle += BaseRotOffset;
rotAngle = Mathf.Clamp(rotAngle, MinRot, MaxRot);
BoltActionHandle.localEulerAngles = new Vector3(0f, 0f, rotAngle);
if (UsesExtraRotationPiece)
{
ExtraRotationPiece.localEulerAngles = new Vector3(0f, 0f, rotAngle);
}
if (rotAngle >= UnlockThreshold)
{
HandleRot = BoltActionHandleRot.Up;
}
else if (Mathf.Abs(rotAngle - MinRot) < 2f)
{
HandleRot = BoltActionHandleRot.Down;
}
else
{
HandleRot = BoltActionHandleRot.Mid;
}
if (HandleRot == BoltActionHandleRot.Up && LastHandleRot != 0)
{
((FVRFireArm)Rifle).PlayAudioEvent((FirearmAudioEventType)12, 1f);
if ((int)Rifle.CockType == 1)
{
Rifle.CockHammer();
}
}
else if (HandleRot == BoltActionHandleRot.Down && LastHandleRot != BoltActionHandleRot.Down)
{
((FVRFireArm)Rifle).PlayAudioEvent((FirearmAudioEventType)13, 1f);
if ((int)Rifle.CockType == 2)
{
Rifle.CockHammer();
}
result = true;
}
LastHandleRot = HandleRot;
}
if (rotAngle >= UnlockThreshold)
{
Vector3 val3 = HandPosOffset.x * BoltActionHandleRoot.right + HandPosOffset.y * BoltActionHandleRoot.up + HandPosOffset.z * BoltActionHandleRoot.forward;
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Forward.position, Point_Rearward.position, pos - val3);
BoltActionHandleRoot.position = closestValidPoint;
}
return result;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0026: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((FVRFireArm)Rifle).Clip != (Object)null)
{
((FVRFireArm)Rifle).EjectClip();
return;
}
bool num = ManipulateBoltUsingPosition(((HandInput)(ref hand.Input)).Pos, touchpadDrive: false);
float num2 = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, BoltActionHandleRoot.localPosition.z);
if (num2 < 0.05f)
{
HandleState = BoltActionHandleState.Forward;
}
else if (num2 > 0.95f)
{
HandleState = BoltActionHandleState.Rear;
}
else
{
HandleState = BoltActionHandleState.Mid;
}
if ((HandleState != 0 || LastHandleState == BoltActionHandleState.Forward) && HandleState == BoltActionHandleState.Rear)
{
_ = LastHandleState;
_ = 2;
}
Rifle.UpdateBolt(HandleState, num2);
LastHandleState = HandleState;
((FVRInteractiveObject)this).UpdateInteraction(hand);
if (num && UsesQuickRelease && m_wasTPInitiated && (((FVRPhysicalObject)Rifle).IsAltHeld || !((FVRInteractiveObject)Rifle).IsHeld))
{
hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
((FVRInteractiveObject)this).EndInteraction(hand);
((FVRInteractiveObject)Rifle).BeginInteraction(hand);
hand.ForceSetInteractable((FVRInteractiveObject)(object)Rifle);
if (!hand.Input.TriggerPressed)
{
Rifle.SetHasTriggeredUp();
}
}
}
}
public class bangerSwitchInterp
{
public enum Axis
{
X,
Y,
Z
}
private bool m_isLargeAperture = true;
public Transform Flipsight;
public float m_flipsightStartRotX;
public float m_flipsightEndRotX = -90f;
private float m_flipsightCurRotX;
public Axis RotAxis;
private float m_curFlipLerp;
private float m_tarFlipLerp;
private float m_lastFlipLerp;
public BangerSwitch switchToObserve;
}
internal class betterOverheat : MonoBehaviour
{
[GradientHDR]
public Gradient colorGrad;
public Renderer Rend;
public Handgun Hangun;
public AudioEvent AudEvent_Overheat;
public AudioEvent AudEvent_AllSet;
public ParticleSystem PSystem_Overheat;
public ParticleSystem PSystem_Overheat2;
private float m_heat;
public float m_timeSinceLastShot = 1f;
private bool m_isOverheating;
private float m_coolTime = 3.5f;
public GameObject enableWhenHot;
[Header("Heat Per Shot (max 1)")]
public float heatPerShot = 0.1f;
[Header("Cooldown time")]
public float coolDown = 3.5f;
[Header("To Lerp or not to Lerp")]
public bool HasLerp;
[Header("Open Position")]
public Transform pointInterp1;
[Header("Closed Position")]
public Transform pointInterp2;
[Header("Lerp Speed >1")]
public float lerpSpeed = 0.5f;
[Header("Thing to Lerp")]
public GameObject lerpObject;
private bool isLerping;
private float startTime;
private float journeyLength;
private bool isOpen;
private void OnShotFired(FVRFireArm firearm)
{
if ((Object)(object)firearm == (Object)(object)Hangun)
{
AddHeat();
PSystem_Overheat.Emit(5);
PSystem_Overheat2.Emit(5);
}
}
private void AddHeat()
{
m_heat += heatPerShot;
m_timeSinceLastShot = 0f;
if (m_heat >= 1f && !m_isOverheating)
{
Overheat();
}
m_heat = Mathf.Clamp(m_heat, 0f, 1f);
}
private void Overheat()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
enableWhenHot.SetActive(true);
m_isOverheating = true;
((FVRFireArm)Hangun).Magazine.ForceEmpty();
m_coolTime = coolDown;
((FVRFireArm)Hangun).PlayAudioAsHandling(AudEvent_Overheat, ((Component)this).transform.position).FollowThisTransform(((Component)this).transform);
}
private void Reset()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
enableWhenHot.SetActive(false);
m_isOverheating = false;
((FVRFireArm)Hangun).Magazine.ForceFull();
Hangun.DropSlideRelease();
m_heat = 0f;
((FVRFireArm)Hangun).PlayAudioAsHandling(AudEvent_AllSet, ((Component)this).transform.position).FollowThisTransform(((Component)this).transform);
}
private void Update()
{
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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)
Hangun.IsSlideLockExternalHeldDown = false;
Vector3 localPosition;
if (!m_isOverheating)
{
if (HasLerp)
{
if (!isLerping)
{
Debug.Log((object)"roatethinggoooo");
startTime = Time.time;
journeyLength = Vector3.Distance(pointInterp1.localPosition, pointInterp2.localPosition);
isLerping = true;
}
if (isLerping && isOpen)
{
float num = (Time.time - startTime) * lerpSpeed;
float num2 = num / journeyLength;
string[] obj = new string[6]
{
"fraction of journety",
num2.ToString(),
"dist covered",
num.ToString(),
"objloc",
null
};
localPosition = lerpObject.transform.localPosition;
obj[5] = ((object)(Vector3)(ref localPosition)).ToString();
Debug.Log((object)string.Concat(obj));
lerpObject.transform.localPosition = Vector3.Lerp(pointInterp1.localPosition, pointInterp2.localPosition, num2);
if (num2 >= 1f)
{
isLerping = false;
isOpen = false;
}
}
}
if (m_timeSinceLastShot < 0.3f)
{
m_timeSinceLastShot += Time.deltaTime;
}
else if (m_heat > 0f)
{
m_heat -= Time.deltaTime;
}
}
else
{
if (HasLerp)
{
if (!isLerping)
{
Debug.Log((object)"roatethinggoooo");
startTime = Time.time;
journeyLength = Vector3.Distance(pointInterp2.localPosition, pointInterp1.localPosition);
isLerping = true;
}
if (isLerping && !isOpen)
{
float num3 = (Time.time - startTime) * lerpSpeed;
float num4 = num3 / journeyLength;
string[] obj2 = new string[6]
{
"fraction of journety",
num4.ToString(),
"dist covered",
num3.ToString(),
"objloc",
null
};
localPosition = lerpObject.transform.localPosition;
obj2[5] = ((object)(Vector3)(ref localPosition)).ToString();
Debug.Log((object)string.Concat(obj2));
lerpObject.transform.localPosition = Vector3.Lerp(pointInterp2.localPosition, pointInterp1.localPosition, num4);
if (num4 >= 1f)
{
isLerping = false;
isOpen = true;
}
}
}
PSystem_Overheat.Emit(1);
if (m_coolTime > 0f)
{
m_coolTime -= Time.deltaTime;
}
else
{
Reset();
}
}
float num5 = Mathf.Lerp(0.5f, -0.5f, m_heat);
Rend.material.SetColor("_EmissionColor", colorGrad.Evaluate(m_heat));
Rend.material.SetTextureOffset("_IncandescenceMap", new Vector2(0f, num5));
}
private void Start()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
}
private void OnDisable()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnShotFired);
}
}
[RequireComponent(typeof(PMat))]
public class BreakableArmour : MonoBehaviour, IFVRDamageable
{
public MatDef defaultMatdef;
public MatDef brokenMatdef;
public float durability;
public AudioEvent shatter;
public bool isDebug;
private bool playedaudio;
private float damageTaken;
public void Start()
{
((Component)this).GetComponent<PMat>().MatDef = defaultMatdef;
}
public void Update()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (damageTaken >= durability && !playedaudio)
{
((Component)this).GetComponent<PMat>().MatDef = brokenMatdef;
SM.PlayGenericSound(shatter, ((Component)this).transform.position);
playedaudio = true;
}
}
public void Damage(Damage d)
{
damageTaken = damageTaken + d.Dam_TotalKinetic + d.Dam_TotalEnergetic;
if (isDebug)
{
Debug.Log((object)("Damange taken: " + d.Dam_TotalKinetic));
Debug.Log((object)("Total Damange taken: " + damageTaken));
}
}
}
public class EnergySword : FVRMeleeWeapon
{
private Material bladeMat;
public GameObject bladePhys;
public AudioEvent igniteSound;
public AudioEvent retractSound;
[Header("Lerp Speed >1")]
public float lerpSpeed = 0.5f;
public bool isdebug;
public float lungeStrength = 12f;
public float cooldown = 1f;
private bool isLit;
private bool isLerping;
private float startTime;
private float journeyLength;
private bool stable = true;
private bool hasLunged;
private float cooldownTime;
private float lastHealth;
private bool firstRun;
private void Start()
{
//IL_0006: 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_001e: Unknown result type (might be due to invalid IL or missing references)
Color color = bladeMat.color;
color.a = 0f;
bladeMat.color = color;
bladePhys.SetActive(false);
lastHealth = GM.CurrentPlayerBody.GetPlayerHealth();
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_006d: 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)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
if (!isLit)
{
if (isdebug)
{
Debug.Log((object)"turn on bitch");
}
((FVRPhysicalObject)this).Size = (FVRPhysicalObjectSize)5;
isLit = true;
stable = false;
}
else
{
if (isdebug)
{
Debug.Log((object)"turn off bitch");
}
((FVRPhysicalObject)this).Size = (FVRPhysicalObjectSize)1;
isLit = false;
stable = false;
}
}
else if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && isLit)
{
if (isdebug)
{
Debug.Log((object)"YEET");
}
Lunge();
}
}
private void Update()
{
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: 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_0082: 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_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
if (!stable)
{
if (isdebug)
{
Debug.Log((object)"now unstable");
}
if (isdebug)
{
Debug.Log((object)("islerping" + isLerping));
}
if (isdebug)
{
Debug.Log((object)("islit" + isLit));
}
if (isLit)
{
if (!isLerping)
{
Color color = bladeMat.color;
color.a = 0f;
bladeMat.color = color;
if (isdebug)
{
Debug.Log((object)"roatethinggoooo");
}
startTime = Time.time;
journeyLength = 1f - bladeMat.color.a;
isLerping = true;
if (retractSound != null)
{
SM.PlayGenericSound(igniteSound, ((Component)this).transform.position);
}
}
if (isLerping)
{
float num = (Time.time - startTime) * lerpSpeed / journeyLength;
Color color2 = bladeMat.color;
color2.a = Mathf.Lerp(bladeMat.color.a, 1f, num);
bladeMat.color = color2;
if ((double)num >= 0.5)
{
bladePhys.SetActive(true);
}
if (num >= 1f)
{
isLerping = false;
isLit = true;
stable = true;
}
}
}
else
{
if (!isLerping)
{
Color color3 = bladeMat.color;
color3.a = 1f;
bladeMat.color = color3;
if (isdebug)
{
Debug.Log((object)"roatethinggoooo");
}
startTime = Time.time;
journeyLength = bladeMat.color.a;
isLerping = true;
if (retractSound != null)
{
SM.PlayGenericSound(retractSound, ((Component)this).transform.position);
}
}
if (isLerping)
{
float num2 = (Time.time - startTime) * lerpSpeed / journeyLength;
Color color4 = bladeMat.color;
color4.a = Mathf.Lerp(bladeMat.color.a, 0f, num2);
bladeMat.color = color4;
if ((double)num2 >= 0.5)
{
bladePhys.SetActive(false);
}
if (num2 >= 1f)
{
isLerping = false;
isLit = false;
stable = true;
}
}
}
}
if (hasLunged)
{
cooldownTime += Time.deltaTime;
if (isdebug)
{
Debug.Log((object)("Cooldown is " + cooldownTime));
}
if (cooldownTime >= cooldown)
{
hasLunged = false;
cooldownTime = 0f;
}
}
}
private void Lunge()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if (!hasLunged)
{
GM.CurrentMovementManager.Blast(GM.CurrentPlayerBody.Head.forward, lungeStrength, true);
hasLunged = true;
}
}
}
public class ForeGripMagRelease : MonoBehaviour
{
public enum Axis
{
X,
Y,
Z
}
public ClosedBoltWeapon gun;
public FVRAlternateGrip grip;
public Transform button;
public Axis axis;
public float pressed;
public float unpressed;
public float InteractDelay2 = 0.75f;
public GameObject InteractionCollider;
private FVRViveHand m_hand;
private bool isInteractHidden;
public void Awake()
{
Hook();
}
public void Update()
{
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Invalid comparison between Unknown and I4
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)m_hand != (Object)null && (Object)(object)m_hand.OtherHand.m_currentInteractable == (Object)(object)gun && (Object)(object)m_hand.CurrentInteractable == (Object)null)
{
m_hand = null;
}
else if ((Object)(object)m_hand != (Object)null && (Object)(object)m_hand.OtherHand.m_currentInteractable != (Object)(object)gun && (Object)(object)m_hand.CurrentInteractable == (Object)null)
{
m_hand = null;
}
if (!((Object)(object)m_hand != (Object)null) || !((Object)(object)grip.GetLastGrabbedGrip() == (Object)null))
{
return;
}
if (!isInteractHidden)
{
InteractionCollider.SetActive(false);
isInteractHidden = true;
}
if (m_hand.IsInStreamlinedMode)
{
if (m_hand.Input.AXButtonDown)
{
((FVRFireArm)gun).EjectMag(false);
}
if (m_hand.Input.AXButtonPressed)
{
Buttonpressed(ispressed: true);
}
else
{
Buttonpressed(ispressed: false);
}
return;
}
if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.down) < 45f)
{
((FVRFireArm)gun).EjectMag(false);
}
if (m_hand.Input.TouchpadPressed && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.down) < 45f)
{
Buttonpressed(ispressed: true);
}
else
{
Buttonpressed(ispressed: false);
}
if (gun.Bolt.IsBoltLocked())
{
if (m_hand.Input.TouchpadPressed && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.right) < 45f)
{
gun.Bolt.ReleaseBolt();
}
}
else if ((int)gun.Bolt.CurPos >= 2 && m_hand.Input.TouchpadPressed && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.up) < 45f)
{
gun.Bolt.LockBolt();
}
}
public void Hook()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
Debug.Log((object)"Hooking Foregrip Attachment");
FVRAlternateGrip.UpdateInteraction += new hook_UpdateInteraction(FVRAlternateGrip_UpdateInteraction);
FVRAlternateGrip.EndInteraction += new hook_EndInteraction(FVRAlternateGrip_EndInteraction);
}
private void FVRAlternateGrip_EndInteraction(orig_EndInteraction orig, FVRAlternateGrip self, FVRViveHand hand)
{
if ((Object)(object)self == (Object)(object)grip)
{
((MonoBehaviour)this).StartCoroutine(ReactivateButton());
}
orig.Invoke(self, hand);
}
private void FVRAlternateGrip_UpdateInteraction(orig_UpdateInteraction orig, FVRAlternateGrip self, FVRViveHand hand)
{
if ((Object)(object)self == (Object)(object)grip)
{
m_hand = hand;
}
orig.Invoke(self, hand);
}
private IEnumerator ReactivateButton()
{
yield return (object)new WaitForSeconds(InteractDelay2);
InteractionCollider.SetActive(true);
isInteractHidden = false;
}
private void Buttonpressed(bool ispressed)
{
//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_0047: Unknown result type (might be due to invalid IL or missing references)
Vector3 localPosition = ((Component)button).transform.localPosition;
if (ispressed)
{
((Vector3)(ref localPosition))[(int)axis] = pressed;
}
else
{
((Vector3)(ref localPosition))[(int)axis] = unpressed;
}
((Component)button).transform.localPosition = localPosition;
}
}
public class proxGrenade : FVRPhysicalObject
{
public bool DoesUseHandedPose = true;
private bool m_isInRightHandMode = true;
private List<proxGrenadeRing> m_rings = new List<proxGrenadeRing>();
[Header("Payload")]
public List<GameObject> SpawnOnSplode;
public SmokeSolidEmitter SmokeEmitter;
[Header("Audio")]
public AudioEvent AudEvent_Pinpull;
public AudioEvent AudEvent_Armed;
public ParticleSystem FusePSystem;
public Transform FuseCylinder;
private int m_fuseCylinderSetting = 2;
private bool m_isPinPulled;
private bool m_hasSploded;
public int IFF;
private bool is_Armed;
private bool is_Set;
private bool is_Stuck;
private FixedJoint m_j;
private bool m_hasJoint;
[Header("Safe/Armed Renders")]
public GameObject ArmedRender;
public GameObject SafeRender;
private bool beginCountdown;
[Header("Misc Params")]
public bool is_Sticky;
public bool armedToStick;
public float arm_After_Impact_Time;
public float speed_to_Stick;
public float ProxRange;
public LayerMask LM_Prox;
private float cooldown;
private bool onCooldown;
private bool coolingDown = true;
[Header("Single Point Rotation")]
private bool hasExpanded;
public Transform pointInterp1;
public Transform pointInterp2;
public float lerpSpeed = 1f;
public GameObject lerpObject;
private bool isLerping;
private float startTime;
private float journeyLength;
private float timer;
private bool timerReached;
private bool iscounting;
public void Awake()
{
((FVRPhysicalObject)this).Awake();
}
public void RegisterRing(proxGrenadeRing r)
{
m_rings.Add(r);
}
public override GameObject DuplicateFromSpawnLock(FVRViveHand hand)
{
GameObject obj = ((FVRPhysicalObject)this).DuplicateFromSpawnLock(hand);
obj.GetComponent<proxGrenade>();
return obj;
}
public void ArmingSequence()
{
if (is_Armed)
{
iscounting = true;
beginCountdown = true;
timerReached = false;
timer = 0f;
}
}
private void Update()
{
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_009a: 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 (beginCountdown && !timerReached)
{
timer += Time.deltaTime;
if (timer > arm_After_Impact_Time)
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_Armed, ((Component)this).transform.position);
is_Set = true;
timer = 0f;
beginCountdown = false;
iscounting = false;
timerReached = true;
}
}
if (m_isPinPulled && !hasExpanded && !isLerping)
{
startTime = Time.time;
journeyLength = Vector3.Distance(pointInterp1.localPosition, pointInterp2.localPosition);
isLerping = true;
}
if (isLerping)
{
float num = (Time.time - startTime) * lerpSpeed / journeyLength;
lerpObject.transform.localPosition = Vector3.Lerp(pointInterp1.localPosition, pointInterp2.localPosition, num);
if (num >= 1f)
{
isLerping = false;
hasExpanded = true;
}
}
}
private void OnCollisionEnter(Collision collision)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
ContactPoint[] contacts = collision.contacts;
for (int i = 0; i < contacts.Length; i++)
{
_ = ref contacts[i];
Vector3 relativeVelocity;
if (armedToStick && is_Sticky)
{
relativeVelocity = collision.relativeVelocity;
if (((Vector3)(ref relativeVelocity)).magnitude > speed_to_Stick && is_Armed)
{
if (!((Object)(object)collision.collider.attachedRigidbody != (Object)null))
{
((FVRPhysicalObject)this).RootRigidbody.isKinematic = true;
ArmingSequence();
}
}
else
{
relativeVelocity = collision.relativeVelocity;
if (((Vector3)(ref relativeVelocity)).magnitude > speed_to_Stick && is_Armed)
{
}
}
}
else if (is_Sticky)
{
relativeVelocity = collision.relativeVelocity;
if (((Vector3)(ref relativeVelocity)).magnitude > 3f && !((Object)(object)collision.collider.attachedRigidbody != (Object)null))
{
((FVRPhysicalObject)this).RootRigidbody.isKinematic = true;
ArmingSequence();
}
}
if (!armedToStick)
{
ArmingSequence();
}
}
}
public void FVRUpdate()
{
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRUpdate();
if (m_rings.Count > 0)
{
m_isPinPulled = true;
for (int i = 0; i < m_rings.Count; i++)
{
if (!m_rings[i].HasPinDetached())
{
m_isPinPulled = false;
}
}
}
if (m_isPinPulled)
{
ArmedRender.SetActive(true);
SafeRender.SetActive(false);
}
if (m_isPinPulled && !((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null)
{
is_Armed = true;
}
if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
((FVRPhysicalObject)this).RootRigidbody.isKinematic = false;
if ((Object)(object)m_j != (Object)null)
{
Debug.Log((object)"deleted m_j");
Object.Destroy((Object)(object)m_j);
onCooldown = true;
}
m_hasJoint = false;
is_Stuck = false;
is_Set = false;
}
if (!is_Armed || !is_Set || !Physics.CheckSphere(((Component)this).transform.position, ProxRange, LayerMask.op_Implicit(LM_Prox), (QueryTriggerInteraction)1))
{
return;
}
if (!m_hasSploded)
{
m_hasSploded = true;
for (int j = 0; j < SpawnOnSplode.Count; j++)
{
GameObject obj = Object.Instantiate<GameObject>(SpawnOnSplode[j], ((Component)this).transform.position, Quaternion.identity);
Explosion component = obj.GetComponent<Explosion>();
if ((Object)(object)component != (Object)null)
{
component.IFF = IFF;
}
ExplosionSound component2 = obj.GetComponent<ExplosionSound>();
if ((Object)(object)component2 != (Object)null)
{
component2.IFF = IFF;
}
GrenadeExplosion component3 = obj.GetComponent<GrenadeExplosion>();
if ((Object)(object)component3 != (Object)null)
{
component3.IFF = IFF;
}
}
}
if (((FVRInteractiveObject)this).IsHeld)
{
FVRViveHand hand = ((FVRInteractiveObject)this).m_hand;
((FVRInteractiveObject)this).m_hand.ForceSetInteractable((FVRInteractiveObject)null);
((FVRInteractiveObject)this).EndInteraction(hand);
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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_004a: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0064: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: 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)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: 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_0133: 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_013f: 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_0145: 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_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: 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)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
if (DoesUseHandedPose)
{
if (!hand.IsThisTheRightHand && m_isInRightHandMode)
{
Vector3 up = ((FVRInteractiveObject)this).PoseOverride.up;
Vector3 forward = ((FVRInteractiveObject)this).PoseOverride.forward;
up = Vector3.Reflect(up, ((Component)this).transform.right);
forward = Vector3.Reflect(forward, ((Component)this).transform.right);
((FVRInteractiveObject)this).PoseOverride.rotation = Quaternion.LookRotation(forward, up);
up = ((FVRInteractiveObject)this).PoseOverride_Touch.up;
forward = ((FVRInteractiveObject)this).PoseOverride_Touch.forward;
up = Vector3.Reflect(up, ((Component)this).transform.right);
forward = Vector3.Reflect(forward, ((Component)this).transform.right);
((FVRInteractiveObject)this).PoseOverride_Touch.rotation = Quaternion.LookRotation(forward, up);
m_isInRightHandMode = false;
}
else if (hand.IsThisTheRightHand && !m_isInRightHandMode)
{
Vector3 up2 = ((FVRInteractiveObject)this).PoseOverride.up;
Vector3 forward2 = ((FVRInteractiveObject)this).PoseOverride.forward;
up2 = Vector3.Reflect(up2, ((Component)this).transform.right);
forward2 = Vector3.Reflect(forward2, ((Component)this).transform.right);
((FVRInteractiveObject)this).PoseOverride.rotation = Quaternion.LookRotation(forward2, up2);
up2 = ((FVRInteractiveObject)this).PoseOverride_Touch.up;
forward2 = ((FVRInteractiveObject)this).PoseOverride_Touch.forward;
up2 = Vector3.Reflect(up2, ((Component)this).transform.right);
forward2 = Vector3.Reflect(forward2, ((Component)this).transform.right);
((FVRInteractiveObject)this).PoseOverride_Touch.rotation = Quaternion.LookRotation(forward2, up2);
m_isInRightHandMode = true;
}
}
((FVRPhysicalObject)this).BeginInteraction(hand);
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).UpdateInteraction(hand);
IFF = GM.CurrentPlayerBody.GetPlayerIFF();
}
}
public class proxGrenadeRing : FVRInteractiveObject
{
public float PinLength = 0.01f;
public proxGrenade G;
public FVRPhysicalObject Pin;
private Transform m_pointIn;
private Transform m_pointOut;
private Transform m_pointMaxGrab;
private float m_posMin;
private float m_posMax;
private float m_posMaxGrab;
private float m_posCurrent;
private float m_heldTarget;
private float m_handZOffset;
private bool m_hasPinDetached;
public WaggleJoint Waggle;
public Vector3 GrabEuler;
public bool UsesSwapPin;
public Mesh SwapPin;
private bool m_hasSwapped;
public bool HasPinDetached()
{
return m_hasPinDetached;
}
public void Start()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_004f: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Expected O, but got Unknown
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
G.RegisterRing(this);
GameObject val = new GameObject();
m_pointIn = val.transform;
((Component)m_pointIn).transform.SetParent(((Component)G).transform);
((Component)m_pointIn).transform.localPosition = ((Component)Pin).transform.localPosition;
((Component)m_pointIn).transform.localRotation = ((Component)Pin).transform.localRotation;
m_posMin = ((Component)m_pointIn).transform.localPosition.z;
GameObject val2 = new GameObject();
m_pointOut = val2.transform;
((Component)m_pointOut).transform.SetParent(((Component)G).transform);
((Component)m_pointOut).transform.position = ((Component)this).transfousing System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NVGBepen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NVGBepen")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6a9e079f-99b2-40c6-b601-ca38dee5cb45")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[ExecuteInEditMode]
public class NightVisionPostEffect : MonoBehaviour
{
public Material nightVisionMat;
public Material bloom;
public bool renderNightVision = true;
public bool renderBloom = true;
[Range(1f, 16f)]
public int iterations = 1;
private const int BoxDownPrefilterPass = 0;
private const int BoxDownPass = 1;
private const int BoxUpPass = 2;
private const int ApplyBloomPass = 3;
private RenderTexture[] textures = (RenderTexture[])(object)new RenderTexture[16];
private void Awake()
{
((Component)this).GetComponent<Camera>().depthTextureMode = (DepthTextureMode)1;
}
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
int num = ((Texture)src).width / 2;
int num2 = ((Texture)src).height / 2;
RenderTextureFormat format = src.format;
RenderTexture val = RenderTexture.GetTemporary(num, num2, 0, format);
if (renderNightVision)
{
Graphics.Blit((Texture)(object)src, val, nightVisionMat);
}
else
{
val = src;
}
if (!renderBloom)
{
Graphics.Blit((Texture)(object)val, dest);
RenderTexture.ReleaseTemporary(val);
return;
}
RenderTexture val2 = (textures[0] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val, val2, bloom, 0);
RenderTexture val3 = val2;
for (int i = 1; i < iterations; i++)
{
num /= 2;
num2 /= 2;
if (num2 < 2)
{
break;
}
val2 = (textures[i] = RenderTexture.GetTemporary(num, num2, 0, format));
Graphics.Blit((Texture)(object)val3, val2, bloom, 1);
val3 = val2;
}
for (int num3 = iterations - 2; num3 >= 0; num3--)
{
val2 = textures[num3];
textures[num3] = null;
Graphics.Blit((Texture)(object)val3, val2, bloom, 2);
RenderTexture.ReleaseTemporary(val3);
val3 = val2;
}
bloom.SetTexture("_SourceTex", (Texture)(object)val);
Graphics.Blit((Texture)(object)val3, dest, bloom, 3);
RenderTexture.ReleaseTemporary(val3);
RenderTexture.ReleaseTemporary(val);
}
}
[BepInPlugin("h3vr.andrew_ftw.bepinexshit", "BepInEX Stuff", "1.0.0")]
internal class Nvg_BepInEx : BaseUnityPlugin
{
public Nvg_BepInEx()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"AFCL BenInEx stuff loaded?");
}
}
namespace AndrewFTW;
[ExecuteInEditMode]
public class PostEffectScript : MonoBehaviour
{
public Material mat;
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
Graphics.Blit((Texture)(object)src, dest, mat);
}
}