Decompiled source of OpenScripts v1.6.0
monomod/Assembly-CSharp.AttachmentStock.mm.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("AttachmentStock")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AttachmentStock")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d3a36f33-2ac5-4636-b4d3-32945d57ef98")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class AttachmentStock : FVRFireArmAttachment { [Header("VirtualStock config")] public bool HasActiveShoulderStock = true; public Transform StockPos; public override bool HasStockPos() { return HasActiveShoulderStock; } public override Transform GetStockPos() { return StockPos; } }
monomod/Assembly-CSharp.CapAndBallRevolver.mm.dll
Decompiled 10 months agousing 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 OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("CapAndBallRevolver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CapAndBallRevolver")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3953e6fb-eb76-4ee6-88ea-36e58a9256a0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class CapAndBallRevolver : SingleActionRevolver { [Header("Cap and Ball Revolver Config")] public Transform ramRodLever; public Vector3 lowerLimit; public Vector3 upperLimit; public Vector3 touchingRot; public float wiggleRoom = 5f; public int numberOfChambersBackwardsToRam; private CapAndBallRevolverCylinder CapCylinder; private int lastChamber = -1; private bool isRamRodExtended; public int RammingChamber { get { int num = ((SingleActionRevolver)this).CurChamber - numberOfChambersBackwardsToRam; if (num < 0) { return base.Cylinder.NumChambers + num; } return num; } } public int PrevChamber3 { get { int num = ((SingleActionRevolver)this).CurChamber - 3; if (num < 0) { return base.Cylinder.NumChambers + num; } return num; } } public override void Start() { ((FVRInteractiveObject)this).Start(); Hook(); CapCylinder = base.Cylinder as CapAndBallRevolverCylinder; numberOfChambersBackwardsToRam = Mathf.Abs(numberOfChambersBackwardsToRam); } public override void OnDestroy() { Unhook(); ((FVRPhysicalObject)this).OnDestroy(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown SingleActionRevolver.Fire -= new hook_Fire(SingleActionRevolver_Fire); SingleActionRevolver.EjectPrevCylinder -= new hook_EjectPrevCylinder(SingleActionRevolver_EjectPrevCylinder); SingleActionRevolver.UpdateCylinderRot -= new hook_UpdateCylinderRot(SingleActionRevolver_UpdateCylinderRot); SingleActionRevolver.AdvanceCylinder -= new hook_AdvanceCylinder(SingleActionRevolver_AdvanceCylinder); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown SingleActionRevolver.Fire += new hook_Fire(SingleActionRevolver_Fire); SingleActionRevolver.EjectPrevCylinder += new hook_EjectPrevCylinder(SingleActionRevolver_EjectPrevCylinder); SingleActionRevolver.UpdateCylinderRot += new hook_UpdateCylinderRot(SingleActionRevolver_UpdateCylinderRot); SingleActionRevolver.AdvanceCylinder += new hook_AdvanceCylinder(SingleActionRevolver_AdvanceCylinder); } public override void FVRUpdate() { //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_0030: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007d: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).FVRUpdate(); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(wiggleRoom, wiggleRoom, wiggleRoom); if (ramRodLever.localEulerAngles.IsLesserOrEqual(lowerLimit + val) && ramRodLever.localEulerAngles.IsGreaterOrEqual(lowerLimit - val)) { isRamRodExtended = false; } else { isRamRodExtended = true; } float num = ExtendingVector3.InverseLerp(touchingRot, upperLimit, ramRodLever.localEulerAngles); if (((SingleActionRevolverCylinder)CapCylinder).Chambers[RammingChamber].IsFull && num > 0f) { CapCylinder.RamChamber(RammingChamber, num); } } private void SingleActionRevolver_AdvanceCylinder(orig_AdvanceCylinder orig, SingleActionRevolver self) { if ((Object)(object)self == (Object)(object)this) { if (!isRamRodExtended && (CapCylinder.ChamberRammed(RammingChamber) || !((SingleActionRevolverCylinder)CapCylinder).Chambers[RammingChamber].IsFull)) { if (lastChamber == ((SingleActionRevolver)this).CurChamber) { lastChamber--; } else { int curChamber = ((SingleActionRevolver)this).CurChamber; ((SingleActionRevolver)this).CurChamber = curChamber + 1; lastChamber = ((SingleActionRevolver)this).CurChamber; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); } } else { orig.Invoke(self); } } private void SingleActionRevolver_UpdateCylinderRot(orig_UpdateCylinderRot orig, SingleActionRevolver self) { //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_022e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)this) { if (base.m_isStateToggled) { int num = ((SingleActionRevolver)this).PrevChamber; if (base.IsAccessTwoChambersBack) { num = ((SingleActionRevolver)this).PrevChamber2; } for (int i = 0; i < ((SingleActionRevolverCylinder)CapCylinder).Chambers.Length; i++) { ((SingleActionRevolverCylinder)CapCylinder).Chambers[i].IsAccessible = i == num; CapCylinder.capNipples[i].IsAccessible = i == num; if (lastChamber == ((SingleActionRevolver)this).CurChamber) { if (!base.IsAccessTwoChambersBack) { ((SingleActionRevolverCylinder)CapCylinder).Chambers[i].IsAccessible = i == ((SingleActionRevolver)this).PrevChamber2; CapCylinder.capNipples[i].IsAccessible = i == ((SingleActionRevolver)this).PrevChamber2; } else { ((SingleActionRevolverCylinder)CapCylinder).Chambers[i].IsAccessible = i == PrevChamber3; CapCylinder.capNipples[i].IsAccessible = i == PrevChamber3; } } } if (base.DoesHalfCockHalfRotCylinder) { int num2 = (((SingleActionRevolver)this).CurChamber + 1) % ((SingleActionRevolverCylinder)CapCylinder).NumChambers; ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num2), 0.5f); if (lastChamber == ((SingleActionRevolver)this).CurChamber) { ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num2), 0f); } } else { int num3 = (((SingleActionRevolver)this).CurChamber + 1) % ((SingleActionRevolverCylinder)CapCylinder).NumChambers; ((Component)CapCylinder).transform.localRotation = ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber); if (lastChamber == ((SingleActionRevolver)this).CurChamber) { ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num3), 0.5f); } } if (base.DoesCylinderTranslateForward) { ((Component)CapCylinder).transform.localPosition = base.CylinderBackPos; } } else { for (int j = 0; j < ((SingleActionRevolverCylinder)CapCylinder).Chambers.Length; j++) { ((SingleActionRevolverCylinder)CapCylinder).Chambers[j].IsAccessible = false; CapCylinder.capNipples[j].IsAccessible = false; } base.m_tarChamberLerp = ((!base.m_isHammerCocking) ? 0f : base.m_hammerCockLerp); base.m_curChamberLerp = Mathf.Lerp(base.m_curChamberLerp, base.m_tarChamberLerp, Time.deltaTime * 16f); int num4 = (((SingleActionRevolver)this).CurChamber + 1) % ((SingleActionRevolverCylinder)CapCylinder).NumChambers; ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num4), base.m_curChamberLerp); if (base.DoesCylinderTranslateForward) { ((Component)CapCylinder).transform.localPosition = Vector3.Lerp(base.CylinderBackPos, base.CylinderFrontPos, base.m_hammerCockLerp); } } } else { orig.Invoke(self); } } private void SingleActionRevolver_EjectPrevCylinder(orig_EjectPrevCylinder orig, SingleActionRevolver self) { if ((Object)(object)self != (Object)(object)this) { orig.Invoke(self); } } private void SingleActionRevolver_Fire(orig_Fire orig, SingleActionRevolver self) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)this) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); bool num = CapCylinder.capNipples[((SingleActionRevolver)this).CurChamber].Fire(); if (num) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)102, 1f); } if (num && CapCylinder.ChamberRammed(((SingleActionRevolver)this).CurChamber) && ((SingleActionRevolverCylinder)CapCylinder).Chambers[((SingleActionRevolver)this).CurChamber].Fire()) { FVRFireArmChamber val = ((SingleActionRevolverCylinder)CapCylinder).Chambers[((SingleActionRevolver)this).CurChamber]; ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite && GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; CapCylinder.capNipples[((SingleActionRevolver)this).CurChamber].IsSpent = false; val.UpdateProxyDisplay(); } else { val.SetRound((FVRFireArmRound)null, false); CapCylinder.ChamberRammed(((SingleActionRevolver)this).CurChamber, set: true); } } } else { orig.Invoke(self); } } } public static class ExtendingVector3 { public static bool IsGreaterOrEqual(this Vector3 local, Vector3 other) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001c: 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) if (local.x >= other.x && local.y >= other.y && local.z >= other.z) { return true; } return false; } public static bool IsLesserOrEqual(this Vector3 local, Vector3 other) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001c: 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) if (local.x <= other.x && local.y <= other.y && local.z <= other.z) { return true; } return false; } public static float InverseLerp(Vector3 a, Vector3 b, Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0009: 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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) Vector3 val = b - a; return Mathf.Clamp01(Vector3.Dot(value - a, val) / Vector3.Dot(val, val)); } } public class CapAndBallRevolverCylinder : SingleActionRevolverCylinder { public FVRFireArmChamber[] capNipples; public float unrammedPos; public float rammedPos; private bool[] chamberRammed; private float[] lastLerp; public void Awake() { //IL_0040: 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_0067: Unknown result type (might be due to invalid IL or missing references) chamberRammed = new bool[base.NumChambers]; lastLerp = new float[base.NumChambers]; for (int i = 0; i < base.NumChambers; i++) { ((Component)base.Chambers[i]).transform.localPosition = new Vector3(((Component)base.Chambers[i]).transform.localPosition.x, ((Component)base.Chambers[i]).transform.localPosition.y, unrammedPos); chamberRammed[i] = false; lastLerp[i] = 0f; } } public bool ChamberRammed(int chamber, bool set = false, bool value = false) { //IL_0079: 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_00a0: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (set) { chamberRammed[chamber] = value; if (value) { ((Component)base.Chambers[chamber]).transform.localPosition = new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, rammedPos); } else { ((Component)base.Chambers[chamber]).transform.localPosition = new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, unrammedPos); } } return chamberRammed[chamber]; } public void RamChamber(int chamber, float lerp) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0088: 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_00a1: Unknown result type (might be due to invalid IL or missing references) if (!chamberRammed[chamber] && lerp > lastLerp[chamber]) { Vector3 localPosition = Vector3.Lerp(new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, unrammedPos), new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, rammedPos), lerp); ((Component)base.Chambers[chamber]).transform.localPosition = localPosition; lastLerp[chamber] = lerp; if (lerp == 1f) { chamberRammed[chamber] = true; lastLerp[chamber] = 0f; } } } } public class PaperCartridgeRenderer : MonoBehaviour { public FVRFireArmChamber chamber; public Mesh cartridgeMesh; public Material cartridgeMaterial; private GameObject _proxyGameObject; private MeshFilter _proxyMeshFilter; private MeshRenderer _proxyMeshRenderer; private static readonly Dictionary<FVRFireArmChamber, PaperCartridgeRenderer> _existingPaperCartridgeRenderers = new Dictionary<FVRFireArmChamber, PaperCartridgeRenderer>(); private static readonly Dictionary<Mesh, GameObject> _paperCartridgeMeshProxyDictionary = new Dictionary<Mesh, GameObject>(); public void Awake() { ((Component)this).gameObject.SetActive(false); PaperCartridgeRenderer obj = ((Component)this).gameObject.AddComponent<PaperCartridgeRenderer>(); obj.Chamber = chamber; obj.CartridgeMesh = cartridgeMesh; obj.CartridgeMaterial = cartridgeMaterial; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
monomod/Assembly-CSharp.CustomQuickBeltSlots.mm.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using On.FistVR; using OpenScripts2; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("QuickBinSlot")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("QuickBinSlot")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b6975da5-0fac-43ba-b1f0-c507ca262ff7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; [RequireComponent(typeof(FVRQuickBeltSlot))] public class CustomQBSlotSounds : MonoBehaviour { public AudioEvent insertSound; public AudioEvent extractSound; private FVRQuickBeltSlot slot; private bool slotHasItem; private bool isHooked; public void Awake() { ((Component)this).gameObject.SetActive(false); CustomQBSlotSounds obj = ((Component)this).gameObject.AddComponent<CustomQBSlotSounds>(); obj.InsertSounds = insertSound; obj.ExtractSounds = extractSound; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class QuickBeltAreaCollisionDetector : MonoBehaviour { public QuickBeltArea ConnectedQuickBeltArea; [HideInInspector] public FVRPhysicalObject PhysicalObjectToDetect; public void OnCollisionEnter(Collision col) { if (col != null && !((Object)(object)col.collider == (Object)null) && !((Object)(object)col.collider.attachedRigidbody == (Object)null)) { FVRPhysicalObject component = ((Component)col.collider.attachedRigidbody).GetComponent<FVRPhysicalObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)PhysicalObjectToDetect) { ConnectedQuickBeltArea.ItemDidCollide = true; PhysicalObjectToDetect = null; } } } } public class QuickBeltArea : StandaloneQBSlot { private class SubQBSlot { public StandaloneQBSlot slot; public Vector3 localPos; public Quaternion localRot; private SubQBSlot(StandaloneQBSlot slot, Vector3 localPos, Quaternion localRot) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) this.slot = slot; this.localPos = localPos; this.localRot = localRot; } } public FVRPhysicalObject MainObject; [Tooltip("Preconfigured QBSlot that will be used as a reference to create all other slots.")] public GameObject SubQBSlotPrefab; [Tooltip("Please try to use base 2 numbers, like 2 ,4 ,8 ,16 ,32 ,64 etc.")] public int ItemLimit = 32; [Header("Advanced Size Options")] public bool UsesAdvancedSizeMode; [Tooltip("Capacity requirement for items of size Small, Medium, Large, Massive, CantCarryBig")] public int[] Sizes = new int[5] { 1, 2, 5, 10, 25 }; public int TotalCapacity = 50; [Header("Collision Settings")] public bool ObjectsKeepCollision; [Tooltip("This setting requires a manually placed QuickBeltAreaCollisionDetector on the FVRPhysicalObject.")] public bool CollisionActivatedFreeze; public QuickBeltAreaCollisionDetector CollisionDetector; public bool SetKinematic; [HideInInspector] public bool ItemDidCollide; private Dictionary<FVRQuickBeltSlot, FVRPhysicalObject> _quickBeltSlots; private FVRPhysicalObjectSize[] _sizes = (FVRPhysicalObjectSize[])(object)new FVRPhysicalObjectSize[5] { default(FVRPhysicalObjectSize), (FVRPhysicalObjectSize)1, (FVRPhysicalObjectSize)2, (FVRPhysicalObjectSize)3, (FVRPhysicalObjectSize)5 }; private Dictionary<FVRPhysicalObjectSize, int> _SizeRequirements; private int _currentLoad; public override void OnDestroy() { Unhook(); } public override void Start() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) base.Start(); Hook(); if ((Object)(object)MainObject == (Object)null) { FVRPhysicalObject component = ((Component)this).GetComponent<FVRPhysicalObject>(); while ((Object)(object)component == (Object)null) { component = ((Component)((Component)this).transform.parent).GetComponent<FVRPhysicalObject>(); } MainObject = component; } _quickBeltSlots = new Dictionary<FVRQuickBeltSlot, FVRPhysicalObject>(); _SizeRequirements = new Dictionary<FVRPhysicalObjectSize, int>(); for (int i = 0; i < _sizes.Length; i++) { _SizeRequirements.Add(_sizes[i], Sizes[i]); } List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>(); for (int j = 0; j < ItemLimit; j++) { FVRQuickBeltSlot component2 = Object.Instantiate<GameObject>(SubQBSlotPrefab).GetComponent<FVRQuickBeltSlot>(); ((Object)((Component)component2).gameObject).name = "QuickBeltAreaSubSlot_" + _quickBeltSlots.Count; ((Component)component2).gameObject.transform.parent = ((Component)this).transform; ((Component)component2).gameObject.transform.localPosition = Vector3.zero; ((Component)component2).gameObject.transform.localRotation = Quaternion.identity; Dictionary<string, string> flagDic = MainObject.GetFlagDic(); string key = "QuickBeltAreaSubSlot_" + _quickBeltSlots.Count; Vector3 zero = Vector3.zero; string text = ((Vector3)(ref zero)).ToString("F6"); Quaternion identity = Quaternion.identity; flagDic.Add(key, text + ";" + ((Quaternion)(ref identity)).ToString("F6")); _quickBeltSlots.Add(component2, null); list.Add(component2); } MainObject.Slots.Concat(list.ToArray()); SubQBSlotPrefab.SetActive(false); } public void LateUpdate() { //IL_00e8: 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_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_0104: 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_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) if (!CollisionActivatedFreeze && (Object)(object)((FVRQuickBeltSlot)this).CurObject != (Object)null) { CreateNewQBSlotPos(((FVRQuickBeltSlot)this).CurObject); } else if ((Object)(object)((FVRQuickBeltSlot)this).CurObject != (Object)null) { ((MonoBehaviour)this).StartCoroutine(WaitForCollision(((FVRQuickBeltSlot)this).CurObject)); } List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>(); foreach (KeyValuePair<FVRQuickBeltSlot, FVRPhysicalObject> quickBeltSlot in _quickBeltSlots) { FVRQuickBeltSlot key = quickBeltSlot.Key; if ((Object)(object)key.CurObject != (Object)null && !key.CurObject.m_isSpawnLock && !key.CurObject.m_isHardnessed) { key.HoverGeo.SetActive(false); } if (ObjectsKeepCollision && (Object)(object)key.CurObject != (Object)null) { ((FVRInteractiveObject)key.CurObject).SetAllCollidersToLayer(false, "Default"); } if (SetKinematic && (Object)(object)key.CurObject != (Object)null && ((Component)key.CurObject).transform.localPosition != Vector3.zero) { ((Component)key.CurObject).transform.localPosition = Vector3.zero; } if (SetKinematic && (Object)(object)key.CurObject != (Object)null && ((Component)key.CurObject).transform.localRotation != Quaternion.identity) { ((Component)key.CurObject).transform.localRotation = Quaternion.identity; } } foreach (KeyValuePair<FVRQuickBeltSlot, FVRPhysicalObject> quickBeltSlot2 in _quickBeltSlots) { if ((Object)(object)quickBeltSlot2.Value != (Object)(object)quickBeltSlot2.Key.CurObject) { list.Add(quickBeltSlot2.Key); } } foreach (FVRQuickBeltSlot item in list) { if (UsesAdvancedSizeMode) { FVRPhysicalObjectSize sizeLimit = item.SizeLimit; int value = 0; _SizeRequirements.TryGetValue(sizeLimit, out value); _currentLoad -= value; } _quickBeltSlots[item] = null; } if (UsesAdvancedSizeMode) { if (_currentLoad >= TotalCapacity) { ((FVRQuickBeltSlot)this).IsSelectable = false; } else { ((FVRQuickBeltSlot)this).IsSelectable = true; } } } public void CreateNewQBSlotPos(FVRPhysicalObject physicalObject) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_003b: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_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_00a2: 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_0082: Invalid comparison between Unknown and I4 //IL_0143: 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_014b: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) FVRPhysicalObjectSize size = physicalObject.Size; Vector3 position = ((Component)physicalObject).transform.position; Quaternion rotation = ((Component)physicalObject).transform.rotation; if (!SetKinematic && (Object)(object)((FVRInteractiveObject)physicalObject).QBPoseOverride != (Object)null) { position = ((FVRInteractiveObject)physicalObject).QBPoseOverride.position; rotation = ((FVRInteractiveObject)physicalObject).QBPoseOverride.rotation; _ = ((FVRInteractiveObject)physicalObject).QBPoseOverride.localRotation; } else if (!SetKinematic && (Object)(object)((FVRInteractiveObject)physicalObject).PoseOverride_Touch != (Object)null && ((int)GM.HMDMode == 1 || (int)GM.HMDMode == 3)) { position = ((FVRInteractiveObject)physicalObject).PoseOverride_Touch.position; rotation = ((FVRInteractiveObject)physicalObject).PoseOverride_Touch.rotation; _ = ((FVRInteractiveObject)physicalObject).PoseOverride_Touch.localRotation; } else if (!SetKinematic && (Object)(object)((FVRInteractiveObject)physicalObject).PoseOverride != (Object)null) { position = ((FVRInteractiveObject)physicalObject).PoseOverride.position; rotation = ((FVRInteractiveObject)physicalObject).PoseOverride.rotation; _ = ((FVRInteractiveObject)physicalObject).PoseOverride.localRotation; } if (UsesAdvancedSizeMode) { int value = 0; _SizeRequirements.TryGetValue(size, out value); if (_currentLoad + value > TotalCapacity) { physicalObject.ForceObjectIntoInventorySlot((FVRQuickBeltSlot)null); return; } _currentLoad += value; } FVRQuickBeltSlot emptySlot = GetEmptySlot(); if ((Object)(object)emptySlot == (Object)null) { physicalObject.ForceObjectIntoInventorySlot((FVRQuickBeltSlot)null); } ((Component)emptySlot).transform.SetPositionAndRotation(position, rotation); emptySlot.SizeLimit = size; physicalObject.ForceObjectIntoInventorySlot(emptySlot); _quickBeltSlots[emptySlot] = physicalObject; if (SetKinematic) { physicalObject.RootRigidbody.isKinematic = true; ((Component)emptySlot).transform.rotation = rotation; } else { emptySlot.PoseOverride.rotation = rotation; } } private IEnumerator WaitForCollision(FVRPhysicalObject physicalObject) { physicalObject.SetParentage((Transform)null); physicalObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); ItemDidCollide = false; CollisionDetector.PhysicalObjectToDetect = physicalObject; while (!ItemDidCollide) { yield return null; } ItemDidCollide = false; CreateNewQBSlotPos(physicalObject); } private FVRQuickBeltSlot GetEmptySlot() { foreach (KeyValuePair<FVRQuickBeltSlot, FVRPhysicalObject> quickBeltSlot in _quickBeltSlots) { if ((Object)(object)quickBeltSlot.Value == (Object)null) { return quickBeltSlot.Key; } } return null; } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRPhysicalObject.ConfigureFromFlagDic -= new hook_ConfigureFromFlagDic(FVRPhysicalObject_ConfigureFromFlagDic); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRPhysicalObject.ConfigureFromFlagDic += new hook_ConfigureFromFlagDic(FVRPhysicalObject_ConfigureFromFlagDic); } private void FVRPhysicalObject_ConfigureFromFlagDic(orig_ConfigureFromFlagDic orig, FVRPhysicalObject self, Dictionary<string, string> f) { //IL_00df: 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) orig.Invoke(self, f); if ((Object)(object)MainObject == (Object)(object)self) { Vector3 localPosition = default(Vector3); Quaternion localRotation = default(Quaternion); for (int i = 0; i < ItemLimit; i++) { string[] array = f["QuickBeltAreaSubSlot_" + i].Replace(" ", "").Split(new char[1] { ';' }); string[] array2 = array[0].Split(new char[1] { ',' }); string[] array3 = array[1].Split(new char[1] { ',' }); ((Vector3)(ref localPosition))..ctor(float.Parse(array2[0]), float.Parse(array2[1]), float.Parse(array2[2])); ((Quaternion)(ref localRotation))..ctor(float.Parse(array3[0]), float.Parse(array3[1]), float.Parse(array3[2]), float.Parse(array3[3])); ((Component)_quickBeltSlots.ElementAt(i).Key).transform.localPosition = localPosition; ((Component)_quickBeltSlots.ElementAt(i).Key).transform.localRotation = localRotation; } } } } public class LeftHandModeIgnoreQBSlot : FVRQuickBeltSlot { public virtual void Start() { //IL_001b: 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_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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_0062: 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_0079: 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_009a: 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) if (GM.Options.QuickbeltOptions.QuickbeltHandedness > 0) { Vector3 forward = base.PoseOverride.forward; Vector3 up = base.PoseOverride.up; forward = Vector3.Reflect(forward, -((Component)this).transform.right); up = Vector3.Reflect(up, -((Component)this).transform.right); base.PoseOverride.rotation = Quaternion.LookRotation(forward, up); ((Component)this).transform.localPosition = new Vector3(0f - ((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, ((Component)this).transform.localPosition.z); } } } public class HolsterStockQBSlot : StandaloneQBSlot { public enum Axis { X, Y, Z } [Header("Holster Config")] public FVRPhysicalObject PhysicalObject; public Transform StockCap; public float CapClosed; public float CapOpen; public Axis axis; public override void Start() { base.Start(); Hook(); } public override void OnDestroy() { base.OnDestroy(); Unhook(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update -= new hook_Update(FVRQuickBeltSlot_Update); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update += new hook_Update(FVRQuickBeltSlot_Update); } private void FVRQuickBeltSlot_Update(orig_Update orig, FVRQuickBeltSlot self) { //IL_0102: 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_0139: 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_0170: 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) orig.Invoke(self); if ((Object)(object)((FVRQuickBeltSlot)this).HeldObject != (Object)null && (Object)(object)PhysicalObject.QuickbeltSlot != (Object)null) { ((Component)PhysicalObject).gameObject.layer = LayerMask.NameToLayer("Default"); ((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable"); PhysicalObject.QuickbeltSlot.IsSelectable = false; } else if ((Object)(object)((FVRQuickBeltSlot)this).HeldObject == (Object)null && (Object)(object)PhysicalObject.QuickbeltSlot != (Object)null) { ((Component)PhysicalObject).gameObject.layer = LayerMask.NameToLayer("Interactable"); ((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable"); PhysicalObject.QuickbeltSlot.IsSelectable = true; } else { ((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable"); } switch (axis) { case Axis.X: if (StockCap.localRotation == Quaternion.Euler(CapOpen, 0f, 0f)) { ((FVRQuickBeltSlot)this).IsSelectable = true; } else { ((FVRQuickBeltSlot)this).IsSelectable = false; } break; case Axis.Y: if (StockCap.localRotation == Quaternion.Euler(0f, CapOpen, 0f)) { ((FVRQuickBeltSlot)this).IsSelectable = true; } else { ((FVRQuickBeltSlot)this).IsSelectable = false; } break; case Axis.Z: if (StockCap.localRotation == Quaternion.Euler(0f, 0f, CapOpen)) { ((FVRQuickBeltSlot)this).IsSelectable = true; } else { ((FVRQuickBeltSlot)this).IsSelectable = false; } break; } } } public class WristMounted_ClosedBoltWeapon : MonoBehaviour { public ClosedBoltWeapon closedBoltWeapon; public bool requiresEmptyHand; public void Start() { Hook(); } public void OnDestroy() { Unhook(); } public void Update() { if (!((Object)(object)((FVRPhysicalObject)closedBoltWeapon).m_quickbeltSlot != (Object)null)) { return; } WristQBSlot wristQBSlot = ((FVRPhysicalObject)closedBoltWeapon).m_quickbeltSlot as WristQBSlot; if ((Object)(object)wristQBSlot != (Object)null && (Object)(object)wristQBSlot.Hand != (Object)null && (!requiresEmptyHand || !((Object)(object)wristQBSlot.Hand.CurrentInteractable != (Object)null))) { if (wristQBSlot.Hand.Input.TriggerFloat < 0.15f) { ((FVRInteractiveObject)closedBoltWeapon).m_hasTriggeredUpSinceBegin = true; } closedBoltWeapon.UpdateInputAndAnimate(wristQBSlot.Hand); } } private void Unhook() { } private void Hook() { } } public class WristItem : FVRPhysicalObject { [Header("WristItem Config")] public bool requiresEmptyHand; private WristQBSlot wristQBSlot; private FVRViveHand m_wristHand; public WristQBSlot WristQBSlot => wristQBSlot; public FVRViveHand WristHand => m_wristHand; public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); wristQBSlot = base.m_quickbeltSlot as WristQBSlot; if ((Object)(object)wristQBSlot != (Object)null) { if (requiresEmptyHand && (Object)(object)wristQBSlot.Hand.CurrentInteractable != (Object)null) { m_wristHand = null; } else { m_wristHand = wristQBSlot.Hand; } } else { m_wristHand = null; } } } public class WristQBSlot_Item_test : WristItem { [Header("WristQBSlot Config")] public MeshRenderer render; public override void FVRUpdate() { //IL_0068: 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) base.FVRUpdate(); if ((Object)(object)base.WristHand != (Object)null) { ((Renderer)render).material.color = new Color(base.WristHand.Input.TriggerFloat, 0f, 0f, 1f); } else { ((Renderer)render).material.color = new Color(0f, 0f, 0f, 1f); } } } public class WristQBSlot : FVRQuickBeltSlot { public enum Wrist { leftWrist, rightWrist } [Header("WristQBSlot Config")] public Vector3 wristOffsetPosition; public Vector3 wristOffsetRotation; [SearchableEnum] public Wrist wrist; private FVRViveHand m_hand; public FVRViveHand Hand => m_hand; [ContextMenu("CopyQBSlot")] public void CopyQBSlot() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) FVRQuickBeltSlot component = ((Component)this).GetComponent<FVRQuickBeltSlot>(); base.QuickbeltRoot = component.QuickbeltRoot; base.PoseOverride = component.PoseOverride; base.SizeLimit = component.SizeLimit; base.Shape = component.Shape; base.Type = component.Type; base.HoverGeo = component.HoverGeo; base.RectBounds = component.RectBounds; base.CurObject = component.CurObject; base.IsSelectable = component.IsSelectable; base.IsPlayer = component.IsPlayer; base.UseStraightAxisAlignment = component.UseStraightAxisAlignment; base.HeldObject = component.HeldObject; } public void Start() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.LeftHand != (Object)null && (Object)(object)GM.CurrentPlayerBody.RightHand != (Object)null) { switch (wrist) { case Wrist.leftWrist: ((Component)this).transform.SetParent(GM.CurrentPlayerBody.LeftHand); m_hand = GameObject.Find("Controller (left)").GetComponent<FVRViveHand>(); break; case Wrist.rightWrist: ((Component)this).transform.SetParent(GM.CurrentPlayerBody.RightHand); m_hand = GameObject.Find("Controller (right)").GetComponent<FVRViveHand>(); break; } } ((Component)this).transform.localPosition = wristOffsetPosition; ((Component)this).transform.localRotation = Quaternion.Euler(wristOffsetRotation); } public void OnDestroy() { } } public class StandaloneQBSlot : FVRQuickBeltSlot { public virtual void Start() { _ = (Object)(object)GM.CurrentPlayerBody != (Object)null; } public virtual void OnEnable() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { RegisterQuickbeltSlot(); } } public virtual void OnDisable() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { DeRegisterQuickbeltSlot(); } } public virtual void OnDestroy() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { DeRegisterQuickbeltSlot(); } } public void RegisterQuickbeltSlot() { } public void DeRegisterQuickbeltSlot() { } } public class QuickBinSlot : FVRQuickBeltSlot { [Header("QuickBinSlot settings")] public Color hoverColor; public AudioEvent deleteSound; public AudioEvent deleteFailureSound; [ContextMenu("CopyQBSlot")] public void CopyQBSlot() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) FVRQuickBeltSlot component = ((Component)this).GetComponent<FVRQuickBeltSlot>(); base.QuickbeltRoot = component.QuickbeltRoot; base.PoseOverride = component.PoseOverride; base.SizeLimit = component.SizeLimit; base.Shape = component.Shape; base.Type = component.Type; base.HoverGeo = component.HoverGeo; base.RectBounds = component.RectBounds; base.CurObject = component.CurObject; base.IsSelectable = component.IsSelectable; base.IsPlayer = component.IsPlayer; base.UseStraightAxisAlignment = component.UseStraightAxisAlignment; base.HeldObject = component.HeldObject; } public void Start() { Hook(); } public void OnDestroy() { Unhook(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update -= new hook_Update(FVRQuickBeltSlot_Update); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update += new hook_Update(FVRQuickBeltSlot_Update); } private void FVRQuickBeltSlot_Update(orig_Update orig, FVRQuickBeltSlot self) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)this == (Object)(object)self) { if (!GM.CurrentSceneSettings.IsSpawnLockingEnabled && (Object)(object)base.HeldObject != (Object)null && ((FVRPhysicalObject)/*isinst with value type is only supported in some contexts*/).m_isSpawnLock) { FVRInteractiveObject heldObject = base.HeldObject; ((FVRPhysicalObject)((heldObject is FVRPhysicalObject) ? heldObject : null)).m_isSpawnLock = false; } if ((Object)(object)base.HeldObject != (Object)null) { FVRInteractiveObject heldObject2 = base.HeldObject; if (((FVRPhysicalObject)((heldObject2 is FVRPhysicalObject) ? heldObject2 : null)).m_isSpawnLock) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 0.3f, 1f, 1f)); } else { FVRInteractiveObject heldObject3 = base.HeldObject; if (((FVRPhysicalObject)((heldObject3 is FVRPhysicalObject) ? heldObject3 : null)).m_isHardnessed) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 1f, 0.3f, 1f)); } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } } } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } if ((Object)(object)base.CurObject != (Object)null && base.CurObject is FVRFireArmMagazine) { Object.Destroy((Object)(object)((Component)base.CurObject).gameObject); base.CurObject = null; base.HeldObject = null; ((FVRQuickBeltSlot)this).IsHovered = false; SM.PlayGenericSound(deleteSound, ((Component)this).transform.position); } if ((Object)(object)base.CurObject != (Object)null && !(base.CurObject is FVRFireArmMagazine)) { base.CurObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); base.CurObject = null; base.HeldObject = null; ((FVRQuickBeltSlot)this).IsHovered = false; SM.PlayGenericSound(deleteFailureSound, ((Component)this).transform.position); } } else { orig.Invoke(self); } } } public class BottomlessSlotItem : MonoBehaviour { public struct BottomlessSlotItemIDs { public readonly int slotID; public readonly int itemID; public BottomlessSlotItemIDs(int slotID, int itemID) { this.slotID = slotID; this.itemID = itemID; } } private BottomlessSlotItemIDs iDs; private bool valueSet; public BottomlessSlotItemIDs IDs { get { return iDs; } set { if (!valueSet) { iDs = value; valueSet = false; return; } throw new AccessViolationException(); } } } public class QuickBottomlessSlot : FVRQuickBeltSlot { [Header("QuickBottomlessSlot settings")] public int maxItems = 30; public float timeBetweenMagSwitch = 0.25f; public Color hoverColor; public bool storesMagazines = true; public bool storesClips = true; public bool storesSpeedloaders = true; public bool onlyStoresEmpty; public AudioEvent insertSound; public AudioEvent extractSound; public AudioEvent failureSound; public GameObject canvas; public string textPrefix = "Items: "; public Text numberOfItemsDisplay; public bool textTurnsOffOnNoItemsStored = true; private GameObject currentSelectedObject; private List<GameObject> storedGameObjects; private bool switchingObject; private int selectedObjectIndex; private float timeWaited; [ContextMenu("CopyQBSlot")] public void CopyQBSlot() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) FVRQuickBeltSlot component = ((Component)this).GetComponent<FVRQuickBeltSlot>(); base.QuickbeltRoot = component.QuickbeltRoot; base.PoseOverride = component.PoseOverride; base.SizeLimit = component.SizeLimit; base.Shape = component.Shape; base.Type = component.Type; base.HoverGeo = component.HoverGeo; base.RectBounds = component.RectBounds; base.CurObject = component.CurObject; base.IsSelectable = component.IsSelectable; base.IsPlayer = component.IsPlayer; base.UseStraightAxisAlignment = component.UseStraightAxisAlignment; base.HeldObject = component.HeldObject; } public void Start() { storedGameObjects = new List<GameObject>(); Hook(); } public void OnDestroy() { Unhook(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown FVRQuickBeltSlot.Update -= new hook_Update(FVRQuickBeltSlot_Update); FVRQuickBeltSlot.MoveContents -= new hook_MoveContents(FVRQuickBeltSlot_MoveContents); FVRQuickBeltSlot.MoveContentsInstant -= new hook_MoveContentsInstant(FVRQuickBeltSlot_MoveContentsInstant); FVRQuickBeltSlot.MoveContentsCheap -= new hook_MoveContentsCheap(FVRQuickBeltSlot_MoveContentsCheap); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown FVRQuickBeltSlot.Update += new hook_Update(FVRQuickBeltSlot_Update); FVRQuickBeltSlot.MoveContents += new hook_MoveContents(FVRQuickBeltSlot_MoveContents); FVRQuickBeltSlot.MoveContentsInstant += new hook_MoveContentsInstant(FVRQuickBeltSlot_MoveContentsInstant); FVRQuickBeltSlot.MoveContentsCheap += new hook_MoveContentsCheap(FVRQuickBeltSlot_MoveContentsCheap); } private void FVRQuickBeltSlot_MoveContentsCheap(orig_MoveContentsCheap orig, FVRQuickBeltSlot self, Vector3 dir) { //IL_005b: 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_003e: 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) if ((Object)(object)self == (Object)(object)this) { if ((Object)(object)currentSelectedObject != (Object)null) { FVRPhysicalObject component = currentSelectedObject.GetComponent<FVRPhysicalObject>(); if (!((FVRInteractiveObject)component).IsHeld) { component.RootRigidbody.position = component.RootRigidbody.position + dir; component.RootRigidbody.velocity = Vector3.zero; } } } else { orig.Invoke(self, dir); } } private void FVRQuickBeltSlot_MoveContentsInstant(orig_MoveContentsInstant orig, FVRQuickBeltSlot self, Vector3 dir) { //IL_005b: 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_003e: 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) if ((Object)(object)self == (Object)(object)this) { if ((Object)(object)currentSelectedObject != (Object)null) { FVRPhysicalObject component = currentSelectedObject.GetComponent<FVRPhysicalObject>(); if (!((FVRInteractiveObject)component).IsHeld) { ((Component)component).transform.position = ((Component)component).transform.position + dir; component.RootRigidbody.velocity = Vector3.zero; } } } else { orig.Invoke(self, dir); } } private void FVRQuickBeltSlot_MoveContents(orig_MoveContents orig, FVRQuickBeltSlot self, Vector3 dir) { //IL_005b: 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_003e: 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) if ((Object)(object)self == (Object)(object)this) { if ((Object)(object)currentSelectedObject != (Object)null) { FVRPhysicalObject component = currentSelectedObject.GetComponent<FVRPhysicalObject>(); if (!((FVRInteractiveObject)component).IsHeld) { ((Component)component).transform.position = ((Component)component).transform.position + dir; component.RootRigidbody.velocity = Vector3.zero; } } } else { orig.Invoke(self, dir); } } private void FVRQuickBeltSlot_Update(orig_Update orig, FVRQuickBeltSlot self) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0441: Unknown result type (might be due to invalid IL or missing references) //IL_030f: 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_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_0364: 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) if ((Object)(object)this == (Object)(object)self) { if (!GM.CurrentSceneSettings.IsSpawnLockingEnabled && (Object)(object)base.HeldObject != (Object)null && ((FVRPhysicalObject)/*isinst with value type is only supported in some contexts*/).m_isSpawnLock) { FVRInteractiveObject heldObject = base.HeldObject; ((FVRPhysicalObject)((heldObject is FVRPhysicalObject) ? heldObject : null)).m_isSpawnLock = false; } if ((Object)(object)base.HeldObject != (Object)null) { FVRInteractiveObject heldObject2 = base.HeldObject; if (((FVRPhysicalObject)((heldObject2 is FVRPhysicalObject) ? heldObject2 : null)).m_isSpawnLock) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 0.3f, 1f, 1f)); } else { FVRInteractiveObject heldObject3 = base.HeldObject; if (((FVRPhysicalObject)((heldObject3 is FVRPhysicalObject) ? heldObject3 : null)).m_isHardnessed) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 1f, 0.3f, 1f)); } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } } } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } if (storesMagazines && (Object)(object)base.CurObject != (Object)null && base.CurObject is FVRFireArmMagazine && storedGameObjects.Count < maxItems) { StoreCurObject(); } else if (storesClips && (Object)(object)base.CurObject != (Object)null && base.CurObject is FVRFireArmClip && storedGameObjects.Count < maxItems) { StoreCurObject(); } else if (storesSpeedloaders && (Object)(object)base.CurObject != (Object)null && base.CurObject is Speedloader && storedGameObjects.Count < maxItems) { StoreCurObject(); } else if ((Object)(object)base.CurObject != (Object)null) { EjectCurObject(); } if (storedGameObjects.Count > 0) { timeWaited += Time.deltaTime; if (!switchingObject) { timeWaited = 0f; SelectObject(); } else if (timeWaited > timeBetweenMagSwitch) { switchingObject = false; } int num = -1; for (int i = 0; i < storedGameObjects.Count; i++) { storedGameObjects[i].SetActive(i == selectedObjectIndex); if (i != selectedObjectIndex) { if ((Object)(object)base.QuickbeltRoot != (Object)null) { storedGameObjects[i].transform.position = base.QuickbeltRoot.position; storedGameObjects[i].transform.rotation = base.QuickbeltRoot.rotation; } else if ((Object)(object)base.PoseOverride != (Object)null) { storedGameObjects[i].transform.position = base.PoseOverride.position; storedGameObjects[i].transform.rotation = base.PoseOverride.rotation; } else { storedGameObjects[i].transform.position = ((Component)this).transform.position; storedGameObjects[i].transform.rotation = ((Component)this).transform.rotation; } } FVRPhysicalObject component = storedGameObjects[i].GetComponent<FVRPhysicalObject>(); if (((FVRInteractiveObject)component).IsHeld) { num = i; } if (component.m_isSpawnLock) { component.m_isSpawnLock = false; } } if (num >= 0) { storedGameObjects[num].SetActive(true); storedGameObjects.RemoveAt(num); SM.PlayGenericSound(extractSound, ((Component)this).transform.position); switchingObject = false; } if ((Object)(object)canvas != (Object)null && (Object)(object)numberOfItemsDisplay != (Object)null) { if (textTurnsOffOnNoItemsStored) { canvas.SetActive(true); } numberOfItemsDisplay.text = textPrefix + storedGameObjects.Count; } } else if ((Object)(object)canvas != (Object)null && (Object)(object)numberOfItemsDisplay != (Object)null) { if (textTurnsOffOnNoItemsStored) { canvas.SetActive(false); } numberOfItemsDisplay.text = textPrefix + storedGameObjects.Count; } } else { orig.Invoke(self); } } private void StoreCurObject() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!storedGameObjects.Contains(((Component)base.CurObject).gameObject) && (!onlyStoresEmpty || CheckEmpty())) { storedGameObjects.Add(((Component)base.CurObject).gameObject); ((Component)base.CurObject).gameObject.SetActive(false); base.CurObject = null; base.HeldObject = null; SM.PlayGenericSound(insertSound, ((Component)this).transform.position); } } private bool EjectCurObject() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) base.CurObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); base.CurObject = null; base.HeldObject = null; SM.PlayGenericSound(failureSound, ((Component)this).transform.position); return false; } private bool CheckEmpty() { FVRFireArmMagazine component = ((Component)base.CurObject).gameObject.GetComponent<FVRFireArmMagazine>(); FVRFireArmClip component2 = ((Component)base.CurObject).gameObject.GetComponent<FVRFireArmClip>(); Speedloader component3 = ((Component)base.CurObject).gameObject.GetComponent<Speedloader>(); if ((Object)(object)component != (Object)null && component.m_numRounds > 0) { return EjectCurObject(); } if ((Object)(object)component2 != (Object)null && component2.m_numRounds > 0) { return EjectCurObject(); } if ((Object)(object)component3 != (Object)null) { bool flag = false; foreach (SpeedloaderChamber chamber in component3.Chambers) { flag = chamber.IsLoaded; } if (flag) { return EjectCurObject(); } } return true; } private Vector3 GetPointInside() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) //IL_000c: Invalid comparison between Unknown and I4 //IL_0039: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references) QuickbeltSlotShape shape = base.Shape; if ((int)shape != 0) { if ((int)shape == 1) { return new Vector3(Random.Range(0f - base.RectBounds.localScale.x, base.RectBounds.localScale.x), Random.Range(0f - base.RectBounds.localScale.y, base.RectBounds.localScale.y), Random.Range(0f - base.RectBounds.localScale.z, base.RectBounds.localScale.z)); } return default(Vector3); } return Random.insideUnitSphere * base.HoverGeo.transform.localScale.x; } private void SelectObject() { switchingObject = true; selectedObjectIndex = Random.Range(0, storedGameObjects.Count); currentSelectedObject = storedGameObjects[selectedObjectIndex]; currentSelectedObject.SetActive(true); } private IEnumerator SelectObjectSlow() { Debug.Log((object)"SelectingObjectSlow"); switchingObject = true; selectedObjectIndex = Random.Range(0, storedGameObjects.Count - 1); Debug.Log((object)("SelectedMag: " + selectedObjectIndex)); currentSelectedObject = storedGameObjects[selectedObjectIndex]; Debug.Log((object)("SelectedMagObject: " + (object)currentSelectedObject)); currentSelectedObject.SetActive(true); Debug.Log((object)("SelectedMagObject Active: " + currentSelectedObject.activeSelf)); yield return (object)new WaitForSeconds(0.25f); Debug.Log((object)("SelectedMagObject: " + (object)currentSelectedObject)); Debug.Log((object)"Checking hand"); Debug.Log((object)("StoredObjects: " + storedGameObjects)); Debug.Log((object)("StoredObjects: " + storedGameObjects.Count)); Debug.Log((object)("SelectedMag: " + selectedObjectIndex)); Debug.Log((object)("SelectedMagObject: " + (object)storedGameObjects[selectedObjectIndex])); currentSelectedObject = storedGameObjects[selectedObjectIndex]; Debug.Log((object)("SelectedMagObject: " + (object)currentSelectedObject)); FVRFireArmMagazine component = currentSelectedObject.GetComponent<FVRFireArmMagazine>(); Debug.Log((object)("SelectedMagMag: " + (object)component)); if (((FVRInteractiveObject)component).IsHeld) { Debug.Log((object)"isHeld"); storedGameObjects.RemoveAt(selectedObjectIndex); Debug.Log((object)"RemovedMagFromStorage"); SM.PlayGenericSound(extractSound, ((Component)this).transform.position); } else { Debug.Log((object)"!isHeld"); currentSelectedObject.SetActive(false); } Debug.Log((object)"SelectingObjectSlow End"); switchingObject = false; } private IEnumerator SelectObjectInstantly() { switchingObject = true; selectedObjectIndex = Random.Range(0, storedGameObjects.Count - 1); currentSelectedObject = storedGameObjects[selectedObjectIndex]; currentSelectedObject.SetActive(true); yield return (object)new WaitForEndOfFrame(); switchingObject = false; } }
monomod/Assembly-CSharp.MagazineScripts.mm.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using On.FistVR; using OpenScripts2; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MagazineScripts")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MagazineScripts")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f69e0da0-7ca5-44f7-ad21-e51d241ed7b2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class FireArmMagGrabTrigger : FVRInteractiveObject { public FVRFireArm FireArm; public override void Awake() { ((Component)this).gameObject.SetActive(false); ((Component)this).gameObject.AddComponent<UniversalMagazineGrabTrigger>().FireArm = FireArm; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class MagazineCutoff_Auto5 : FVRInteractiveObject { public enum TranslationType { Translation, Rotation } public enum Axis { X, Y, Z } [Header("Magazine Cutoff Config")] public TubeFedShotgun fireArm; public Transform cutoffLever; public float startLimit; public float stopLimit; public float speed; public TranslationType translationType; public Axis axis; [Header("Sound")] public AudioEvent sounds; private Vector3 startPos; private Vector3 stopPos; private Quaternion startRot; private Quaternion stopRot; private bool isMoving; private bool isActive; public override void Start() { ((FVRInteractiveObject)this).Start(); CalculatePositions(); } public override void SimpleInteraction(FVRViveHand hand) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); isActive = !isActive; SM.PlayGenericSound(sounds, cutoffLever.position); switch (translationType) { case TranslationType.Translation: if (isMoving) { ((MonoBehaviour)this).StopAllCoroutines(); } ((MonoBehaviour)this).StartCoroutine(Activate_Translation()); break; case TranslationType.Rotation: if (isMoving) { ((MonoBehaviour)this).StopAllCoroutines(); } ((MonoBehaviour)this).StartCoroutine(Activate_Rotation()); break; } } private void CalculatePositions() { //IL_003d: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01f5: 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_0204: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) switch (translationType) { case TranslationType.Translation: switch (axis) { case Axis.X: startPos = new Vector3(startLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); stopPos = new Vector3(stopLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); break; case Axis.Y: startPos = new Vector3(cutoffLever.localPosition.x, startLimit, cutoffLever.localPosition.z); stopPos = new Vector3(cutoffLever.localPosition.x, stopLimit, cutoffLever.localPosition.z); break; case Axis.Z: startPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, startLimit); stopPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, stopLimit); break; default: startPos = default(Vector3); stopPos = default(Vector3); break; } cutoffLever.localPosition = startPos; break; case TranslationType.Rotation: switch (axis) { case Axis.X: startRot = Quaternion.Euler(startLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); stopRot = Quaternion.Euler(stopLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); break; case Axis.Y: startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, startLimit, cutoffLever.localEulerAngles.z); stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, stopLimit, cutoffLever.localEulerAngles.z); break; case Axis.Z: startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, startLimit); stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, stopLimit); break; default: startRot = Quaternion.identity; stopRot = Quaternion.identity; break; } cutoffLever.localRotation = startRot; break; } } private IEnumerator Activate_Translation() { isMoving = true; Vector3 target = (isActive ? stopPos : startPos); while (cutoffLever.localPosition != target) { cutoffLever.localPosition = Vector3.MoveTowards(cutoffLever.localPosition, target, speed * Time.deltaTime); yield return null; } Activate_Magazine(); isMoving = false; } private IEnumerator Activate_Rotation() { isMoving = true; Quaternion target = (isActive ? stopRot : startRot); while (cutoffLever.localRotation != target) { cutoffLever.localRotation = Quaternion.RotateTowards(cutoffLever.localRotation, target, speed * Time.deltaTime); yield return null; } Activate_Magazine(); isMoving = false; } private void Activate_Magazine() { if (isActive) { ((FVRFireArm)fireArm).Magazine.IsExtractable = false; return; } ((FVRFireArm)fireArm).Magazine.IsExtractable = true; if (fireArm.Bolt.m_isBoltLocked) { fireArm.ExtractRound(); fireArm.TransferShellToUpperTrack(); fireArm.Bolt.ReleaseBolt(); } } } public class MagazineCutoff : FVRInteractiveObject { public enum TranslationType { Translation, Rotation } public enum Axis { X, Y, Z } [Header("Magazine Cutoff Config")] public FVRFireArm fireArm; public Transform cutoffLever; public float startLimit; public float stopLimit; public float speed; public TranslationType translationType; public Axis axis; [Header("Sound")] public AudioEvent sounds; private Vector3 _startPos; private Vector3 _stopPos; private Quaternion _startRot; private Quaternion _stopRot; private bool _magazineCuttoffActive; private FVRFireArmMagazine _mag; private Quaternion _targetRotation; private Vector3 _targetPosition; public override void Start() { ((FVRInteractiveObject)this).Start(); CalculatePositions(); } public override void SimpleInteraction(FVRViveHand hand) { //IL_0022: 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_0045: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); _magazineCuttoffActive = !_magazineCuttoffActive; SM.PlayGenericSound(sounds, cutoffLever.position); switch (translationType) { case TranslationType.Translation: _targetPosition = (_magazineCuttoffActive ? _stopPos : _startPos); break; case TranslationType.Rotation: _targetRotation = (_magazineCuttoffActive ? _stopRot : _startRot); break; } } public override void FVRUpdate() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (_magazineCuttoffActive && (Object)(object)_mag != (Object)null) { if ((Object)(object)_mag.FireArm == (Object)(object)fireArm) { _mag.IsExtractable = false; } else { _mag.IsExtractable = true; _mag = null; } } else if (!_magazineCuttoffActive && (Object)(object)_mag != (Object)null) { _mag.IsExtractable = true; } _mag = fireArm.Magazine; if (translationType == TranslationType.Rotation && cutoffLever.localRotation != _targetRotation) { cutoffLever.localRotation = Quaternion.RotateTowards(cutoffLever.localRotation, _targetRotation, speed * Time.deltaTime); } else if (translationType == TranslationType.Translation && cutoffLever.localPosition != _targetPosition) { cutoffLever.localPosition = Vector3.MoveTowards(cutoffLever.localPosition, _targetPosition, speed * Time.deltaTime); } } private void CalculatePositions() { //IL_003d: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01f5: 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_0204: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) switch (translationType) { case TranslationType.Translation: switch (axis) { case Axis.X: _startPos = new Vector3(startLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); _stopPos = new Vector3(stopLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); break; case Axis.Y: _startPos = new Vector3(cutoffLever.localPosition.x, startLimit, cutoffLever.localPosition.z); _stopPos = new Vector3(cutoffLever.localPosition.x, stopLimit, cutoffLever.localPosition.z); break; case Axis.Z: _startPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, startLimit); _stopPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, stopLimit); break; default: _startPos = default(Vector3); _stopPos = default(Vector3); break; } cutoffLever.localPosition = _startPos; break; case TranslationType.Rotation: switch (axis) { case Axis.X: _startRot = Quaternion.Euler(startLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); _stopRot = Quaternion.Euler(stopLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); break; case Axis.Y: _startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, startLimit, cutoffLever.localEulerAngles.z); _stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, stopLimit, cutoffLever.localEulerAngles.z); break; case Axis.Z: _startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, startLimit); _stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, stopLimit); break; default: _startRot = Quaternion.identity; _stopRot = Quaternion.identity; break; } cutoffLever.localRotation = _startRot; break; } } } public class ForceMagazineMountingToMagMountPos : MonoBehaviour { public FVRFireArm fireArm; private bool posChanged; public void Awake() { ((Component)this).gameObject.SetActive(false); ((Component)this).gameObject.AddComponent<ForceMagazineMountingToMagMountPos>().FireArm = fireArm; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } internal class MagSafety : MonoBehaviour { public FVRFireArm fireArm; public int SafetyFireModePosition; private int lastFireMode; private bool magSafetyEngaged; public void Awake() { } public void Update() { FVRFireArm val = fireArm; OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val2 == null) { ClosedBoltWeapon val3 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val3 == null) { BoltActionRifle val4 = (BoltActionRifle)(object)((val is BoltActionRifle) ? val : null); if (val4 != null) { CheckState(val4); } } else { CheckState(val3); } } else { CheckState(val2); } } private void CheckState(OpenBoltReceiver s) { if ((Object)(object)((FVRFireArm)s).Magazine == (Object)null && s.m_fireSelectorMode != SafetyFireModePosition) { lastFireMode = s.m_fireSelectorMode; s.m_fireSelectorMode = SafetyFireModePosition; magSafetyEngaged = true; } else if ((Object)(object)((FVRFireArm)s).Magazine != (Object)null && magSafetyEngaged) { s.m_fireSelectorMode = lastFireMode; magSafetyEngaged = false; } } private void CheckState(ClosedBoltWeapon s) { if ((Object)(object)((FVRFireArm)s).Magazine == (Object)null && s.m_fireSelectorMode != SafetyFireModePosition) { lastFireMode = s.m_fireSelectorMode; s.m_fireSelectorMode = SafetyFireModePosition; magSafetyEngaged = true; } else if ((Object)(object)((FVRFireArm)s).Magazine != (Object)null && magSafetyEngaged) { s.m_fireSelectorMode = lastFireMode; magSafetyEngaged = false; } } private void CheckState(BoltActionRifle s) { if ((Object)(object)((FVRFireArm)s).Magazine == (Object)null && s.m_fireSelectorMode != SafetyFireModePosition) { lastFireMode = s.m_fireSelectorMode; s.m_fireSelectorMode = SafetyFireModePosition; magSafetyEngaged = true; } else if ((Object)(object)((FVRFireArm)s).Magazine != (Object)null && magSafetyEngaged) { s.m_fireSelectorMode = lastFireMode; magSafetyEngaged = false; } } } public class AutomaticStripperClip : MonoBehaviour { public FVRFireArmClip Clip; [Tooltip("Delay in Seconds. If equal to 0, all rounds will be loaded at the same time.")] public float DelayBetweenRounds; private bool _loadingRounds; public void Awake() { ((Component)this).gameObject.SetActive(false); AutomaticStripperClip obj = ((Component)this).gameObject.AddComponent<AutomaticStripperClip>(); obj.Clip = Clip; obj.DelayBetweenRounds = DelayBetweenRounds; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class MultiCaliberMagazine : MonoBehaviour { [Serializable] public class CaliberDefinition { [SearchableEnum] public FireArmRoundType RoundType; public int capacity; public GameObject[] DisplayBullets; public MeshFilter[] DisplayMeshFilters; public Renderer[] DisplayRenderers; [SearchableEnum] public FVRFireArmMechanicalAccuracyClass accuracyClass; public FVRFireArmRecoilProfile recoilProfile; public FVRFireArmRecoilProfile recoilProfileStocked; [Tooltip("Only replaces firing sounds!")] public FVRFirearmAudioSet ReplacementFiringSounds; public FVRObject objectWrapper; } public FVRFireArmMagazine magazine; public CaliberDefinition[] caliberDefinitions; [Header("Text field that shows current selected caliber on switching calibers manually.")] public GameObject canvas; public Text text; public bool alwaysShowText; public int currentCaliberDefinition; [Tooltip("Only allows insertion of mag into firearm if the caliber of the mag and the gun are equal")] public bool checksFirearmCompatibility; [Header("MeatKit required stuff. Use ContextMenu to populate.")] [SearchableEnum] public FireArmRoundType[] roundTypes; public int[] capacities; public GameObject[][] DisplayBulletss; public MeshFilter[][] DisplayMeshFilterss; public Renderer[][] DisplayRendererss; [SearchableEnum] public FVRFireArmMechanicalAccuracyClass[] accuracyClasses; public FVRFireArmRecoilProfile[] recoilProfiles; public FVRFireArmRecoilProfile[] recoilProfilesStocked; [Tooltip("Only replaces firing sounds!")] public FVRFirearmAudioSet[] ReplacementFiringSoundss; public FVRObject[] objectWrappers; public bool isMeatKit; private FVRFireArm _fireArm; private List<CaliberDefinition> _caliberDefinitionsList; private FVRFireArmMechanicalAccuracyClass _origAccuracyClass; private FVRFireArmRecoilProfile _origRecoilProfile; private FVRFireArmRecoilProfile _origRecoilProfileStocked; private AudioEvent _origFiringSounds; private AudioEvent _origSuppressedSounds; private AudioEvent _origLowPressureSounds; private bool _isDebug = true; [ContextMenu("Populate MeatKit Lists")] public void PopulateMeatKitLists() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected I4, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected I4, but got Unknown int num = caliberDefinitions.Length; roundTypes = (FireArmRoundType[])(object)new FireArmRoundType[num]; capacities = new int[num]; DisplayBulletss = new GameObject[num][]; DisplayMeshFilterss = new MeshFilter[num][]; DisplayRendererss = new Renderer[num][]; accuracyClasses = (FVRFireArmMechanicalAccuracyClass[])(object)new FVRFireArmMechanicalAccuracyClass[num]; recoilProfiles = (FVRFireArmRecoilProfile[])(object)new FVRFireArmRecoilProfile[num]; recoilProfilesStocked = (FVRFireArmRecoilProfile[])(object)new FVRFireArmRecoilProfile[num]; ReplacementFiringSoundss = (FVRFirearmAudioSet[])(object)new FVRFirearmAudioSet[num]; objectWrappers = (FVRObject[])(object)new FVRObject[num]; for (int i = 0; i < num; i++) { roundTypes[i] = (FireArmRoundType)(int)caliberDefinitions[i].RoundType; capacities[i] = caliberDefinitions[i].capacity; DisplayBulletss[i] = caliberDefinitions[i].DisplayBullets; DisplayMeshFilterss[i] = caliberDefinitions[i].DisplayMeshFilters; DisplayRendererss[i] = caliberDefinitions[i].DisplayRenderers; accuracyClasses[i] = (FVRFireArmMechanicalAccuracyClass)(int)caliberDefinitions[i].accuracyClass; recoilProfiles[i] = caliberDefinitions[i].recoilProfile; recoilProfilesStocked[i] = caliberDefinitions[i].recoilProfileStocked; ReplacementFiringSoundss[i] = caliberDefinitions[i].ReplacementFiringSounds; objectWrappers[i] = caliberDefinitions[i].objectWrapper; } if (_isDebug) { GameObject[][] displayBulletss = DisplayBulletss; foreach (GameObject[] array in displayBulletss) { foreach (GameObject val in array) { Debug.Log((object)("DisplayBullets: " + ((Object)val).name)); } } } isMeatKit = true; } public void Awake() { Hook(); } public void Start() { if (!isMeatKit) { _caliberDefinitionsList = new List<CaliberDefinition>(caliberDefinitions); } else { _caliberDefinitionsList = CreateListFromMeatKitDefines(); } PrepareCaliberDefinitions(); if (!alwaysShowText && (Object)(object)canvas != (Object)null) { canvas.SetActive(false); } } public void OnDestroy() { Unhook(); } public void Update() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Invalid comparison between Unknown and I4 //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0301: 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) FVRViveHand hand = ((FVRInteractiveObject)magazine).m_hand; if ((Object)(object)hand != (Object)null && magazine.m_numRounds == 0 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { NextCartridge(); if (!alwaysShowText && (Object)(object)text != (Object)null) { ((MonoBehaviour)this).StopCoroutine("ShowCaliberText"); ((MonoBehaviour)this).StartCoroutine("ShowCaliberText"); } } if ((int)magazine.State == 1 && (Object)(object)_fireArm == (Object)null) { _fireArm = magazine.FireArm; _origAccuracyClass = _fireArm.AccuracyClass; _origRecoilProfile = _fireArm.RecoilProfile; _origRecoilProfileStocked = _fireArm.RecoilProfileStocked; _origFiringSounds = _fireArm.AudioClipSet.Shots_Main; _origSuppressedSounds = _fireArm.AudioClipSet.Shots_Suppressed; _origLowPressureSounds = _fireArm.AudioClipSet.Shots_LowPressure; if ((int)_caliberDefinitionsList[currentCaliberDefinition].accuracyClass != 0) { _fireArm.AccuracyClass = _caliberDefinitionsList[currentCaliberDefinition].accuracyClass; } if ((Object)(object)_caliberDefinitionsList[currentCaliberDefinition].recoilProfile != (Object)null) { _fireArm.RecoilProfile = _caliberDefinitionsList[currentCaliberDefinition].recoilProfile; } if ((Object)(object)_caliberDefinitionsList[currentCaliberDefinition].recoilProfileStocked != (Object)null) { _fireArm.RecoilProfileStocked = _caliberDefinitionsList[currentCaliberDefinition].recoilProfileStocked; } if ((Object)(object)_caliberDefinitionsList[currentCaliberDefinition].ReplacementFiringSounds != (Object)null) { ReplaceFiringSounds(_caliberDefinitionsList[currentCaliberDefinition].ReplacementFiringSounds); } } else if ((int)magazine.State == 0 && (Object)(object)_fireArm != (Object)null) { _fireArm.AccuracyClass = _origAccuracyClass; _fireArm.RecoilProfile = _origRecoilProfile; _fireArm.RecoilProfileStocked = _origRecoilProfileStocked; _fireArm.AudioClipSet.Shots_Main = _origFiringSounds; _fireArm.AudioClipSet.Shots_Suppressed = _origSuppressedSounds; _fireArm.AudioClipSet.Shots_LowPressure = _origLowPressureSounds; _fireArm = null; } else if ((int)magazine.State == 1 && (Object)(object)_fireArm != (Object)null && _fireArm.RoundType != _caliberDefinitionsList[currentCaliberDefinition].RoundType && !SetCartridge(_fireArm.RoundType) && magazine.m_numRounds == 0 && checksFirearmCompatibility) { _fireArm.EjectMag(false); } if (alwaysShowText && (Object)(object)text != (Object)null) { FireArmRoundType roundType = _caliberDefinitionsList[currentCaliberDefinition].RoundType; if (AM.SRoundDisplayDataDic.ContainsKey(roundType)) { string displayName = AM.SRoundDisplayDataDic[roundType].DisplayName; text.text = displayName; } } } public void NextCartridge() { currentCaliberDefinition++; if (currentCaliberDefinition >= _caliberDefinitionsList.Count) { currentCaliberDefinition = 0; } ConfigureMagazine(currentCaliberDefinition); } public bool SetCartridge(FireArmRoundType fireArmRoundType) { //IL_0026: 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) if (magazine.m_numRounds != 0) { return false; } int num = 0; using (List<CaliberDefinition>.Enumerator enumerator = _caliberDefinitionsList.GetEnumerator()) { while (enumerator.MoveNext() && enumerator.Current.RoundType != fireArmRoundType) { num++; } } if (num == _caliberDefinitionsList.Count) { return false; } ConfigureMagazine(num); currentCaliberDefinition = num; return true; } public void ConfigureMagazine(int CaliberDefinitionIndex) { //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_0086: 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_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) magazine.RoundType = _caliberDefinitionsList[CaliberDefinitionIndex].RoundType; if (_caliberDefinitionsList[CaliberDefinitionIndex].capacity > 0) { magazine.m_capacity = _caliberDefinitionsList[CaliberDefinitionIndex].capacity; } if (_caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets.Length != 0) { magazine.m_roundInsertionTarget.localPosition = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[0].transform.localPosition; magazine.m_roundInsertionTarget.localRotation = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[0].transform.localRotation; magazine.DisplayBullets = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets; magazine.DisplayMeshFilters = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayMeshFilters; magazine.DisplayRenderers = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayRenderers; magazine.m_DisplayStartPositions = (Vector3[])(object)new Vector3[_caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets.Length]; for (int i = 0; i < _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets.Length; i++) { if ((Object)(object)_caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[i] != (Object)null) { magazine.m_DisplayStartPositions[i] = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[i].transform.localPosition; } } } ((FVRPhysicalObject)magazine).ObjectWrapper = _caliberDefinitionsList[CaliberDefinitionIndex].objectWrapper; } public void ReplaceFiringSounds(FVRFirearmAudioSet set) { if (set.Shots_Main.Clips.Count > 0) { _fireArm.AudioClipSet.Shots_Main = set.Shots_Main; } if (set.Shots_Suppressed.Clips.Count > 0) { _fireArm.AudioClipSet.Shots_Suppressed = set.Shots_Suppressed; } if (set.Shots_LowPressure.Clips.Count > 0) { _fireArm.AudioClipSet.Shots_LowPressure = set.Shots_LowPressure; } } public void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown FVRFireArmRound.OnTriggerEnter -= new hook_OnTriggerEnter(FVRFireArmRound_OnTriggerEnter); if (checksFirearmCompatibility) { FVRFireArmReloadTriggerMag.OnTriggerEnter -= new hook_OnTriggerEnter(FVRFireArmReloadTriggerMag_OnTriggerEnter); } } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown FVRFireArmRound.OnTriggerEnter += new hook_OnTriggerEnter(FVRFireArmRound_OnTriggerEnter); if (checksFirearmCompatibility) { FVRFireArmReloadTriggerMag.OnTriggerEnter += new hook_OnTriggerEnter(FVRFireArmReloadTriggerMag_OnTriggerEnter); } } private void FVRFireArmReloadTriggerMag_OnTriggerEnter(orig_OnTriggerEnter orig, FVRFireArmReloadTriggerMag self, Collider collider) { //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_00f6: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)magazine == (Object)(object)self.Magazine) { if (!((Object)(object)self.Magazine != (Object)null) || !((Object)(object)self.Magazine.FireArm == (Object)null) || !((Object)(object)((FVRPhysicalObject)self.Magazine).QuickbeltSlot == (Object)null) || !(((Component)collider).gameObject.tag == "FVRFireArmReloadTriggerWell")) { return; } FVRFireArmReloadTriggerWell component = ((Component)collider).gameObject.GetComponent<FVRFireArmReloadTriggerWell>(); bool flag = false; if ((Object)(object)component != (Object)null && !self.Magazine.IsBeltBox && component.FireArm.HasBelt) { flag = true; } if (!(!((Object)(object)component != (Object)null) || component.IsBeltBox != self.Magazine.IsBeltBox || !((Object)(object)component.FireArm != (Object)null) || !((Object)(object)component.FireArm.Magazine == (Object)null) || flag)) { FireArmMagazineType val = component.FireArm.MagazineType; if (component.UsesTypeOverride) { val = component.TypeOverride; } if (val == self.Magazine.MagazineType && (!((double)component.FireArm.EjectDelay > 0.0) || (Object)(object)self.Magazine != (Object)(object)component.FireArm.LastEjectedMag) && (Object)(object)component.FireArm.Magazine == (Object)null && (!checksFirearmCompatibility || magazine.RoundType == component.FireArm.RoundType)) { self.Magazine.Load(component.FireArm); } } } else { orig.Invoke(self, collider); } } private void FVRFireArmRound_OnTriggerEnter(orig_OnTriggerEnter orig, FVRFireArmRound self, Collider collider) { //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) if (self.IsSpent) { return; } if (self.isManuallyChamberable && !self.IsSpent && (Object)(object)self.HoveredOverChamber == (Object)null && (Object)(object)self.m_hoverOverReloadTrigger == (Object)null && !self.IsSpent && ((Component)collider).gameObject.CompareTag("FVRFireArmChamber")) { FVRFireArmChamber component = ((Component)collider).gameObject.GetComponent<FVRFireArmChamber>(); if (component.RoundType == self.RoundType && component.IsManuallyChamberable && component.IsAccessible && !component.IsFull) { self.HoveredOverChamber = component; } } if (self.isMagazineLoadable && (Object)(object)self.HoveredOverChamber == (Object)null && !self.IsSpent && ((Component)collider).gameObject.CompareTag("FVRFireArmMagazineReloadTrigger")) { FVRFireArmMagazineReloadTrigger component2 = ((Component)collider).gameObject.GetComponent<FVRFireArmMagazineReloadTrigger>(); if (component2.IsClipTrigger) { if ((Object)(object)component2 != (Object)null && (Object)(object)component2.Clip != (Object)null && component2.Clip.RoundType == self.RoundType && !component2.Clip.IsFull() && ((Object)(object)component2.Clip.FireArm == (Object)null || component2.Clip.IsDropInLoadable)) { self.m_hoverOverReloadTrigger = component2; } } else if (component2.IsSpeedloaderTrigger) { if (!component2.SpeedloaderChamber.IsLoaded) { self.m_hoverOverReloadTrigger = component2; } } else if ((Object)(object)component2 != (Object)null && (Object)(object)component2.Magazine != (Object)null && component2.Magazine.RoundType == self.RoundType && !component2.Magazine.IsFull() && ((Object)(object)component2.Magazine.FireArm == (Object)null || component2.Magazine.IsDropInLoadable)) { self.m_hoverOverReloadTrigger = component2; } else if ((Object)(object)component2 != (Object)null && (Object)(object)component2.Magazine == (Object)(object)magazine && !component2.Magazine.IsFull() && ((Object)(object)component2.Magazine.FireArm == (Object)null || component2.Magazine.IsDropInLoadable) && ((Component)component2.Magazine).GetComponent<MultiCaliberMagazine>().SetCartridge(self.RoundType)) { self.m_hoverOverReloadTrigger = component2; } } if (self.isPalmable && self.ProxyRounds.Count < self.MaxPalmedAmount && !self.IsSpent && ((Component)collider).gameObject.CompareTag("FVRFireArmRound")) { FVRFireArmRound component3 = ((Component)collider).gameObject.GetComponent<FVRFireArmRound>(); if (component3.RoundType == self.RoundType && !component3.IsSpent && (Object)(object)((FVRPhysicalObject)component3).QuickbeltSlot == (Object)null) { self.HoveredOverRound = component3; } } } public IEnumerator ShowCaliberText() { FireArmRoundType roundType = _caliberDefinitionsList[currentCaliberDefinition].RoundType; if (AM.SRoundDisplayDataDic.ContainsKey(roundType)) { string displayName = AM.SRoundDisplayDataDic[roundType].DisplayName; text.text = displayName; canvas.SetActive(true); yield return (object)new WaitForSeconds(1f); } canvas.SetActive(false); yield return null; } private void PrepareCaliberDefinitions() { CaliberDefinition[] array = caliberDefinitions; foreach (CaliberDefinition caliberDefinition in array) { for (int j = 0; j < caliberDefinition.DisplayMeshFilters.Length; j++) { if (!magazine.DisplayMeshFilters.Contains(caliberDefinition.DisplayMeshFilters[j])) { caliberDefinition.DisplayMeshFilters[j].mesh = null; } } for (int k = 0; k < caliberDefinition.DisplayRenderers.Length; k++) { if (!magazine.DisplayRenderers.Contains(caliberDefinition.DisplayRenderers[k])) { caliberDefinition.DisplayRenderers[k].material = null; } } } } private List<CaliberDefinition> CreateListFromMeatKitDefines() { //IL_001b: 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) List<CaliberDefinition> result = new List<CaliberDefinition>(); for (int i = 0; i < roundTypes.Length; i++) { new CaliberDefinition { RoundType = roundTypes[i], capacity = capacities[i], DisplayBullets = DisplayBulletss[i], DisplayMeshFilters = DisplayMeshFilterss[i], DisplayRenderers = DisplayRendererss[i], accuracyClass = accuracyClasses[i], recoilProfile = recoilProfiles[i], recoilProfileStocked = recoilProfilesStocked[i], objectWrapper = objectWrappers[i] }; } return result; } }
monomod/Assembly-CSharp.MeatBeatScanner.mm.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MeatBeatScanner")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MeatBeatScanner")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3f33c54a-7bcb-4398-8643-82ab4c47c6f8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class MeatBeatScanner : FVRFireArmAttachment { [Header("MeatBeat Scanner Config")] public float range; public float EngageAngle; public RectTransform currentScreen; public GameObject pingDotReference; public LayerMask LatchingMask; public bool canRotateScreen; [Tooltip("Different Screen orientations")] public GameObject[] images; private Dictionary<SosigLink, GameObject> pings; private GameObject directionReference; private int currentImage; public override void Awake() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArmAttachment)this).Awake(); pingDotReference.SetActive(false); pings = new Dictionary<SosigLink, GameObject>(); directionReference = new GameObject("MeatBeatScanner DirectionReference"); directionReference.transform.parent = ((Component)this).transform; directionReference.transform.localPosition = default(Vector3); if (canRotateScreen) { currentScreen = images[0].GetComponent<RectTransform>(); } } public override void Start() { ((FVRInteractiveObject)this).Start(); } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if (canRotateScreen && (Object)(object)base.curMount != (Object)null && (Object)(object)((FVRInteractiveObject)base.AttachmentInterface).m_hand != (Object)null) { UpdateInputs(((FVRInteractiveObject)base.AttachmentInterface).m_hand); } UpdateScreen(); } public override void UpdateInteraction(FVRViveHand hand) { ((FVRFireArmAttachment)this).UpdateInteraction(hand); if (canRotateScreen) { UpdateInputs(hand); } } public void UpdateScreen() { //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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_006c: 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_00d5: 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_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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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) List<SosigLink> list = FindSosigs(); ClearPings(list); Vector3 val3 = default(Vector3); foreach (SosigLink item in list) { Vector3 position = ((Component)item).transform.position; Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.forward, Vector3.up); directionReference.transform.rotation = Quaternion.LookRotation(val, Vector3.up); Vector3 val2 = directionReference.transform.InverseTransformPoint(position); _ = ((Vector3)(ref val2)).magnitude; if (!pings.TryGetValue(item, out var value)) { value = Object.Instantiate<GameObject>(pingDotReference); value.transform.SetParent((Transform)(object)currentScreen); pings.Add(item, value); } ((Vector3)(ref val3))..ctor(0f, 0f, -0.0001f); Rect rect = currentScreen.rect; float num = ((Rect)(ref rect)).width / 2f; rect = currentScreen.rect; float height = ((Rect)(ref rect)).height; float num2 = Mathf.Max(num, height); val3.x = val2.x / range * num2; val3.y = val2.z / range * num2; if (Mathf.Abs(val3.x) > num || Mathf.Abs(val3.y) > height) { value.SetActive(false); } else { value.SetActive(true); } value.transform.localPosition = val3; value.transform.localRotation = pingDotReference.transform.localRotation; value.transform.localScale = pingDotReference.transform.localScale; } } private List<SosigLink> FindSosigs() { //IL_000c: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Invalid comparison between Unknown and I4 //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) List<SosigLink> list = new List<SosigLink>(); Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, range, LayerMask.op_Implicit(LatchingMask)); List<Rigidbody> list2 = new List<Rigidbody>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].attachedRigidbody != (Object)null && !list2.Contains(array[i].attachedRigidbody)) { list2.Add(array[i].attachedRigidbody); } } SosigLink val = null; float num = EngageAngle / 2f; for (int j = 0; j < list2.Count; j++) { SosigLink component = ((Component)list2[j]).GetComponent<SosigLink>(); if (!((Object)(object)component == (Object)null) && (int)component.S.BodyState != 3) { Vector3 val2 = ((Component)component).transform.position - ((Component)this).transform.position; float num2; try { num2 = Vector3.Angle(new Vector3(((Component)this).transform.forward.x, 0f, ((Component)this).transform.forward.z), new Vector3(val2.x, 0f, val2.z)); } catch (Exception) { num2 = 360f; } val = component.S.Links[0]; if (num2 < num && !list.Contains(val)) { list.Add(val); } } } return list; } private void ClearPings(List<SosigLink> sosigs) { if (pings == null) { pings = new Dictionary<SosigLink, GameObject>(); } if (sosigs.Count > 0) { for (int i = 0; i < pings.Count; i++) { SosigLink key = pings.ElementAt(i).Key; if (!sosigs.Contains(key)) { pings.TryGetValue(key, out var value); Object.Destroy((Object)(object)value); pings.Remove(key); } } return; } foreach (KeyValuePair<SosigLink, GameObject> ping in pings) { Object.Destroy((Object)(object)ping.Value); } pings.Clear(); } private void UpdateInputs(FVRViveHand hand) { //IL_001b: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!hand.IsInStreamlinedMode) { if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { NextRotation(); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { PreviousRotation(); } } else if (hand.Input.BYButtonDown) { NextRotation(); } } private void NextRotation() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) currentImage++; if (currentImage >= images.Length) { currentImage = 0; } for (int i = 0; i < images.Length; i++) { images[i].SetActive(i == currentImage); } currentScreen = images[currentImage].GetComponent<RectTransform>(); foreach (KeyValuePair<SosigLink, GameObject> ping in pings) { Vector3 localPosition = ping.Value.transform.localPosition; ping.Value.transform.SetParent((Transform)(object)currentScreen); ping.Value.transform.localPosition = localPosition; } } private void PreviousRotation() { //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_00b3: Unknown result type (might be due to invalid IL or missing references) currentImage--; if (currentImage < 0) { currentImage = images.Length - 1; } for (int i = 0; i < images.Length; i++) { images[i].SetActive(i == currentImage); } currentScreen = images[currentImage].GetComponent<RectTransform>(); foreach (KeyValuePair<SosigLink, GameObject> ping in pings) { Vector3 localPosition = ping.Value.transform.localPosition; ping.Value.transform.SetParent((Transform)(object)currentScreen); ping.Value.transform.localPosition = localPosition; } } }
monomod/Assembly-CSharp.MeatyPages.mm.dll
Decompiled 10 months agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MeatyPages")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MeatyPages")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6611fe91-3e6d-4e72-8581-926f9d531c5b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class Booklet : FVRPhysicalObject { [Header("Booklet Config")] public GameObject[] pages; public float startAngle; public float flipAngle = 180f; public float flipSpeed = 180f; public Axis pageAxis; [Header("Booklet Sounds")] public AudioEvent flipPageLeft; public AudioEvent flipPageRight; public AudioEvent closeBooklet; private int currentPage; private bool isFlipping; private bool isClosing; public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); UpdateInputsAndAnimate(hand); } private void UpdateInputsAndAnimate(FVRViveHand hand) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hand != (Object)null) { if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { FlipLeft(); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { FlipRight(); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { CloseBooklet(); } } } private void FlipLeft() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!isClosing && currentPage < pages.Length) { SM.PlayGenericSound(flipPageLeft, ((Component)this).transform.position); if (isFlipping) { ((MonoBehaviour)this).StopAllCoroutines(); pages[currentPage - 1].transform.localRotation = Quaternion.Euler(GetRotationalVector(flipAngle)); } ((MonoBehaviour)this).StartCoroutine(FlipPage(pages[currentPage], flipAngle)); currentPage++; } } private void FlipRight() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!isClosing && currentPage > 0) { SM.PlayGenericSound(flipPageRight, ((Component)this).transform.position); if (isFlipping) { ((MonoBehaviour)this).StopAllCoroutines(); pages[currentPage].transform.localRotation = Quaternion.Euler(GetRotationalVector(startAngle)); } ((MonoBehaviour)this).StartCoroutine(FlipPage(pages[currentPage - 1], startAngle)); currentPage--; } } private void CloseBooklet() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!isClosing) { SM.PlayGenericSound(closeBooklet, ((Component)this).transform.position); if (isFlipping) { ((MonoBehaviour)this).StopAllCoroutines(); } ((MonoBehaviour)this).StartCoroutine(ClosingBooklet()); currentPage = 0; } } private IEnumerator FlipPage(GameObject page, float angle) { isFlipping = true; Vector3 rotationalVector = GetRotationalVector(angle); Quaternion targetRotation = Quaternion.Euler(rotationalVector); while (page.transform.localRotation != targetRotation) { page.transform.localRotation = Quaternion.RotateTowards(page.transform.localRotation, targetRotation, flipSpeed * Time.deltaTime); yield return null; } isFlipping = false; } private IEnumerator ClosingBooklet() { isClosing = true; for (int i = 0; i < pages.Length; i++) { ((MonoBehaviour)this).StartCoroutine(FlipPage(pages[i], startAngle)); yield return null; } isClosing = false; } private Vector3 GetRotationalVector(float angle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected I4, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Axis val = pageAxis; Vector3 result = default(Vector3); switch ((int)val) { case 0: ((Vector3)(ref result))..ctor(angle, 0f, 0f); break; case 1: ((Vector3)(ref result))..ctor(0f, angle, 0f); break; case 2: ((Vector3)(ref result))..ctor(0f, 0f, angle); break; default: result = default(Vector3); break; } return result; } }
monomod/Assembly-CSharp.MeshCombiner_MonoMod.mm.dll
Decompiled 10 months agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MeshCombiner_MonoMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MeshCombiner_MonoMod")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3ecd94ca-c837-4aa2-8603-f2e2e904e7fd")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [RequireComponent(typeof(MeshFilter))] [RequireComponent(typeof(MeshRenderer))] public class MeshCombiner : MonoBehaviour { private const int Mesh16BitBufferVertexLimit = 65535; [SerializeField] private bool createMultiMaterialMesh; [SerializeField] private bool combineInactiveChildren; [SerializeField] private bool deactivateCombinedChildren = true; [SerializeField] private bool deactivateCombinedChildrenMeshRenderers; [SerializeField] private bool generateUVMap; [SerializeField] private bool destroyCombinedChildren; [SerializeField] private string folderPath = "Prefabs/CombinedMeshes"; [SerializeField] [Tooltip("MeshFilters with Meshes which we don't want to combine into one Mesh.")] private MeshFilter[] meshFiltersToSkip = (MeshFilter[])(object)new MeshFilter[0]; public bool CreateMultiMaterialMesh { get { return createMultiMaterialMesh; } set { createMultiMaterialMesh = value; } } public bool CombineInactiveChildren { get { return combineInactiveChildren; } set { combineInactiveChildren = value; } } public bool DeactivateCombinedChildren { get { return deactivateCombinedChildren; } set { deactivateCombinedChildren = value; CheckDeactivateCombinedChildren(); } } public bool DeactivateCombinedChildrenMeshRenderers { get { return deactivateCombinedChildrenMeshRenderers; } set { deactivateCombinedChildrenMeshRenderers = value; CheckDeactivateCombinedChildren(); } } public bool GenerateUVMap { get { return generateUVMap; } set { generateUVMap = value; } } public bool DestroyCombinedChildren { get { return destroyCombinedChildren; } set { destroyCombinedChildren = value; CheckDestroyCombinedChildren(); } } public string FolderPath { get { return folderPath; } set { folderPath = value; } } private void CheckDeactivateCombinedChildren() { if (deactivateCombinedChildren || deactivateCombinedChildrenMeshRenderers) { destroyCombinedChildren = false; } } private void CheckDestroyCombinedChildren() { if (destroyCombinedChildren) { deactivateCombinedChildren = false; deactivateCombinedChildrenMeshRenderers = false; } } public void CombineMeshes(bool showCreatedMeshInfo) { //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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_007c: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = ((Component)this).transform.localScale; int siblingIndex = ((Component)this).transform.GetSiblingIndex(); Transform parent = ((Component)this).transform.parent; ((Component)this).transform.parent = null; Quaternion rotation = ((Component)this).transform.rotation; Vector3 position = ((Component)this).transform.position; Vector3 localScale2 = ((Component)this).transform.localScale; ((Component)this).transform.rotation = Quaternion.identity; ((Component)this).transform.position = Vector3.zero; ((Component)this).transform.localScale = Vector3.one; if (!createMultiMaterialMesh) { CombineMeshesWithSingleMaterial(showCreatedMeshInfo); } else { CombineMeshesWithMutliMaterial(showCreatedMeshInfo); } ((Component)this).transform.rotation = rotation; ((Component)this).transform.position = position; ((Component)this).transform.localScale = localScale2; ((Component)this).transform.parent = parent; ((Component)this).transform.SetSiblingIndex(siblingIndex); ((Component)this).transform.localScale = localScale; } private MeshFilter[] GetMeshFiltersToCombine() { MeshFilter[] meshFilters = ((Component)this).GetComponentsInChildren<MeshFilter>(combineInactiveChildren); meshFiltersToSkip = meshFiltersToSkip.Where((MeshFilter meshFilter) => (Object)(object)meshFilter != (Object)(object)meshFilters[0]).ToArray(); meshFiltersToSkip = meshFiltersToSkip.Where((MeshFilter meshFilter) => (Object)(object)meshFilter != (Object)null).ToArray(); int i; for (i = 0; i < meshFiltersToSkip.Length; i++) { meshFilters = meshFilters.Where((MeshFilter meshFilter) => (Object)(object)meshFilter != (Object)(object)meshFiltersToSkip[i]).ToArray(); } return meshFilters; } private void CombineMeshesWithSingleMaterial(bool showCreatedMeshInfo) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown MeshFilter[] meshFiltersToCombine = GetMeshFiltersToCombine(); CombineInstance[] array = (CombineInstance[])(object)new CombineInstance[meshFiltersToCombine.Length - 1]; long num = 0L; for (int i = 0; i < meshFiltersToCombine.Length - 1; i++) { ((CombineInstance)(ref array[i])).subMeshIndex = 0; ((CombineInstance)(ref array[i])).mesh = meshFiltersToCombine[i + 1].sharedMesh; ((CombineInstance)(ref array[i])).transform = ((Component)meshFiltersToCombine[i + 1]).transform.localToWorldMatrix; num += ((CombineInstance)(ref array[i])).mesh.vertices.Length; } MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>(combineInactiveChildren); if (componentsInChildren.Length >= 2) { ((Renderer)componentsInChildren[0]).sharedMaterials = (Material[])(object)new Material[1]; ((Renderer)componentsInChildren[0]).sharedMaterial = ((Renderer)componentsInChildren[1]).sharedMaterial; } else { ((Renderer)componentsInChildren[0]).sharedMaterials = (Material[])(object)new Material[0]; } Mesh val = new Mesh(); ((Object)val).name = ((Object)this).name; if (num <= 65535) { val.CombineMeshes(array); GenerateUV(val); meshFiltersToCombine[0].sharedMesh = val; DeactivateCombinedGameObjects(meshFiltersToCombine); if (showCreatedMeshInfo) { Debug.Log((object)("<color=#00cc00><b>Mesh \"" + ((Object)this).name + "\" was created from " + array.Length + " children meshes and has " + num + " vertices.</b></color>")); } } else if (showCreatedMeshInfo) { Debug.Log((object)("<color=red><b>The mesh vertex limit is 65535! The created mesh had " + num + " vertices. Upgrade Unity version to 2017.3 or higher to avoid this limit (some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices).</b></color>")); } } private void CombineMeshesWithMutliMaterial(bool showCreatedMeshInfo) { //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_00e4: 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_011e: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] meshFiltersToCombine = GetMeshFiltersToCombine(); MeshRenderer[] array = (MeshRenderer[])(object)new MeshRenderer[meshFiltersToCombine.Length]; array[0] = ((Component)this).GetComponent<MeshRenderer>(); List<Material> list = new List<Material>(); for (int i = 0; i < meshFiltersToCombine.Length - 1; i++) { array[i + 1] = ((Component)meshFiltersToCombine[i + 1]).GetComponent<MeshRenderer>(); if (!((Object)(object)array[i + 1] != (Object)null)) { continue; } Material[] sharedMaterials = ((Renderer)array[i + 1]).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { if (!list.Contains(sharedMaterials[j])) { list.Add(sharedMaterials[j]); } } } List<CombineInstance> list2 = new List<CombineInstance>(); long num = 0L; for (int k = 0; k < list.Count; k++) { List<CombineInstance> list3 = new List<CombineInstance>(); for (int l = 0; l < meshFiltersToCombine.Length - 1; l++) { if (!((Object)(object)array[l + 1] != (Object)null)) { continue; } Material[] sharedMaterials2 = ((Renderer)array[l + 1]).sharedMaterials; for (int m = 0; m < sharedMaterials2.Length; m++) { if ((Object)(object)list[k] == (Object)(object)sharedMaterials2[m]) { CombineInstance item = default(CombineInstance); ((CombineInstance)(ref item)).subMeshIndex = m; ((CombineInstance)(ref item)).mesh = meshFiltersToCombine[l + 1].sharedMesh; ((CombineInstance)(ref item)).transform = ((Component)meshFiltersToCombine[l + 1]).transform.localToWorldMatrix; list3.Add(item); num += ((CombineInstance)(ref item)).mesh.vertices.Length; } } } Mesh val = new Mesh(); if (num <= 65535) { val.CombineMeshes(list3.ToArray(), true); } CombineInstance item2 = default(CombineInstance); ((CombineInstance)(ref item2)).subMeshIndex = 0; ((CombineInstance)(ref item2)).mesh = val; ((CombineInstance)(ref item2)).transform = Matrix4x4.identity; list2.Add(item2); } ((Renderer)array[0]).sharedMaterials = list.ToArray(); Mesh val2 = new Mesh(); ((Object)val2).name = ((Object)this).name; if (num <= 65535) { val2.CombineMeshes(list2.ToArray(), false); GenerateUV(val2); meshFiltersToCombine[0].sharedMesh = val2; DeactivateCombinedGameObjects(meshFiltersToCombine); if (showCreatedMeshInfo) { Debug.Log((object)("<color=#00cc00><b>Mesh \"" + ((Object)this).name + "\" was created from " + (meshFiltersToCombine.Length - 1) + " children meshes and has " + list2.Count + " submeshes, and " + num + " vertices.</b></color>")); } } else if (showCreatedMeshInfo) { Debug.Log((object)("<color=red><b>The mesh vertex limit is 65535! The created mesh had " + num + " vertices. Upgrade Unity version to 2017.3 or higher to avoid this limit (some old devices, like Android with Mali-400 GPU, do not support over 65535 vertices).</b></color>")); } } private void DeactivateCombinedGameObjects(MeshFilter[] meshFilters) { for (int i = 0; i < meshFilters.Length - 1; i++) { if (!destroyCombinedChildren) { if (deactivateCombinedChildren) { ((Component)meshFilters[i + 1]).gameObject.SetActive(false); } if (deactivateCombinedChildrenMeshRenderers) { MeshRenderer component = ((Component)meshFilters[i + 1]).gameObject.GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } } } else { Object.DestroyImmediate((Object)(object)((Component)meshFilters[i + 1]).gameObject); } } } private void GenerateUV(Mesh combinedMesh) { } }
monomod/Assembly-CSharp.MovableWeaponPart.mm.dll
Decompiled 10 months agousing 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 Popcron; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MovableWeaponPart")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MovableWeaponPart")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4a5974ab-1c14-440c-a764-fd2e309d79b7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class BreakOpenTrigger : MonoBehaviour { public FVRPhysicalObject physicalObject; [Header("Break Parts")] public HingeJoint Hinge; public float HingeLimit = 45f; public float HingeEjectThreshhold = 30f; public Transform centerOfMassOverride; [Header("LatchGeo (leave at default if no visible latch)")] public float maxLatchRot = 45f; [Tooltip("If latch is below this angle the fore will latch. Latch rot dependend on how far up you press on touchpad (like break action shotgun)")] public float latchLatchingRot = 5f; public bool hasLatchObject; public Transform Latch; [Header("Objects that turn off or on dependend on break state")] public GameObject[] TurnOffObjectsOnOpen; public GameObject[] TurnOnObjectsOnOpen; public bool doesEjectMag; public float MagEjectSpeed = 5f; [Header("Audio")] public AudioEvent BreakOpenAudio; public AudioEvent BreakCloseAudio; private float m_latchRot; private Vector3 m_foreStartPos; private bool m_isLatched = true; private bool m_latchHeldOpen; private bool m_hasEjectedMag; public void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) m_foreStartPos = ((Component)Hinge).transform.localPosition; if ((Object)(object)centerOfMassOverride != (Object)null) { ((Component)Hinge).GetComponent<Rigidbody>().centerOfMass = centerOfMassOverride.localPosition; } SetBreakObjectsState(active: false); } public void Start() { Hook(); } public void OnDestroy() { Unhook(); } public void FixedUpdate() { UpdateBreakFore(); } public void Update() { FVRViveHand hand = ((FVRInteractiveObject)physicalObject).m_hand; if ((Object)(object)hand != (Object)null) { UpdateInputAndAnimate(hand); } else { m_latchHeldOpen = false; } } private void UpdateInputAndAnimate(FVRViveHand hand) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) m_latchHeldOpen = false; if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonPressed) { m_latchHeldOpen = true; m_latchRot = 1f * maxLatchRot; } else { m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * maxLatchRot * 3f); } } else if (hand.Input.TouchpadPressed && hand.Input.TouchpadAxes.y > 0.1f) { m_latchHeldOpen = true; m_latchRot = hand.Input.TouchpadAxes.y * maxLatchRot; } else { m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * maxLatchRot * 3f); } if (hasLatchObject) { Latch.localEulerAngles = new Vector3(0f, m_latchRot, 0f); } } private void UpdateBreakFore() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (m_isLatched && Mathf.Abs(m_latchRot) > 5f) { m_isLatched = false; SM.PlayGenericSound(BreakOpenAudio, ((Component)physicalObject).transform.position); JointLimits limits = Hinge.limits; ((JointLimits)(ref limits)).max = HingeLimit; Hinge.limits = limits; SetBreakObjectsState(active: true); } if (!m_isLatched) { if (!m_latchHeldOpen && ((Component)Hinge).transform.localEulerAngles.x <= 1f && Mathf.Abs(m_latchRot) < latchLatchingRot) { m_isLatched = true; SM.PlayGenericSound(BreakCloseAudio, ((Component)physicalObject).transform.position); JointLimits limits2 = Hinge.limits; ((JointLimits)(ref limits2)).max = 0f; Hinge.limits = limits2; SetBreakObjectsState(active: false); ((Component)Hinge).transform.localPosition = m_foreStartPos; m_hasEjectedMag = false; } if (doesEjectMag && Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x) >= HingeEjectThreshhold && Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x) <= HingeLimit) { TryEjectMag(); } } } private void TryEjectMag() { if (!m_hasEjectedMag) { EjectMag(); m_hasEjectedMag = true; } } public void EjectMag(bool PhysicalRelease = false) { //IL_00ac: 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) FVRPhysicalObject obj = physicalObject; FVRFireArm val = (FVRFireArm)(object)((obj is FVRFireArm) ? obj : null); if ((Object)(object)val.Magazine != (Object)null) { if (val.Magazine.UsesOverrideInOut) { val.PlayAudioEventHandling(val.Magazine.ProfileOverride.MagazineOut); } else { val.PlayAudioEvent((FirearmAudioEventType)21, 1f); } val.m_lastEjectedMag = val.Magazine; val.m_ejectDelay = 0.4f; if ((Object)(object)((FVRInteractiveObject)val).m_hand != (Object)null) { ((FVRInteractiveObject)val).m_hand.Buzz(((FVRInteractiveObject)val).m_hand.Buzzer.Buzz_BeginInteraction); } val.Magazine.Release(PhysicalRelease); ((FVRPhysicalObject)val.Magazine).RootRigidbody.velocity = -val.MagazineEjectPos.up * MagEjectSpeed; if ((Object)(object)((FVRInteractiveObject)val.Magazine).m_hand != (Object)null) { ((FVRInteractiveObject)val.Magazine).m_hand.Buzz(((FVRInteractiveObject)val).m_hand.Buzzer.Buzz_BeginInteraction); } val.Magazine = null; } } private void SetBreakObjectsState(bool active) { GameObject[] turnOnObjectsOnOpen = TurnOnObjectsOnOpen; foreach (GameObject val in turnOnObjectsOnOpen) { if ((Object)(object)val != (Object)null) { val.SetActive(active); } } turnOnObjectsOnOpen = TurnOffObjectsOnOpen; foreach (GameObject val2 in turnOnObjectsOnOpen) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(!active); } } } private void Unhook() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown FVRPhysicalObject val = physicalObject; if (!(val is ClosedBoltWeapon)) { if (!(val is OpenBoltReceiver)) { if (!(val is Handgun)) { if (val is TubeFedShotgun) { TubeFedShotgun.ReleaseHammer -= new hook_ReleaseHammer(TubeFedShotgun_ReleaseHammer); } } else { Handgun.ReleaseSeer += new hook_ReleaseSeer(Handgun_ReleaseSeer); } } else { OpenBoltReceiver.ReleaseSeer += new hook_ReleaseSeer(OpenBoltReceiver_ReleaseSeer); } } else { ClosedBoltWeapon.DropHammer += new hook_DropHammer(ClosedBoltWeapon_DropHammer); } } private void Hook() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown FVRPhysicalObject val = physicalObject; if (!(val is ClosedBoltWeapon)) { if (!(val is OpenBoltReceiver)) { if (!(val is Handgun)) { if (val is TubeFedShotgun) { TubeFedShotgun.ReleaseHammer += new hook_ReleaseHammer(TubeFedShotgun_ReleaseHammer); } } else { Handgun.ReleaseSeer += new hook_ReleaseSeer(Handgun_ReleaseSeer); } } else { OpenBoltReceiver.ReleaseSeer += new hook_ReleaseSeer(OpenBoltReceiver_ReleaseSeer); } } else { ClosedBoltWeapon.DropHammer += new hook_DropHammer(ClosedBoltWeapon_DropHammer); } } private void TubeFedShotgun_ReleaseHammer(orig_ReleaseHammer orig, TubeFedShotgun self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } private void Handgun_ReleaseSeer(orig_ReleaseSeer orig, Handgun self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } private void OpenBoltReceiver_ReleaseSeer(orig_ReleaseSeer orig, OpenBoltReceiver self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } private void ClosedBoltWeapon_DropHammer(orig_DropHammer orig, ClosedBoltWeapon self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } } public class HingeForegrip : FVRAlternateGrip { public Transform ObjectBase; public HingeJoint Hinge; private Vector3 localPosStart; private Rigidbody RB; private FVRPhysicalObject physObj; public override void Awake() { //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) ((FVRAlternateGrip)this).Awake(); localPosStart = ((Component)Hinge).transform.localPosition; RB = ((Component)Hinge).gameObject.GetComponent<Rigidbody>(); physObj = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent<FVRPhysicalObject>(); } public override void FVRUpdate() { //IL_0011: 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_0034: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f) { ((Component)Hinge).transform.localPosition = localPosStart; } } public override void FVRFixedUpdate() { ((FVRInteractiveObject)this).FVRFixedUpdate(); if (((FVRInteractiveObject)physObj).IsHeld && physObj.IsAltHeld) { RB.mass = 0.001f; } else { RB.mass = 0.1f; } } public override bool IsInteractable() { return true; } public override void UpdateInteraction(FVRViveHand hand) { //IL_000d: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0061: 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_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_008a: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) ((FVRAlternateGrip)this).UpdateInteraction(hand); Vector3 val = Vector3.ProjectOnPlane(((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position, ObjectBase.right); if (Vector3.Angle(val, -ObjectBase.up) > 90f) { val = ObjectBase.forward; } if (Vector3.Angle(val, ObjectBase.forward) > 90f) { val = -ObjectBase.up; } float num = Vector3.Angle(val, ObjectBase.forward); JointSpring spring = Hinge.spring; spring.spring = 10f; spring.damper = 0f; JointLimits limits = Hinge.limits; spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max); Hinge.spring = spring; ((Component)Hinge).transform.localPosition = localPosStart; } public override void EndInteraction(FVRViveHand hand) { //IL_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_0036: Unknown result type (might be due to invalid IL or missing references) JointSpring spring = Hinge.spring; spring.spring = 0.5f; spring.damper = 0.05f; spring.targetPosition = 45f; Hinge.spring = spring; ((FVRAlternateGrip)this).EndInteraction(hand); } } public class MovableWeaponPartMk2 : FVRInteractiveObject { public enum Mode { Translation, Rotation, Folding } public enum Axis { X, Y, Z } private enum State { Open, Mid, Closed } public Mode MovementMode; public Axis MovementAxis; public Transform StationaryRoot; public Transform ObjectToMove; public float LowerLimit; public float UpperLimit; public float LimitWiggleRoom = 0.02f; public AudioEvent CloseSound; public AudioEvent OpenSound; private State _curState; private State _lastState; private float _curPos; private Vector3 _origPos; private Quaternion _origRot; private Vector3 _startingHandPos; private Quaternion _startingHandRot; private Quaternion _lastHandRot; public bool DebugMode; public override void Start() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Start(); _origPos = ObjectToMove.localPosition; _origRot = ObjectToMove.localRotation; switch (MovementMode) { case Mode.Translation: switch (MovementAxis) { case Axis.X: _curPos = _origPos.x; break; case Axis.Y: _curPos = _origPos.y; break; case Axis.Z: _curPos = _origPos.z; break; } break; case Mode.Rotation: switch (MovementAxis) { case Axis.X: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.x; break; case Axis.Y: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.y; break; case Axis.Z: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.z; break; } break; case Mode.Folding: switch (MovementAxis) { case Axis.X: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.x; break; case Axis.Y: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.y; break; case Axis.Z: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.z; break; } break; } if (MovementMode == Mode.Rotation || MovementMode == Mode.Folding) { if (UpperLimit >= 180f) { UpperLimit = 180f; } if (LowerLimit <= -180f) { LowerLimit = -180f; } } } public override void BeginInteraction(FVRViveHand hand) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((FVRInteractiveObject)this).BeginInteraction(hand); _startingHandPos = ((Component)hand).transform.position; _startingHandRot = ((Component)hand).transform.rotation; _lastHandRot = ((Component)hand).transform.rotation; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); switch (MovementMode) { case Mode.Translation: TranslationMode(hand); break; case Mode.Rotation: RotationMode(hand); break; case Mode.Folding: FoldingMode(hand); break; } _lastHandRot = ((Component)hand).transform.rotation; } public void TranslationMode(FVRViveHand hand) { //IL_002f: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_013f: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) switch (MovementAxis) { case Axis.X: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(LowerLimit, 0f, 0f), new Vector3(UpperLimit, 0f, 0f), StationaryRoot.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); _curPos = closestValidPoint.x; ObjectToMove.localPosition = new Vector3(_curPos, _origPos.y, _origPos.z); break; } case Axis.Y: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, LowerLimit, 0f), new Vector3(0f, UpperLimit, 0f), StationaryRoot.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); _curPos = closestValidPoint.y; ObjectToMove.localPosition = new Vector3(_origPos.x, _curPos, _origPos.z); break; } case Axis.Z: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, 0f, LowerLimit), new Vector3(0f, 0f, UpperLimit), StationaryRoot.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); _curPos = closestValidPoint.z; ObjectToMove.localPosition = new Vector3(_origPos.x, _origPos.y, _curPos); break; } } float lerp = Mathf.InverseLerp(LowerLimit, UpperLimit, _curPos); CheckSound(lerp); } public void RotationMode(FVRViveHand hand) { //IL_0006: 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_0011: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0141: 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_0149: 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_016d: 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_0180: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: 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_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) Quaternion val = ((Component)hand).transform.rotation * Quaternion.Inverse(_lastHandRot); float num = default(float); Vector3 val2 = default(Vector3); ((Quaternion)(ref val)).ToAngleAxis(ref num, ref val2); if (((Vector3)(ref val2)).magnitude == 0f || num == 0f) { return; } if (num >= 180f) { num -= 180f; } else if (num <= -180f) { num += 180f; } val2 = StationaryRoot.InverseTransformDirection(val2); float num2 = ((Vector3)(ref val2))[(int)MovementAxis]; if (DebugMode) { Gizmos.Line(((Component)ObjectToMove).transform.position, ((Component)ObjectToMove).transform.position + val2 * 0.1f * num, (Color?)Color.magenta, false); } float num3 = num2 * num; if (Mathf.Abs(num3) > 90f) { Debug.Log((object)("DeltaAngle: " + num3)); } if (num3 > 0f) { switch (MovementAxis) { case Axis.X: { Quaternion val3 = Quaternion.Euler(new Vector3(UpperLimit, 0f, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val3, num3); break; } case Axis.Y: { Quaternion val3 = Quaternion.Euler(new Vector3(0f, UpperLimit, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val3, num3); break; } case Axis.Z: { Quaternion val3 = Quaternion.Euler(new Vector3(0f, 0f, UpperLimit)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val3, num3); break; } } } else { switch (MovementAxis) { case Axis.X: { Quaternion val4 = Quaternion.Euler(new Vector3(LowerLimit, 0f, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val4, num3); break; } case Axis.Y: { Quaternion val4 = Quaternion.Euler(new Vector3(0f, LowerLimit, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val4, num3); break; } case Axis.Z: { Quaternion val4 = Quaternion.Euler(new Vector3(0f, 0f, LowerLimit)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val4, num3); break; } } } if (DebugMode) { Gizmos.Line(((Component)hand).transform.position, ((Component)hand).transform.position + ((Component)hand).transform.forward * 0.1f, (Color?)Color.blue, false); Gizmos.Line(((Component)hand).transform.position, ((Component)hand).transform.position + ((Component)hand).transform.up * 0.1f, (Color?)Color.green, false); Gizmos.Line(((Component)hand).transform.position, ((Component)hand).transform.position + ((Component)hand).transform.right * 0.1f, (Color?)Color.red, false); } _curPos += num3; if (Mathf.Abs(_curPos - UpperLimit) <= LimitWiggleRoom) { _curPos = UpperLimit; switch (MovementAxis) { case Axis.X: Quaternion.Euler(UpperLimit, 0f, 0f); break; case Axis.Y: Quaternion.Euler(0f, UpperLimit, 0f); break; case Axis.Z: Quaternion.Euler(0f, 0f, UpperLimit); break; default: _ = Quaternion.identity; break; } } else if (Mathf.Abs(_curPos - LowerLimit) <= LimitWiggleRoom) { _curPos = LowerLimit; switch (MovementAxis) { case Axis.X: Quaternion.Euler(LowerLimit, 0f, 0f); break; case Axis.Y: Quaternion.Euler(0f, LowerLimit, 0f); break; case Axis.Z: Quaternion.Euler(0f, 0f, LowerLimit); break; default: _ = Quaternion.identity; break; } } float lerp = Mathf.InverseLerp(LowerLimit, UpperLimit, _curPos); CheckSound(lerp); } private void FoldingMode(FVRViveHand hand) { //IL_0001: 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_0011: 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_0019: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007a: 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_0085: 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_00ac: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00e9: 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_010d: 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_0113: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_016a: 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_0175: Unknown result type (might be due to invalid IL or missing references) //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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((FVRInteractiveObject)this).m_handPos - StationaryRoot.position; Vector3 val2 = default(Vector3); Vector3 val3; switch (MovementAxis) { case Axis.X: val2 = -((Component)StationaryRoot).transform.forward; val3 = Vector3.ProjectOnPlane(val, StationaryRoot.right); val = ((Vector3)(ref val3)).normalized; _curPos = Mathf.Atan2(Vector3.Dot(StationaryRoot.right, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Axis.Y: val2 = -((Component)StationaryRoot).transform.forward; val3 = Vector3.ProjectOnPlane(val, StationaryRoot.up); val = ((Vector3)(ref val3)).normalized; _curPos = Mathf.Atan2(Vector3.Dot(StationaryRoot.up, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Axis.Z: val2 = ((Component)StationaryRoot).transform.up; val3 = Vector3.ProjectOnPlane(val, StationaryRoot.forward); val = ((Vector3)(ref val3)).normalized; _curPos = Mathf.Atan2(Vector3.Dot(StationaryRoot.forward, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; } if (DebugMode) { Gizmos.Line(StationaryRoot.position, ((FVRInteractiveObject)this).m_handPos, (Color?)Color.magenta, false); Gizmos.Line(StationaryRoot.position, val2, (Color?)Color.green, false); Gizmos.Line(StationaryRoot.position, val, (Color?)Color.red, false); Gizmos.Line(StationaryRoot.position, Vector3.Cross(val2, val), (Color?)Color.blue, false); } if (Mathf.Abs(_curPos - LowerLimit) < 5f) { _curPos = LowerLimit; } if (Mathf.Abs(_curPos - UpperLimit) < 5f) { _curPos = UpperLimit; } if (_curPos >= LowerLimit && _curPos <= UpperLimit) { switch (MovementAxis) { case Axis.X: ObjectToMove.localEulerAngles = new Vector3(_curPos, 0f, 0f); break; case Axis.Y: ObjectToMove.localEulerAngles = new Vector3(0f, _curPos, 0f); break; case Axis.Z: ObjectToMove.localEulerAngles = new Vector3(0f, 0f, _curPos); break; } float lerp = Mathf.InverseLerp(LowerLimit, UpperLimit, _curPos); CheckSound(lerp); } } private void CheckSound(float lerp) { //IL_004d: 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) if (lerp < LimitWiggleRoom) { _curState = State.Open; } else if (lerp > 1f - LimitWiggleRoom) { _curState = State.Closed; } else { _curState = State.Mid; } if (_curState == State.Open && _lastState != 0) { SM.PlayGenericSound(OpenSound, StationaryRoot.position); } if (_curState == State.Closed && _lastState != State.Closed) { SM.PlayGenericSound(CloseSound, StationaryRoot.position); } _lastState = _curState; } public Vector3 ProjectOnPlaneThroughPoint(Vector3 vector, Vector3 point, Vector3 planeNormal) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return Vector3.ProjectOnPlane(vector, planeNormal) + Vector3.Dot(point, planeNormal) * planeNormal; } } public class MovableWeaponPart : FVRInteractiveObject { public enum Mode { Translation, Rotation, Tilt } public enum Direction { X, Y, Z } private enum State { Open, Mid, Closed } public Mode mode; public Direction direction; public Transform root; public Transform objectToMove; public float lowerLimit; public float upperLimit; public float limitWiggleRoom = 0.02f; public AudioSource audioSource; public AudioClip closeSound; public AudioClip openSound; private State state; private State last_state; private float pos; private Vector3 orig_pos; private Vector3 lastHandPlane; private bool debug; public override void Start() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Start(); orig_pos = objectToMove.localPosition; } public override void BeginInteraction(FVRViveHand hand) { //IL_002d: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0086: 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) ((FVRInteractiveObject)this).BeginInteraction(hand); switch (direction) { case Direction.X: lastHandPlane = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, root.right); break; case Direction.Y: lastHandPlane = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, root.forward); break; case Direction.Z: lastHandPlane = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.forward, -root.up); break; } } public override void UpdateInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).UpdateInteraction(hand); switch (mode) { case Mode.Translation: TranslationMode(hand); break; case Mode.Rotation: RotationMode(hand); break; case Mode.Tilt: TiltMode(hand); break; } } public void TranslationMode(FVRViveHand hand) { //IL_002f: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_013f: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) switch (direction) { case Direction.X: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(lowerLimit, 0f, 0f), new Vector3(upperLimit, 0f, 0f), root.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); pos = closestValidPoint.x; objectToMove.localPosition = new Vector3(pos, orig_pos.y, orig_pos.z); break; } case Direction.Y: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, lowerLimit, 0f), new Vector3(0f, upperLimit, 0f), root.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); pos = closestValidPoint.y; objectToMove.localPosition = new Vector3(orig_pos.x, pos, orig_pos.z); break; } case Direction.Z: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, 0f, lowerLimit), new Vector3(0f, 0f, upperLimit), root.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); pos = closestValidPoint.z; objectToMove.localPosition = new Vector3(orig_pos.x, orig_pos.y, pos); break; } } if ((Object)(object)audioSource != (Object)null) { float lerp = Mathf.InverseLerp(lowerLimit, upperLimit, pos); CheckSound(lerp); } } public void RotationMode(FVRViveHand hand) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_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_0113: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0174: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //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_0198: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) Vector3 val; switch (direction) { case Direction.X: { val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, -((Component)this).transform.right); Vector3 val2 = Vector3.ProjectOnPlane(lastHandPlane, -((Component)this).transform.right); pos = Mathf.Atan2(Vector3.Dot(-((Component)this).transform.right, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f; objectToMove.localEulerAngles = new Vector3(pos, 0f, 0f); break; } case Direction.Y: { val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.forward, ((Component)this).transform.up); Vector3 val2 = Vector3.ProjectOnPlane(lastHandPlane, -((Component)this).transform.up); pos = Mathf.Atan2(Vector3.Dot(-((Component)this).transform.up, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f; objectToMove.localEulerAngles = new Vector3(0f, pos, 0f); break; } case Direction.Z: { val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, -((Component)this).transform.forward); Vector3 val2 = Vector3.ProjectOnPlane(lastHandPlane, -((Component)this).transform.forward); pos = Mathf.Atan2(Vector3.Dot(-((Component)this).transform.forward, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f; objectToMove.localEulerAngles = new Vector3(0f, 0f, pos); break; } default: val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, -((Component)this).transform.right); break; } lastHandPlane = val; if ((Object)(object)audioSource != (Object)null) { float lerp = Mathf.InverseLerp(lowerLimit, upperLimit, pos); CheckSound(lerp); } } private void TiltMode(FVRViveHand hand) { //IL_0001: 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_0011: 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_0019: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007a: 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_0085: 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_00ac: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00e9: 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_010d: 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_0113: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_016a: 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_0175: Unknown result type (might be due to invalid IL or missing references) //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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((FVRInteractiveObject)this).m_handPos - root.position; Vector3 val2 = default(Vector3); Vector3 val3; switch (direction) { case Direction.X: val2 = -((Component)root).transform.forward; val3 = Vector3.ProjectOnPlane(val, root.right); val = ((Vector3)(ref val3)).normalized; pos = Mathf.Atan2(Vector3.Dot(root.right, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Direction.Y: val2 = -((Component)root).transform.forward; val3 = Vector3.ProjectOnPlane(val, root.up); val = ((Vector3)(ref val3)).normalized; pos = Mathf.Atan2(Vector3.Dot(root.up, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Direction.Z: val2 = ((Component)root).transform.up; val3 = Vector3.ProjectOnPlane(val, root.forward); val = ((Vector3)(ref val3)).normalized; pos = Mathf.Atan2(Vector3.Dot(root.forward, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; } if (debug) { Gizmos.Line(root.position, ((FVRInteractiveObject)this).m_handPos, (Color?)Color.magenta, false); Gizmos.Line(root.position, val2, (Color?)Color.green, false); Gizmos.Line(root.position, val, (Color?)Color.red, false); Gizmos.Line(root.position, Vector3.Cross(val2, val), (Color?)Color.blue, false); } if (Mathf.Abs(pos - lowerLimit) < 5f) { pos = lowerLimit; } if (Mathf.Abs(pos - upperLimit) < 5f) { pos = upperLimit; } if (pos >= lowerLimit && pos <= upperLimit) { switch (direction) { case Direction.X: objectToMove.localEulerAngles = new Vector3(pos, 0f, 0f); break; case Direction.Y: objectToMove.localEulerAngles = new Vector3(0f, pos, 0f); break; case Direction.Z: objectToMove.localEulerAngles = new Vector3(0f, 0f, pos); break; } if ((Object)(object)audioSource != (Object)null) { float lerp = Mathf.InverseLerp(lowerLimit, upperLimit, pos); CheckSound(lerp); } } } private void CheckSound(float lerp) { if (lerp < limitWiggleRoom) { state = State.Open; } else if (lerp > 1f - limitWiggleRoom) { state = State.Closed; } else { state = State.Mid; } if (state == State.Open && last_state != 0) { audioSource.PlayOneShot(openSound); } if (state == State.Closed && last_state != State.Closed) { audioSource.PlayOneShot(closeSound); } last_state = state; } }
monomod/Assembly-CSharp.QBArmorPiece.mm.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("QBArmorPiece")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("QBArmorPiece")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("620618db-0065-44f5-8c6f-c7a45a643910")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class QBArmorPiece_Headgear : QBArmorPiece_Backpack { public override void Awake() { ((FVRPhysicalObject)this).Awake(); ((FVRPhysicalObject)this).DoesQuickbeltSlotFollowHead = false; } public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { base.SetQuickBeltSlot(slot); if ((Object)(object)slot != (Object)null) { ((FVRPhysicalObject)this).SetParentage(GM.CurrentPlayerBody.FilteredHead); } else { ((FVRPhysicalObject)this).SetParentage((Transform)null); } } } public class QBArmorPiece_Backpack : PlayerBackPack { [Header("QBArmorPiece_Backpack Config")] public string layerName = "Default"; public string attachmentLayerName = "Default"; public string layerOutsideQBSlot = "Default"; public GameObject disabledInQB; public GameObject enabledInQB; private int attachmentCountOnQBSlotEnter; public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { if (((FVRPhysicalObject)this).AttachmentsList.Count > 0) { for (int i = 0; i < ((FVRPhysicalObject)this).AttachmentsList.Count; i++) { if ((Object)(object)((FVRPhysicalObject)this).AttachmentsList[i] != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)this).AttachmentsList[i]).SetAllCollidersToLayer(false, attachmentLayerName); } } attachmentCountOnQBSlotEnter = ((FVRPhysicalObject)this).AttachmentsList.Count; } } else if (((FVRPhysicalObject)this).AttachmentsList.Count > 0) { for (int j = 0; j < ((FVRPhysicalObject)this).AttachmentsList.Count; j++) { if ((Object)(object)((FVRPhysicalObject)this).AttachmentsList[j] != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)this).AttachmentsList[j]).SetAllCollidersToLayer(false, layerOutsideQBSlot); } } attachmentCountOnQBSlotEnter = ((FVRPhysicalObject)this).AttachmentsList.Count; } if ((Object)(object)((FVRPhysicalObject)this).m_quickbeltSlot != (Object)null && (Object)(object)slot != (Object)(object)((FVRPhysicalObject)this).m_quickbeltSlot) { ((FVRPhysicalObject)this).m_quickbeltSlot.HeldObject = null; ((FVRPhysicalObject)this).m_quickbeltSlot.CurObject = null; ((FVRPhysicalObject)this).m_quickbeltSlot.IsKeepingTrackWithHead = false; } if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerName); slot.HeldObject = (FVRInteractiveObject)(object)this; slot.CurObject = (FVRPhysicalObject)(object)this; slot.IsKeepingTrackWithHead = ((FVRPhysicalObject)this).DoesQuickbeltSlotFollowHead; if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(false); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(true); } } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerOutsideQBSlot); if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(true); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(false); } } ((FVRPhysicalObject)this).m_quickbeltSlot = slot; } public override void FVRUpdate() { ((PlayerBackPack)this).FVRUpdate(); if ((Object)(object)((FVRPhysicalObject)this).m_quickbeltSlot != (Object)null && ((FVRPhysicalObject)this).AttachmentsList.Count > attachmentCountOnQBSlotEnter) { if ((Object)(object)((FVRPhysicalObject)this).AttachmentsList[attachmentCountOnQBSlotEnter] != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)this).AttachmentsList[attachmentCountOnQBSlotEnter]).SetAllCollidersToLayer(false, attachmentLayerName); } attachmentCountOnQBSlotEnter = ((FVRPhysicalObject)this).AttachmentsList.Count; } } } public class QBArmorPiece : FVRPhysicalObject { [Header("QBArmorPiece Config")] public string layerName = "Default"; public string attachmentLayerName = "Default"; public string layerOutsideQBSlot = "Default"; public GameObject disabledInQB; public GameObject enabledInQB; private int attachmentCountOnQBSlotEnter; public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { if (base.AttachmentsList.Count > 0) { for (int i = 0; i < base.AttachmentsList.Count; i++) { if ((Object)(object)base.AttachmentsList[i] != (Object)null) { ((FVRInteractiveObject)base.AttachmentsList[i]).SetAllCollidersToLayer(false, attachmentLayerName); } } attachmentCountOnQBSlotEnter = base.AttachmentsList.Count; } } else if (base.AttachmentsList.Count > 0) { for (int j = 0; j < base.AttachmentsList.Count; j++) { if ((Object)(object)base.AttachmentsList[j] != (Object)null) { ((FVRInteractiveObject)base.AttachmentsList[j]).SetAllCollidersToLayer(false, layerOutsideQBSlot); } } attachmentCountOnQBSlotEnter = base.AttachmentsList.Count; } if ((Object)(object)base.m_quickbeltSlot != (Object)null && (Object)(object)slot != (Object)(object)base.m_quickbeltSlot) { base.m_quickbeltSlot.HeldObject = null; base.m_quickbeltSlot.CurObject = null; base.m_quickbeltSlot.IsKeepingTrackWithHead = false; } if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerName); slot.HeldObject = (FVRInteractiveObject)(object)this; slot.CurObject = (FVRPhysicalObject)(object)this; slot.IsKeepingTrackWithHead = base.DoesQuickbeltSlotFollowHead; if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(false); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(true); } } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerOutsideQBSlot); if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(true); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(false); } } base.m_quickbeltSlot = slot; } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)base.m_quickbeltSlot != (Object)null && base.AttachmentsList.Count > attachmentCountOnQBSlotEnter) { if ((Object)(object)base.AttachmentsList[attachmentCountOnQBSlotEnter] != (Object)null) { ((FVRInteractiveObject)base.AttachmentsList[attachmentCountOnQBSlotEnter]).SetAllCollidersToLayer(false, attachmentLayerName); } attachmentCountOnQBSlotEnter = base.AttachmentsList.Count; } } }
monomod/Assembly-CSharp.RifleGrenadeAdapter.mm.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RifleGrenadeAdapter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RifleGrenadeAdapter")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a88b3506-6ea0-4787-820c-71794be18715")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class ItemLauncherAttachment : MuzzleDevice { [Header("ItemLauncher Config")] public ItemLauncherQBSlot ItemHolder; public Transform ItemLaunchPoint; public float SpeedMultiplier = 1f; public FVRFireArmRecoilProfile OverrideRecoilProfile; public FVRFireArmRecoilProfile OverrideRecoilProfileStocked; public AudioEvent GrenadeShot; private Vector3 _origMuzzlePos; private Quaternion _origMuzzleRot; private FVRFireArm _fireArm; private FVRFireArmRecoilProfile _origRecoilProfile; private FVRFireArmRecoilProfile _origRecoilProfileStocked; private bool _recoilProfileSet; public override void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).Awake(); _origMuzzlePos = base.Muzzle.localPosition; _origMuzzleRot = base.Muzzle.localRotation; } public override void FVRUpdate() { //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_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_0042: 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_0157: 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) ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)((FVRQuickBeltSlot)ItemHolder).HeldObject != (Object)null) { base.Muzzle.position = Vector3.down * 3f + ((Component)this).transform.TransformPoint(_origMuzzlePos); base.Muzzle.rotation = Quaternion.LookRotation(Vector3.down, Vector3.forward); if (!_recoilProfileSet && (Object)(object)_fireArm != (Object)null && (Object)(object)OverrideRecoilProfile != (Object)null) { _origRecoilProfile = _fireArm.RecoilProfile; _origRecoilProfileStocked = _fireArm.RecoilProfileStocked; if ((Object)(object)OverrideRecoilProfileStocked != (Object)null) { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfileStocked; } else { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfile; } _recoilProfileSet = true; } } else { if (_recoilProfileSet && (Object)(object)_fireArm != (Object)null) { _fireArm.RecoilProfile = _origRecoilProfile; _fireArm.RecoilProfileStocked = _origRecoilProfileStocked; _recoilProfileSet = false; } base.Muzzle.localPosition = _origMuzzlePos; base.Muzzle.localRotation = _origMuzzleRot; } } public override void AttachToMount(FVRFireArmAttachmentMount m, bool playSound) { ((FVRFireArmAttachment)this).AttachToMount(m, playSound); ref FVRFireArm fireArm = ref _fireArm; FVRPhysicalObject myObject = m.GetRootMount().MyObject; fireArm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); } public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).OnShot(f, tailClass); if ((Object)(object)((FVRQuickBeltSlot)ItemHolder).HeldObject != (Object)null) { FireItem(); } } private void FireItem() { //IL_001b: 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) float num = CalculateLaunchSpeed(); if (ItemHolder.LaunchHeldObject(num * SpeedMultiplier, ItemLaunchPoint.position)) { SM.PlayCoreSound((FVRPooledAudioType)1, GrenadeShot, ((Component)ItemHolder).transform.position); } } private float CalculateLaunchSpeed() { FVRFireArmChamber curentChamber = GetCurentChamber(); if ((Object)(object)curentChamber == (Object)null) { return 5f; } BallisticProjectile component = curentChamber.GetRound().BallisticProjectilePrefab.GetComponent<BallisticProjectile>(); float num = 0.5f * component.Mass * Mathf.Pow(component.MuzzleVelocityBase, 2f); float mass = ((FVRQuickBeltSlot)ItemHolder).CurObject.RootRigidbody.mass; return Mathf.Sqrt(num / (0.5f * mass)); } private FVRFireArmChamber GetCurentChamber() { FVRFireArm fireArm = _fireArm; Handgun val = (Handgun)(object)((fireArm is Handgun) ? fireArm : null); if (val == null) { ClosedBoltWeapon val2 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null); if (val2 == null) { OpenBoltReceiver val3 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null); if (val3 == null) { TubeFedShotgun val4 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null); if (val4 == null) { BoltActionRifle val5 = (BoltActionRifle)(object)((fireArm is BoltActionRifle) ? fireArm : null); if (val5 == null) { BreakActionWeapon val6 = (BreakActionWeapon)(object)((fireArm is BreakActionWeapon) ? fireArm : null); if (val6 == null) { Revolver val7 = (Revolver)(object)((fireArm is Revolver) ? fireArm : null); if (val7 == null) { SingleActionRevolver val8 = (SingleActionRevolver)(object)((fireArm is SingleActionRevolver) ? fireArm : null); if (val8 == null) { RevolvingShotgun val9 = (RevolvingShotgun)(object)((fireArm is RevolvingShotgun) ? fireArm : null); if (val9 == null) { Flaregun val10 = (Flaregun)(object)((fireArm is Flaregun) ? fireArm : null); if (val10 == null) { RollingBlock val11 = (RollingBlock)(object)((fireArm is RollingBlock) ? fireArm : null); if (val11 == null) { Derringer val12 = (Derringer)(object)((fireArm is Derringer) ? fireArm : null); if (val12 == null) { LAPD2019 val13 = (LAPD2019)(object)((fireArm is LAPD2019) ? fireArm : null); if (val13 == null) { BAP val14 = (BAP)(object)((fireArm is BAP) ? fireArm : null); if (val14 == null) { HCB val15 = (HCB)(object)((fireArm is HCB) ? fireArm : null); if (val15 == null) { M72 val16 = (M72)(object)((fireArm is M72) ? fireArm : null); if (val16 == null) { MF2_RL val17 = (MF2_RL)(object)((fireArm is MF2_RL) ? fireArm : null); if (val17 == null) { RGM40 val18 = (RGM40)(object)((fireArm is RGM40) ? fireArm : null); if (val18 == null) { RPG7 val19 = (RPG7)(object)((fireArm is RPG7) ? fireArm : null); if (val19 == null) { SimpleLauncher val20 = (SimpleLauncher)(object)((fireArm is SimpleLauncher) ? fireArm : null); if (val20 == null) { SimpleLauncher2 val21 = (SimpleLauncher2)(object)((fireArm is SimpleLauncher2) ? fireArm : null); if (val21 == null) { RemoteMissileLauncher val22 = (RemoteMissileLauncher)(object)((fireArm is RemoteMissileLauncher) ? fireArm : null); if (val22 == null) { PotatoGun val23 = (PotatoGun)(object)((fireArm is PotatoGun) ? fireArm : null); if (val23 == null) { GrappleGun val24 = (GrappleGun)(object)((fireArm is GrappleGun) ? fireArm : null); if (val24 != null) { return val24.Chambers[val24.m_curChamber]; } if (_fireArm.FChambers.Count > 0) { return _fireArm.FChambers[0]; } return null; } return val23.Chamber; } return val22.Chamber; } return val21.Chamber; } return val20.Chamber; } return val19.Chamber; } return val18.Chamber; } return val17.Chamber; } return val16.Chamber; } return val15.Chamber; } return val14.Chamber; } return val13.Chambers[val13.CurChamber]; } return val12.Barrels[val12.m_curBarrel].Chamber; } return val11.Chamber; } return val10.Chamber; } return val9.Chambers[val9.CurChamber]; } return val8.Cylinder.Chambers[val8.CurChamber]; } return val7.Chambers[val7.CurChamber]; } return val6.Barrels[val6.m_curBarrel].Chamber; } return val5.Chamber; } return val4.Chamber; } return val3.Chamber; } return val2.Chamber; } return val.Chamber; } } public class RifleGrenadeAdapter : MuzzleDevice { [Header("Rifle Grenade Adapter Config")] public FVRFireArmChamber GrenadeChamber; public Transform GrenadeMuzzle; public float VelocityMultiplier = 1f; public float RangeOverride = -1f; public FVRFireArmRecoilProfile OverrideRecoilProfile; public FVRFireArmRecoilProfile OverrideRecoilProfileStocked; public AudioEvent GrenadeShot; [Tooltip("Normally, only caseless rounds will be removed from the chamber when fired. Enabling this will also remove fired cased rounds from the chamber automatically.")] public bool DoesClearCasedRounds; private Vector3 _origMuzzlePos; private Quaternion _origMuzzleRot; private FVRFireArm _fireArm; private FVRFireArmRecoilProfile _origRecoilProfile; private FVRFireArmRecoilProfile _origRecoilProfileStocked; private bool _recoilProfileSet; public override void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).Awake(); _origMuzzlePos = base.Muzzle.localPosition; _origMuzzleRot = base.Muzzle.localRotation; } public override void FVRUpdate() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_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_004c: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if (GrenadeChamber.IsFull) { base.Muzzle.position = Vector3.down * 3f + ((Component)this).transform.TransformPoint(_origMuzzlePos); base.Muzzle.rotation = Quaternion.LookRotation(Vector3.down, Vector3.forward); if (!_recoilProfileSet && (Object)(object)_fireArm != (Object)null && (Object)(object)OverrideRecoilProfile != (Object)null) { _origRecoilProfile = _fireArm.RecoilProfile; _origRecoilProfileStocked = _fireArm.RecoilProfileStocked; if ((Object)(object)OverrideRecoilProfileStocked != (Object)null) { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfileStocked; } else { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfile; } _recoilProfileSet = true; } if (GrenadeChamber.IsSpent && (GrenadeChamber.GetRound().IsCaseless || DoesClearCasedRounds)) { GrenadeChamber.Unload(); } } else { if (_recoilProfileSet && (Object)(object)_fireArm != (Object)null) { _fireArm.RecoilProfile = _origRecoilProfile; _fireArm.RecoilProfileStocked = _origRecoilProfileStocked; _recoilProfileSet = false; } base.Muzzle.localPosition = _origMuzzlePos; base.Muzzle.localRotation = _origMuzzleRot; } } public override void AttachToMount(FVRFireArmAttachmentMount m, bool playSound) { ((FVRFireArmAttachment)this).AttachToMount(m, playSound); ref FVRFireArm fireArm = ref _fireArm; FVRPhysicalObject myObject = m.GetRootMount().MyObject; fireArm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); } public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).OnShot(f, tailClass); FireGrenade(); } private void FireGrenade() { //IL_0023: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_010e: 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_011e: 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_0160: Unknown result type (might be due to invalid IL or missing references) if (!GrenadeChamber.Fire() || (Object)(object)_fireArm == (Object)null) { return; } float num = _fireArm.GetCombinedFixedDrop(base.MechanicalAccuracy) * 0.0166667f; Vector2 val = _fireArm.GetCombinedFixedDrift(base.MechanicalAccuracy) * 0.0166667f; for (int i = 0; i < GrenadeChamber.GetRound().NumProjectiles; i++) { float num2 = GrenadeChamber.GetRound().ProjectileSpread + base.m_mechanicalAccuracy; if ((Object)(object)GrenadeChamber.GetRound().BallisticProjectilePrefab != (Object)null) { Vector3 val2 = GrenadeMuzzle.forward * 0.005f; GameObject val3 = Object.Instantiate<GameObject>(GrenadeChamber.GetRound().BallisticProjectilePrefab, GrenadeMuzzle.position - val2, GrenadeMuzzle.rotation); Vector2 val4 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num2; val3.transform.Rotate(new Vector3(val4.x + val.y + num, val4.y + val.x, 0f)); BallisticProjectile component = val3.GetComponent<BallisticProjectile>(); component.Fire(component.MuzzleVelocityBase * GrenadeChamber.ChamberVelocityMultiplier * VelocityMultiplier, val3.transform.forward, _fireArm, true); if (RangeOverride > 0f) { component.ForceSetMaxDist(RangeOverride); } } } SM.PlayCoreSound((FVRPooledAudioType)1, GrenadeShot, GrenadeMuzzle.position); } } public class ItemLauncherQBSlot : FVRQuickBeltSlot { [Header("ItemLauncherQBSlot Config")] [Tooltip("Should the Launcher duplicate spawn-locked item?")] public bool AllowSpawnLock = true; [Tooltip("Should the Launcher duplicate harnessed item?")] public bool AllowHarnessing = true; [Tooltip("Should the Launcher automatically fire a cartridge placed in the slot or just launch it?")] public bool FireAmmunition = true; [Tooltip("Should the Launcher automatically pull the pin or cap of a grenade?")] public bool AutoArmGrenades = true; [Tooltip("Should the Launcher automatically align the object in the slot so it points forward?")] public bool AutoAlignZAxis = true; private bool _isAlinged; public void Start() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { RegisterQuickbeltSlot(); } } public void OnDestroy() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { DeRegisterQuickbeltSlot(); } } public void RegisterQuickbeltSlot() { if (!GM.CurrentPlayerBody.QuickbeltSlots.Contains((FVRQuickBeltSlot)(object)this)) { GM.CurrentPlayerBody.QuickbeltSlots.Add((FVRQuickBeltSlot)(object)this); } } public void DeRegisterQuickbeltSlot() { if (GM.CurrentPlayerBody.QuickbeltSlots.Contains((FVRQuickBeltSlot)(object)this)) { GM.CurrentPlayerBody.QuickbeltSlots.Remove((FVRQuickBeltSlot)(object)this); } } private void LateUpdate() { if (!AllowHarnessing && (Object)(object)base.CurObject != (Object)null && base.CurObject.m_isHardnessed) { base.CurObject.m_isHardnessed = false; } if (!AllowSpawnLock && (Object)(object)base.CurObject != (Object)null && base.CurObject.m_isSpawnLock) { base.CurObject.m_isSpawnLock = false; } if (!_isAlinged && (Object)(object)base.CurObject != (Object)null && AutoAlignZAxis) { AlignHeldObject(); } if (_isAlinged && (Object)(object)base.CurObject == (Object)null) { _isAlinged = false; } } public bool LaunchHeldObject(float speed, Vector3 point) { //IL_006f: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.CurObject == (Object)null) { return false; } FVRPhysicalObject val; if (base.CurObject.m_isSpawnLock || base.CurObject.m_isHardnessed) { val = DuplicateFromSpawnLock(base.CurObject).GetComponent<FVRPhysicalObject>(); } else { val = base.CurObject; base.CurObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); } val.RootRigidbody.collisionDetectionMode = (CollisionDetectionMode)2; ((Component)val).transform.SetParent((Transform)null); ((Component)val).transform.position = point; ((Component)val).transform.rotation = ((Component)this).transform.rotation; val.RootRigidbody.velocity = ((Component)this).transform.forward * speed; PinnedGrenade val2 = (PinnedGrenade)(object)((val is PinnedGrenade) ? val : null); if (val2 == null) { FVRCappedGrenade val3 = (FVRCappedGrenade)(object)((val is FVRCappedGrenade) ? val : null); if (val3 == null) { FVRFireArmRound val4 = (FVRFireArmRound)(object)((val is FVRFireArmRound) ? val : null); if (val4 != null && FireAmmunition) { FireRound(val4); } } else if (AutoArmGrenades) { PrimeGrenade(val3); } } else if (AutoArmGrenades) { PrimeGrenade(val2); } return true; } private void PrimeGrenade(PinnedGrenade grenade) { grenade.ReleaseLever(); } private void PrimeGrenade(FVRCappedGrenade grenade) { grenade.m_IsFuseActive = true; } private void FireRound(FVRFireArmRound round) { round.Splode(1f, false, true); } private GameObject DuplicateFromSpawnLock(FVRPhysicalObject physicalObject) { //IL_0011: 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) GameObject obj = Object.Instantiate<GameObject>(((AnvilAsset)physicalObject.ObjectWrapper).GetGameObject(), ((FVRInteractiveObject)physicalObject).Transform.position, ((FVRInteractiveObject)physicalObject).Transform.rotation); FVRPhysicalObject component = obj.GetComponent<FVRPhysicalObject>(); component.SetQuickBeltSlot((FVRQuickBeltSlot)null); if (physicalObject.MP.IsMeleeWeapon && component.MP.IsThrownDisposable) { component.MP.IsCountingDownToDispose = true; if (component.MP.m_isThrownAutoAim) { component.MP.SetReadyToAim(true); component.MP.SetPose(physicalObject.MP.PoseIndex); } } return obj; } private void AlignHeldObject() { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.identity; if ((Object)(object)((FVRInteractiveObject)base.CurObject).QBPoseOverride != (Object)null) { val = ((FVRInteractiveObject)base.CurObject).QBPoseOverride.localRotation; } else if ((Object)(object)((FVRInteractiveObject)base.CurObject).PoseOverride != (Object)null) { val = ((FVRInteractiveObject)base.CurObject).PoseOverride.localRotation; } base.PoseOverride.localRotation = Quaternion.Inverse(val); _isAlinged = true; } }
monomod/Assembly-CSharp.RSC_MagazineFollower.mm.dll
Decompiled 10 months agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RSC_MagazineFollower")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RSC_MagazineFollower")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("78a38910-4f5c-417d-9d32-1f5bf820ba60")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class RSC_MagazineFollower_TubeFedShotgun : FVRInteractiveObject { public enum Axis { x, y, z } [Header("RSC-MagazineFollower Config")] public TubeFedShotgun fireArm; public GameObject magazineReloadTrigger; public Transform follower; public Axis rotationalAxis; public float rotSpeed = 100f; [Tooltip("first entry is Angle when open to load magazine, all following are for the ammount loaded in the magazine, starting with full mag. Last pos is follower with empty mag.")] public float[] rotationalAngles; private bool open = true; private bool lockedSafety; private bool origSafetyPos; private float lastRot; public override void Start() { ((FVRInteractiveObject)this).Start(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!open) { open = true; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)17, 1f); } else { open = false; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)18, 1f); } if (open) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } else if (!open) { magazineReloadTrigger.SetActive(false); if ((Object)(object)((FVRFireArm)fireArm).Magazine == (Object)null) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[rotationalAngles.Length - 1])); } } } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); if (open && !lockedSafety) { origSafetyPos = fireArm.m_isSafetyEngaged; fireArm.m_isSafetyEngaged = true; lockedSafety = true; } else if (open && lockedSafety) { fireArm.m_isSafetyEngaged = true; } else if (!open && lockedSafety) { fireArm.m_isSafetyEngaged = origSafetyPos; lockedSafety = false; } FVRFireArmMagazine magazine = ((FVRFireArm)fireArm).Magazine; if (!open && (Object)(object)((FVRFireArm)fireArm).Magazine != (Object)null) { int numRounds = magazine.m_numRounds; int num = magazine.m_capacity - numRounds + 1; if (lastRot != rotationalAngles[num]) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[num])); } } } private IEnumerator SetFollowerRot(float rot) { bool rotDone = false; lastRot = rot; Quaternion targetRotation = (Quaternion)(rotationalAxis switch { Axis.x => Quaternion.Euler(rot, 0f, 0f), Axis.y => Quaternion.Euler(0f, rot, 0f), Axis.z => Quaternion.Euler(0f, 0f, rot), _ => Quaternion.Euler(0f, 0f, 0f), }); while (!rotDone) { follower.localRotation = Quaternion.RotateTowards(follower.localRotation, targetRotation, rotSpeed * Time.deltaTime); rotDone = follower.localRotation == targetRotation; yield return null; } if (open) { magazineReloadTrigger.SetActive(true); } } } public class RSC_MagazineFollower_BoltAction : FVRInteractiveObject { public enum Axis { x, y, z } [Header("RSC-MagazineFollower Config")] public BoltActionRifle fireArm; public GameObject magazineWell; public GameObject magazineGrabTrigger; public Transform follower; [Tooltip("Index number the safety position is at (starts at 0!).")] public int safetyIndex; public Axis rotationalAxis; public float rotSpeed = 100f; [Tooltip("first entry is Angle when open to load magazine, all following are for the ammount loaded in the magazine, starting with full mag. Last pos is follower with empty mag.")] public float[] rotationalAngles; private bool open = true; private bool lockedSafety; private int origSafetyPos; private float lastRot; public override void Start() { ((FVRInteractiveObject)this).Start(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!open) { open = true; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)17, 1f); } else { open = false; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)18, 1f); } if (open) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } else if (!open) { magazineWell.SetActive(false); magazineGrabTrigger.SetActive(false); if ((Object)(object)((FVRFireArm)fireArm).Magazine == (Object)null) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[rotationalAngles.Length - 1])); } } } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); if (open && !lockedSafety) { origSafetyPos = fireArm.m_fireSelectorMode; fireArm.m_fireSelectorMode = safetyIndex; lockedSafety = true; } else if (open && lockedSafety) { fireArm.m_fireSelectorMode = safetyIndex; } else if (!open && lockedSafety) { fireArm.m_fireSelectorMode = origSafetyPos; lockedSafety = false; } FVRFireArmMagazine magazine = ((FVRFireArm)fireArm).Magazine; if (!open && (Object)(object)((FVRFireArm)fireArm).Magazine != (Object)null) { int numRounds = magazine.m_numRounds; int num = magazine.m_capacity - numRounds + 1; if (lastRot != rotationalAngles[num]) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[num])); } } } private IEnumerator SetFollowerRot(float rot) { bool rotDone = false; lastRot = rot; Quaternion targetRotation = (Quaternion)(rotationalAxis switch { Axis.x => Quaternion.Euler(rot, 0f, 0f), Axis.y => Quaternion.Euler(0f, rot, 0f), Axis.z => Quaternion.Euler(0f, 0f, rot), _ => Quaternion.Euler(0f, 0f, 0f), }); while (!rotDone) { follower.localRotation = Quaternion.RotateTowards(follower.localRotation, targetRotation, rotSpeed * Time.deltaTime); rotDone = follower.localRotation == targetRotation; yield return null; } if (open) { magazineWell.SetActive(true); magazineGrabTrigger.SetActive(true); } } } public class RSC_MagazineFollower : FVRInteractiveObject { public enum Axis { x, y, z } [Header("RSC-MagazineFollower Config")] public ClosedBoltWeapon fireArm; public GameObject magazineWell; public GameObject magazineGrabTrigger; public Transform follower; [Tooltip("Index number the safety position is at (starts at 0!).")] public int safetyIndex; public Axis rotationalAxis; public float rotSpeed = 100f; [Tooltip("first entry is Angle when open to load magazine, all following are for the ammount loaded in the magazine, starting with full mag. Last pos is follower with empty mag.")] public float[] rotationalAngles; private bool open = true; private bool lockedSafety; private int origSafetyPos; private float lastRot; public override void Start() { ((FVRInteractiveObject)this).Start(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!open) { open = true; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)17, 1f); } else { open = false; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)18, 1f); } if (open) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } else if (!open) { magazineWell.SetActive(false); magazineGrabTrigger.SetActive(false); if ((Object)(object)((FVRFireArm)fireArm).Magazine == (Object)null) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[rotationalAngles.Length - 1])); } } } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); if (open && !lockedSafety) { origSafetyPos = fireArm.m_fireSelectorMode; fireArm.m_fireSelectorMode = safetyIndex; lockedSafety = true; } else if (open && lockedSafety) { fireArm.m_fireSelectorMode = safetyIndex; } else if (!open && lockedSafety) { fireArm.m_fireSelectorMode = origSafetyPos; lockedSafety = false; } FVRFireArmMagazine magazine = ((FVRFireArm)fireArm).Magazine; if (!open && (Object)(object)((FVRFireArm)fireArm).Magazine != (Object)null) { int numRounds = magazine.m_numRounds; int num = magazine.m_capacity - numRounds + 1; if (lastRot != rotationalAngles[num]) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[num])); } } } private IEnumerator SetFollowerRot(float rot) { bool rotDone = false; lastRot = rot; Quaternion targetRotation = (Quaternion)(rotationalAxis switch { Axis.x => Quaternion.Euler(rot, 0f, 0f), Axis.y => Quaternion.Euler(0f, rot, 0f), Axis.z => Quaternion.Euler(0f, 0f, rot), _ => Quaternion.Euler(0f, 0f, 0f), }); while (!rotDone) { follower.localRotation = Quaternion.RotateTowards(follower.localRotation, targetRotation, rotSpeed * Time.deltaTime); rotDone = follower.localRotation == targetRotation; yield return null; } if (open) { magazineWell.SetActive(true); magazineGrabTrigger.SetActive(true); } } }
monomod/Assembly-CSharp.WeaponEnhancementAttachment.mm.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("WeaponEnhancementAttachment")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WeaponEnhancementAttachment")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("39a3aff2-e498-4ed1-adf5-423a18deaf80")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace Cityrobo; public class RecoilPercentage : MonoBehaviour { public FVRFireArm fireArm; public float multiplier; private void Start() { FVRFireArmRecoilProfile recoilProfile = fireArm.RecoilProfile; FVRFireArmRecoilProfile recoilProfileStocked = fireArm.RecoilProfileStocked; FVRFireArmRecoilProfile val = Object.Instantiate<FVRFireArmRecoilProfile>(fireArm.RecoilProfile); FVRFireArmRecoilProfile val2 = Object.Instantiate<FVRFireArmRecoilProfile>(fireArm.RecoilProfileStocked); } private void AdjustRecoilProfile(Component original) { //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) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Type type = ((object)original).GetType(); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { object value = fieldInfo.GetValue(original); if (value is float) { fieldInfo.SetValue(original, (float)value * multiplier); } else if (value is Quaternion val) { val.x = 1f / multiplier; val.y = 1f / multiplier; val.z = 1f / multiplier; val.w = 1f / multiplier; fieldInfo.SetValue(original, val); } } } } public class WeaponEnhancementAttachment : FVRFireArmAttachment { public FireArmRoundClass roundClass = (FireArmRoundClass)5; private FVRFireArm _fireArm = null; private FireArmRoundClass _origRoundClass; public override void FVRUpdate() { //IL_006c: 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_010c: 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_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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)base.curMount != (Object)null) { ref FVRFireArm fireArm = ref _fireArm; FVRPhysicalObject myObject = base.curMount.GetRootMount().MyObject; fireArm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); if ((Object)(object)_fireArm != (Object)null) { FVRFireArmChamber curentChamber = GetCurentChamber(); if ((Object)(object)curentChamber != (Object)null && (Object)(object)curentChamber.m_round != (Object)null && curentChamber.m_round.RoundClass != roundClass) { _origRoundClass = curentChamber.m_round.RoundClass; curentChamber.m_round = ((AnvilAsset)AM.GetRoundSelfPrefab(curentChamber.m_round.RoundType, roundClass)).GetGameObject().GetComponent<FVRFireArmRound>(); curentChamber.UpdateProxyDisplay(); } } } else if ((Object)(object)_fireArm != (Object)null) { FVRFireArmChamber curentChamber2 = GetCurentChamber(); if ((Object)(object)curentChamber2 != (Object)null && (Object)(object)curentChamber2.m_round != (Object)null) { curentChamber2.m_round = ((AnvilAsset)AM.GetRoundSelfPrefab(curentChamber2.m_round.RoundType, _origRoundClass)).GetGameObject().GetComponent<FVRFireArmRound>(); curentChamber2.UpdateProxyDisplay(); } _fireArm = null; } } private FVRFireArmChamber GetCurentChamber() { FVRFireArm fireArm = _fireArm; FVRFireArm val = fireArm; Handgun val2 = (Handgun)(object)((val is Handgun) ? val : null); if (val2 == null) { ClosedBoltWeapon val3 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val3 == null) { OpenBoltReceiver val4 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val4 == null) { TubeFedShotgun val5 = (TubeFedShotgun)(object)((val is TubeFedShotgun) ? val : null); if (val5 == null) { BoltActionRifle val6 = (BoltActionRifle)(object)((val is BoltActionRifle) ? val : null); if (val6 == null) { BreakActionWeapon val7 = (BreakActionWeapon)(object)((val is BreakActionWeapon) ? val : null); if (val7 == null) { Revolver val8 = (Revolver)(object)((val is Revolver) ? val : null); if (val8 == null) { SingleActionRevolver val9 = (SingleActionRevolver)(object)((val is SingleActionRevolver) ? val : null); if (val9 == null) { RevolvingShotgun val10 = (RevolvingShotgun)(object)((val is RevolvingShotgun) ? val : null); if (val10 == null) { Flaregun val11 = (Flaregun)(object)((val is Flaregun) ? val : null); if (val11 == null) { RollingBlock val12 = (RollingBlock)(object)((val is RollingBlock) ? val : null); if (val12 == null) { Derringer val13 = (Derringer)(object)((val is Derringer) ? val : null); if (val13 == null) { LAPD2019 val14 = (LAPD2019)(object)((val is LAPD2019) ? val : null); if (val14 == null) { BAP val15 = (BAP)(object)((val is BAP) ? val : null); if (val15 == null) { HCB val16 = (HCB)(object)((val is HCB) ? val : null); if (val16 == null) { M72 val17 = (M72)(object)((val is M72) ? val : null); if (val17 == null) { MF2_RL val18 = (MF2_RL)(object)((val is MF2_RL) ? val : null); if (val18 == null) { RGM40 val19 = (RGM40)(object)((val is RGM40) ? val : null); if (val19 == null) { RPG7 val20 = (RPG7)(object)((val is RPG7) ? val : null); if (val20 == null) { SimpleLauncher val21 = (SimpleLauncher)(object)((val is SimpleLauncher) ? val : null); if (val21 == null) { SimpleLauncher2 val22 = (SimpleLauncher2)(object)((val is SimpleLauncher2) ? val : null); if (val22 == null) { RemoteMissileLauncher val23 = (RemoteMissileLauncher)(object)((val is RemoteMissileLauncher) ? val : null); if (val23 == null) { PotatoGun val24 = (PotatoGun)(object)((val is PotatoGun) ? val : null); if (val24 == null) { GrappleGun val25 = (GrappleGun)(object)((val is GrappleGun) ? val : null); if (val25 != null) { return val25.Chambers[val25.m_curChamber]; } if (_fireArm.FChambers.Count > 0) { return _fireArm.FChambers[0]; } return null; } return val24.Chamber; } return val23.Chamber; } return val22.Chamber; } return val21.Chamber; } return val20.Chamber; } return val19.Chamber; } return val18.Chamber; } return val17.Chamber; } return val16.Chamber; } return val15.Chamber; } return val14.Chambers[val14.CurChamber]; } return val13.Barrels[val13.m_curBarrel].Chamber; } return val12.Chamber; } return val11.Chamber; } return val10.Chambers[val10.CurChamber]; } return val9.Cylinder.Chambers[val9.CurChamber]; } return val8.Chambers[val8.CurChamber]; } return val7.Barrels[val7.m_curBarrel].Chamber; } return val6.Chamber; } return val5.Chamber; } return val4.Chamber; } return val3.Chamber; } return val2.Chamber; } }
plugins/AdditionalBarrel.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("AdditionalBarrel")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AdditionalBarrel")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("16797921-bafb-4d49-aa62-869f36c6ec22")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class AdditionalBarrel : MonoBehaviour { public FVRFireArm fireArm; public Transform muzzle; public bool UsesAdditionalRound; public void Awake() { ((Component)this).gameObject.SetActive(false); AdditionalBarrel obj = ((Component)this).gameObject.AddComponent<AdditionalBarrel>(); obj.FireArm = fireArm; obj.MuzzlePos = muzzle; obj.UsesAdditionalRound = UsesAdditionalRound; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/Adjustable_ReflexSight.dll
Decompiled 10 months agousing 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; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Adjustable_Reflexsight")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Adjustable_Reflexsight")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("91a7410e-16e7-4051-803f-3bfe772380c8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class GrenadeLauncherRedDot : MonoBehaviour { [Header("Grenade Launcher Red Dot Config")] public FVRFireArmAttachment Attachment; public FVRInteractiveObject AttachmentInterface; public Transform TiltingOpticPart; public MeshRenderer ReticleMeshRenderer; [Header("Reticles")] [Tooltip("Index of the Array below, not the actual value. Starts at 0.")] public int CurrentSelectedTextureIndex; public Texture2D[] ReticleTextures; [Tooltip("Switch that moves with the selected texture (optional).")] public Transform ButtonSwitch; public Vector3[] SwitchPositions; [Header("If you want a Screen above the scope that shows stuff, use this:")] public Transform TextFrame; public Text ReticleTextScreen; public Text ZeroTextScreen; public string ReticleTextPrefix = "Reticle: "; public string[] ReticleTextField; public string ZeroTextPrefix = "Zero Distance: "; [Tooltip("Index of the Array below, not the actual value. Starts at 0.")] public int CurrentZeroDistanceIndex; [Tooltip("In meters. Miss me with that imperial shit!")] public float[] ZeroDistances = new float[7] { 50f, 100f, 150f, 200f, 300f, 500f, 1000f }; [Header("Intergrated Sight configuration")] public bool IsIntegrated; public FVRFireArm FireArm; [Header("Reticle Occlusion culling")] [Tooltip("Use this for extra performant reticle occlusion culling")] public Collider LensCollider; public bool DisableOcclusionCulling; private FVRViveHand m_hand; private int _currentMenu; private bool _zeroOnlyMode; private string _nameOfTexture = "_RedDotTex"; private string _nameOfDistanceVariable = "_RedDotDist"; private string _nameOfXOffset = "_MuzzleOffsetX"; private string _nameOfYOffset = "_MuzzleOffsetY"; private List<Collider> _scopeColliders; private Transform _muzzlePos; private bool _attached; private Transform _head; private Vector3 _leftEye; private Vector3 _rightEye; public void Start() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_013d: Unknown result type (might be due to invalid IL or missing references) if (CurrentSelectedTextureIndex >= ReticleTextures.Length) { CurrentSelectedTextureIndex = 0; } if (CurrentZeroDistanceIndex >= ZeroDistances.Length) { CurrentZeroDistanceIndex = 0; } if (ReticleTextures.Length != 0) { ((Renderer)ReticleMeshRenderer).material.SetTexture(_nameOfTexture, (Texture)(object)ReticleTextures[CurrentSelectedTextureIndex]); } ((Renderer)ReticleMeshRenderer).material.SetFloat(_nameOfDistanceVariable, ZeroDistances[CurrentZeroDistanceIndex]); if ((Object)(object)ButtonSwitch != (Object)null) { ButtonSwitch.localPosition = SwitchPositions[CurrentSelectedTextureIndex]; } if (ReticleTextures.Length <= 1) { _zeroOnlyMode = true; _currentMenu = 1; } _scopeColliders = new List<Collider>(((FVRInteractiveObject)Attachment).m_colliders); StartScreen(); _head = GM.CurrentPlayerBody.Head; _leftEye = _head.position + _head.right * -0.032f; _rightEye = _head.position + _head.right * 0.032f; Zero(); } public void Update() { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0082: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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) m_hand = AttachmentInterface.m_hand; if ((Object)(object)m_hand != (Object)null) { if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.left) < 45f && _currentMenu == 0) { UsePreviousTexture(); } else if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.right) < 45f && _currentMenu == 0) { UseNextTexture(); } if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.left) < 45f && _currentMenu == 1) { UsePreviousZeroDistance(); } else if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.right) < 45f && _currentMenu == 1) { UseNextZeroDistance(); } else if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.up) < 45f && !_zeroOnlyMode) { ShowNextMenu(); } } _head = GM.CurrentPlayerBody.Head; _leftEye = _head.position + _head.right * -0.032f; _rightEye = _head.position + _head.right * 0.032f; if (!DisableOcclusionCulling && (IsIntegrated || _attached)) { CheckReticleVisibility(); } } public void UseNextTexture() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) CurrentSelectedTextureIndex = (CurrentSelectedTextureIndex + 1) % ReticleTextures.Length; ((Renderer)ReticleMeshRenderer).material.SetTexture(_nameOfTexture, (Texture)(object)ReticleTextures[CurrentSelectedTextureIndex]); if ((Object)(object)ButtonSwitch != (Object)null) { ButtonSwitch.localPosition = SwitchPositions[CurrentSelectedTextureIndex]; } UpdateScreen(); } public void UsePreviousTexture() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) CurrentSelectedTextureIndex = (CurrentSelectedTextureIndex + ReticleTextures.Length - 1) % ReticleTextures.Length; ((Renderer)ReticleMeshRenderer).material.SetTexture(_nameOfTexture, (Texture)(object)ReticleTextures[CurrentSelectedTextureIndex]); if ((Object)(object)ButtonSwitch != (Object)null) { ButtonSwitch.localPosition = SwitchPositions[CurrentSelectedTextureIndex]; } UpdateScreen(); } private void ShowNextMenu() { if ((Object)(object)ReticleTextScreen == (Object)null && (Object)(object)ZeroTextScreen == (Object)null) { return; } _currentMenu++; if (_currentMenu > 2) { _currentMenu = 0; } switch (_currentMenu) { case 0: if ((Object)(object)ReticleTextScreen == (Object)null) { ShowNextMenu(); return; } break; case 1: if ((Object)(object)ZeroTextScreen == (Object)null) { ShowNextMenu(); return; } break; default: _currentMenu = 0; break; } UpdateScreen(); } private void UpdateScreen() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ReticleTextScreen != (Object)null && _currentMenu == 0) { if ((Object)(object)TextFrame != (Object)null) { TextFrame.localPosition = ((Component)ReticleTextScreen).transform.localPosition; } ReticleTextScreen.text = ReticleTextPrefix + ReticleTextField[CurrentSelectedTextureIndex]; } else if ((Object)(object)ReticleTextScreen == (Object)null) { _currentMenu = 1; } if ((Object)(object)ZeroTextScreen != (Object)null && _currentMenu == 1) { if ((Object)(object)TextFrame != (Object)null) { TextFrame.localPosition = ((Component)ZeroTextScreen).transform.localPosition; } ZeroTextScreen.text = ZeroTextPrefix + ZeroDistances[CurrentZeroDistanceIndex] + "m"; } } private void StartScreen() { if ((Object)(object)ReticleTextScreen != (Object)null) { ReticleTextScreen.text = ReticleTextPrefix + ReticleTextField[CurrentSelectedTextureIndex]; } if ((Object)(object)ZeroTextScreen != (Object)null) { ZeroTextScreen.text = ZeroTextPrefix + ZeroDistances[CurrentZeroDistanceIndex] + "m"; } } public void UseNextZeroDistance() { if (CurrentZeroDistanceIndex < ZeroDistances.Length - 1) { CurrentZeroDistanceIndex++; } ((Renderer)ReticleMeshRenderer).material.SetFloat(_nameOfDistanceVariable, ZeroDistances[CurrentZeroDistanceIndex]); UpdateScreen(); Zero(); } public void UsePreviousZeroDistance() { if (CurrentZeroDistanceIndex > 0) { CurrentZeroDistanceIndex--; } ((Renderer)ReticleMeshRenderer).material.SetFloat(_nameOfDistanceVariable, ZeroDistances[CurrentZeroDistanceIndex]); UpdateScreen(); Zero(); } private void CheckReticleVisibility() { //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: 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_0317: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //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) //IL_015e: 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_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_034a: 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_0182: 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_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) bool flag = false; if ((Object)(object)LensCollider == (Object)null && _scopeColliders.Count > 0) { float num = Vector3.Distance(((Component)this).gameObject.transform.position, GM.CurrentPlayerBody.Head.position) + 0.2f; Vector3 val = _muzzlePos.position + ((Component)this).transform.forward * ZeroDistances[CurrentZeroDistanceIndex] - _rightEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { RaycastHit[] array = Physics.RaycastAll(_rightEye, val, num, LayerMask.NameToLayer("Environment"), (QueryTriggerInteraction)1); if (array.Length != 0) { RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (_scopeColliders.Contains(((RaycastHit)(ref val2)).collider)) { ((Component)ReticleMeshRenderer).gameObject.SetActive(true); flag = true; } } } } if (!flag) { val = _muzzlePos.position + ((Component)this).transform.forward * ZeroDistances[CurrentZeroDistanceIndex] - _leftEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { RaycastHit[] array = Physics.RaycastAll(_leftEye, val, num, LayerMask.NameToLayer("Environment"), (QueryTriggerInteraction)1); if (array.Length != 0) { RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val3 = array2[i]; if (_scopeColliders.Contains(((RaycastHit)(ref val3)).collider)) { ((Component)ReticleMeshRenderer).gameObject.SetActive(true); flag = true; } } } } } if (!flag) { ((Component)ReticleMeshRenderer).gameObject.SetActive(false); } } else if ((Object)(object)LensCollider != (Object)null) { float num2 = Vector3.Distance(((Component)this).gameObject.transform.position, GM.CurrentPlayerBody.Head.position) + 0.2f; Vector3 val4 = _muzzlePos.position + ((Component)this).transform.forward * ZeroDistances[CurrentZeroDistanceIndex] - _rightEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { Ray val5 = default(Ray); ((Ray)(ref val5))..ctor(_rightEye, val4); RaycastHit val6 = default(RaycastHit); if (LensCollider.Raycast(val5, ref val6, num2)) { ((Component)ReticleMeshRenderer).gameObject.SetActive(true); flag = true; } } if (!flag) { val4 = _muzzlePos.position + ((Component)this).transform.forward * ZeroDistances[CurrentZeroDistanceIndex] - _leftEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { Ray val7 = default(Ray); ((Ray)(ref val7))..ctor(_leftEye, val4); RaycastHit val8 = default(RaycastHit); if (LensCollider.Raycast(val7, ref val8, num2)) { ((Component)ReticleMeshRenderer).gameObject.SetActive(true); flag = true; } } } if (!flag) { ((Component)ReticleMeshRenderer).gameObject.SetActive(false); } } else { Debug.LogWarning((object)"No usable colliders for reticle occlusion found! If you are a modmaker, please add colliders or a lens collider, or disable occlusion culling with the checkbox!\n Disabling Occlusion culling now!"); DisableOcclusionCulling = true; } } public void Zero() { //IL_01b8: 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_00b2: 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_00fc: 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_0112: 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_0127: 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_0132: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01a7: 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) if (IsIntegrated || ((Object)(object)Attachment != (Object)null && (Object)(object)Attachment.curMount != (Object)null && (Object)(object)Attachment.curMount.Parent != (Object)null && Attachment.curMount.Parent is FVRFireArm)) { if (!IsIntegrated) { ref FVRFireArm fireArm = ref FireArm; FVRPhysicalObject parent = Attachment.curMount.Parent; fireArm = (FVRFireArm)(object)((parent is FVRFireArm) ? parent : null); } if (IsIntegrated && (Object)(object)FireArm == (Object)null) { Debug.LogError((object)"ScopeShaderZoom: FireArm not set on integrated Scope! Can't zero sight!"); } FireArmRoundType roundType = FireArm.RoundType; float num = ZeroDistances[CurrentZeroDistanceIndex]; float num2 = 0f; if (AM.SRoundDisplayDataDic.ContainsKey(roundType)) { num2 = AM.SRoundDisplayDataDic[roundType].BulletDropCurve.Evaluate(num * 0.001f); } Vector3 val = FireArm.MuzzlePos.position + FireArm.GetMuzzle().forward * num + FireArm.GetMuzzle().up * num2; Vector3.ProjectOnPlane(val - ((Component)this).transform.forward, ((Component)this).transform.right); Vector3 val2 = Vector3.ProjectOnPlane(val, ((Component)this).transform.right) + Vector3.Dot(((Component)this).transform.position, ((Component)this).transform.right) * ((Component)this).transform.right; TiltingOpticPart.LookAt(val2, ((Component)this).transform.up); } else { TiltingOpticPart.localRotation = Quaternion.identity; } } } public class Adjustable_ReflexSight : MonoBehaviour { public FVRFireArmAttachment attachment; [Tooltip("This can be an AttachmentInterface or a standalone FVRInteractiveObject set to \" is simple interact \" ")] public FVRInteractiveObject reflexSightInterface; public MeshRenderer reticle; [Header("Reticle Settings")] [Tooltip("All reticle textures. Default reticle is first entry.")] public Texture2D[] textures; [Tooltip("Colors of all reticles. Default reticle name is first entry.")] [ColorUsage(true, true, 0f, float.MaxValue, 0f, float.MaxValue)] public Color[] reticleColors; [Tooltip("Names of all reticles. Default reticle name is first entry.")] public string[] reticleText; [Tooltip("Index of the Array below, not the actual value. Starts at 0.")] public int currentTexture; [Header("If you want a Screen above the scope that shows stuff, use this:")] public Transform textFrame; public Text reticleTextScreen; public Text zeroTextScreen; public Text BrightnessTextScreen; public string reticleTestPrefix = "Reticle: "; public string zeroTextPrefix = "Zero Distance: "; public string BrightnessTextPrefix = "Brightness: "; [Tooltip("Index of the Array below, not the actual value. Starts at 0.")] public int currentZeroDistance = 3; [Tooltip("In meters. Miss me with that imperial shit!")] public float[] zeroDistances = new float[7] { 2f, 5f, 10f, 15f, 25f, 50f, 100f }; [Header("Intergrated Sight configuration")] [Tooltip("Check this box if integrated. (sorry, bad naming.)")] public bool isStandalone; public FVRFireArm fireArm; [Header("Reticle Occlusion culling")] [Tooltip("Use this for extra performant reticle occlusion culling")] public Collider lensCollider; public bool disableOcclusionCulling; [Header("Moving Switch Settings")] [Tooltip("Switch that moves with the selected texture")] public Transform buttonSwitch; public Vector3[] switchPositions; [Header("Brightness Settings")] [Tooltip("Index of the Array below, not the actual value. Starts at 0.")] public int currentBrightnessIndex = 3; public float[] HDRBrightnessLevels = new float[10] { 0.25f, 0.5f, 0.75f, 1f, 1.25f, 1.5f, 1.75f, 2f, 2.5f, 3f }; public float[] BrightnessAlphaLevels = new float[10] { 0.25f, 0.5f, 0.75f, 1f, 1f, 1f, 1f, 1f, 1f, 1f }; public string[] BrightnessTexts = new string[10] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; private FVRViveHand m_hand; private bool _attached; private int _currentMenu; private const string s_nameOfTextureVariable = "_RedDotTex"; private const string s_nameOfColorVariable = "_DotColor"; private const string s_nameOfDistanceVariable = "_RedDotDist"; private const string s_nameOfXOffsetVariable = "_MuzzleOffsetX"; private const string s_nameOfYOffsetVariable = "_MuzzleOffsetY"; private List<Collider> _scopeColliders; private Transform _muzzlePos; private Vector3 _leftEye; private Vector3 _rightEye; private MaterialPropertyBlock _materialPropertyBlock; private Quaternion _origReticleRotation; public void Start() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_00f8: 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_0147: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) _materialPropertyBlock = new MaterialPropertyBlock(); _origReticleRotation = ((Component)reticle).transform.localRotation; if (currentTexture >= textures.Length || currentTexture < 0) { currentTexture = 0; } if (currentZeroDistance >= zeroDistances.Length || currentZeroDistance < 0) { currentZeroDistance = 0; } if (currentBrightnessIndex >= HDRBrightnessLevels.Length || currentBrightnessIndex < 0) { currentBrightnessIndex = 0; } if (HDRBrightnessLevels.Length != BrightnessAlphaLevels.Length) { Debug.LogError((object)("AdjustableReflexsight " + ((Object)((Component)this).gameObject).name + ": HDRBrightnessLevels.Length != BrightnessAlphaLevels.Length!")); } if (textures.Length != 0) { _materialPropertyBlock.SetTexture("_RedDotTex", (Texture)(object)textures[currentTexture]); } if ((Object)(object)buttonSwitch != (Object)null) { buttonSwitch.localPosition = switchPositions[currentTexture]; } if (reflexSightInterface.IsSimpleInteract) { Hook(); } if (textures.Length <= 1) { _currentMenu = 1; } StartScreen(); _leftEye = GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.right * -0.032f; _rightEye = GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.right * 0.032f; if (!isStandalone) { _scopeColliders = new List<Collider>(((FVRInteractiveObject)attachment).m_colliders); } if (isStandalone) { Zero(); } ((Renderer)reticle).SetPropertyBlock(_materialPropertyBlock); } public void OnDestroy() { Unhook(); } public void Update() { //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (!reflexSightInterface.IsSimpleInteract) { m_hand = reflexSightInterface.m_hand; if ((Object)(object)m_hand != (Object)null) { if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.left) < 45f) { switch (_currentMenu) { case 0: UsePreviousTexture(); break; case 1: UsePreviousZeroDistance(); break; case 2: UsePreviousBrightness(); break; } } else if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.right) < 45f) { switch (_currentMenu) { case 0: UseNextTexture(); break; case 1: UseNextZeroDistance(); break; case 2: UseNextBrightness(); break; } } else if (m_hand.Input.TouchpadDown && Vector2.Angle(m_hand.Input.TouchpadAxes, Vector2.up) < 45f) { ShowNextMenu(); } } } if (!isStandalone && (Object)(object)attachment.curMount != (Object)null && !_attached) { _attached = true; ref FVRFireArm reference = ref fireArm; FVRPhysicalObject myObject = attachment.curMount.GetRootMount().MyObject; reference = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); Zero(); } else if (!isStandalone && (Object)(object)attachment.curMount == (Object)null && _attached) { _attached = false; Zero(reset: true); } _leftEye = GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.right * -0.032f; _rightEye = GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.right * 0.032f; if (!disableOcclusionCulling && (isStandalone || _attached)) { CheckReticleVisibility(); } ((Renderer)reticle).SetPropertyBlock(_materialPropertyBlock); } private void ShowNextMenu() { if ((Object)(object)reticleTextScreen == (Object)null && (Object)(object)zeroTextScreen == (Object)null && (Object)(object)BrightnessTextScreen == (Object)null) { return; } _currentMenu++; if (_currentMenu > 2) { _currentMenu = 0; } switch (_currentMenu) { case 0: if ((Object)(object)reticleTextScreen == (Object)null) { ShowNextMenu(); return; } break; case 1: if ((Object)(object)zeroTextScreen == (Object)null) { ShowNextMenu(); return; } break; case 2: if ((Object)(object)BrightnessTextScreen == (Object)null) { ShowNextMenu(); return; } break; } UpdateScreen(); } private void StartScreen() { if ((Object)(object)reticleTextScreen != (Object)null) { reticleTextScreen.text = reticleTestPrefix + reticleText[currentTexture]; } if ((Object)(object)zeroTextScreen != (Object)null) { zeroTextScreen.text = zeroTextPrefix + zeroDistances[currentZeroDistance] + "m"; } if ((Object)(object)BrightnessTextScreen != (Object)null) { BrightnessTextScreen.text = BrightnessTextPrefix + BrightnessTexts[currentBrightnessIndex]; } } private void UpdateScreen() { //IL_0035: 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_010b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)reticleTextScreen != (Object)null && _currentMenu == 0) { if ((Object)(object)textFrame != (Object)null) { textFrame.localPosition = ((Component)reticleTextScreen).transform.localPosition; } reticleTextScreen.text = reticleTestPrefix + reticleText[currentTexture]; } else if ((Object)(object)zeroTextScreen != (Object)null && _currentMenu == 1) { if ((Object)(object)textFrame != (Object)null) { textFrame.localPosition = ((Component)zeroTextScreen).transform.localPosition; } zeroTextScreen.text = zeroTextPrefix + zeroDistances[currentZeroDistance] + "m"; } else if ((Object)(object)BrightnessTextScreen != (Object)null && _currentMenu == 2) { if ((Object)(object)textFrame != (Object)null) { textFrame.localPosition = ((Component)BrightnessTextScreen).transform.localPosition; } BrightnessTextScreen.text = BrightnessTextPrefix + BrightnessTexts[currentBrightnessIndex]; } } public void UseNextTexture() { //IL_008f: 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) currentTexture = (currentTexture + 1) % textures.Length; _materialPropertyBlock.SetTexture("_RedDotTex", (Texture)(object)textures[currentTexture]); if (reticleColors != null && reticleColors.Length == textures.Length) { _materialPropertyBlock.SetColor("_DotColor", reticleColors[currentTexture]); } if ((Object)(object)buttonSwitch != (Object)null) { buttonSwitch.localPosition = switchPositions[currentTexture]; } if ((Object)(object)BrightnessTextScreen != (Object)null) { UpdateBrightness(); } UpdateScreen(); } public void UsePreviousTexture() { //IL_0098: 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) currentTexture = (currentTexture + textures.Length - 1) % textures.Length; _materialPropertyBlock.SetTexture("_RedDotTex", (Texture)(object)textures[currentTexture]); if (reticleColors != null && reticleColors.Length == textures.Length) { _materialPropertyBlock.SetColor("_DotColor", reticleColors[currentTexture]); } if ((Object)(object)buttonSwitch != (Object)null) { buttonSwitch.localPosition = switchPositions[currentTexture]; } if ((Object)(object)BrightnessTextScreen != (Object)null) { UpdateBrightness(); } UpdateScreen(); } public void UseNextZeroDistance() { if (currentZeroDistance < zeroDistances.Length - 1) { currentZeroDistance++; } Zero(); UpdateScreen(); } public void UsePreviousZeroDistance() { if (currentZeroDistance > 0) { currentZeroDistance--; } Zero(); UpdateScreen(); } public void UseNextBrightness() { if (currentBrightnessIndex < HDRBrightnessLevels.Length - 1) { currentBrightnessIndex++; } UpdateBrightness(); UpdateScreen(); } public void UsePreviousBrightness() { if (currentBrightnessIndex > 0) { currentBrightnessIndex--; } UpdateBrightness(); UpdateScreen(); } public void UpdateBrightness() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Pow(2f, HDRBrightnessLevels[currentBrightnessIndex] - 1f); if (reticleColors == null || reticleColors.Length == 0) { Debug.LogError((object)"Trying to change brightness but reference color array is empty!"); return; } Color val; try { val = reticleColors[currentTexture]; } catch (Exception) { Debug.LogError((object)"Trying to change brightness but reference color array is empty at selected texture index!"); return; } Color val2 = default(Color); ((Color)(ref val2))..ctor(val.r * num, val.g * num, val.b * num, val.a); val2.a *= BrightnessAlphaLevels[currentBrightnessIndex]; _materialPropertyBlock.SetColor("_DotColor", val2); } private void CheckReticleVisibility() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_0297: 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_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_0088: 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_009f: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035b: 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_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0383: 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_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_015c: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Vector3 val = _muzzlePos.InverseTransformPoint(((Component)reticle).transform.position); if ((Object)(object)lensCollider == (Object)null && _scopeColliders != null && _scopeColliders.Count > 0) { float num = Vector3.Distance(((Component)this).transform.position, GM.CurrentPlayerBody.Head.position) + 0.2f; Vector3 val2 = ((Component)this).transform.TransformPoint(-val) + ((Component)this).transform.forward * zeroDistances[currentZeroDistance] - _rightEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { RaycastHit[] array = Physics.RaycastAll(_rightEye, val2, num, LayerMask.NameToLayer("Environment"), (QueryTriggerInteraction)1); if (array.Length != 0) { RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val3 = array2[i]; if (_scopeColliders.Contains(((RaycastHit)(ref val3)).collider)) { ((Component)reticle).gameObject.SetActive(true); flag = true; } } } } if (!flag) { val2 = ((Component)this).transform.TransformPoint(-val) + ((Component)this).transform.forward * zeroDistances[currentZeroDistance] - _leftEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { RaycastHit[] array = Physics.RaycastAll(_leftEye, val2, num, LayerMask.NameToLayer("Environment"), (QueryTriggerInteraction)1); if (array.Length != 0) { RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val4 = array2[i]; if (_scopeColliders.Contains(((RaycastHit)(ref val4)).collider)) { ((Component)reticle).gameObject.SetActive(true); flag = true; } } } } } if (!flag) { ((Component)reticle).gameObject.SetActive(false); } } else if ((Object)(object)lensCollider != (Object)null) { float num2 = Vector3.Distance(((Component)this).transform.position, GM.CurrentPlayerBody.Head.position) + 0.2f; Vector3 val5 = ((Component)this).transform.TransformPoint(-val) + ((Component)this).transform.forward * zeroDistances[currentZeroDistance] - _rightEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { Ray val6 = default(Ray); ((Ray)(ref val6))..ctor(_rightEye, val5); RaycastHit val7 = default(RaycastHit); if (lensCollider.Raycast(val6, ref val7, num2)) { ((Component)reticle).gameObject.SetActive(true); flag = true; } } if (!flag) { val5 = ((Component)this).transform.TransformPoint(-val) + ((Component)this).transform.forward * zeroDistances[currentZeroDistance] - _leftEye; if (Vector3.Angle(GM.CurrentPlayerBody.Head.forward, ((Component)this).transform.forward) < 45f) { Ray val8 = default(Ray); ((Ray)(ref val8))..ctor(_leftEye, val5); RaycastHit val9 = default(RaycastHit); if (lensCollider.Raycast(val8, ref val9, num2)) { ((Component)reticle).gameObject.SetActive(true); flag = true; } } } if (!flag) { ((Component)reticle).gameObject.SetActive(false); } } else { Debug.LogWarning((object)"No usable colliders for reticle occlusion found! If you are a modmaker, please add colliders or a lens collider, or disable occlusion culling with the checkbox!\n Disabling Occlusion culling now!"); disableOcclusionCulling = true; } } private void Zero(bool reset = false) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0041: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (!reset) { _muzzlePos = fireArm.CurrentMuzzle; Vector3 val = _muzzlePos.position + _muzzlePos.forward * zeroDistances[currentZeroDistance]; ((Component)reticle).transform.LookAt(val, ((Component)reticle).transform.up); _materialPropertyBlock.SetFloat("_RedDotDist", zeroDistances[currentZeroDistance]); } else { ((Component)reticle).transform.localRotation = _origReticleRotation; fireArm = null; _muzzlePos = null; } } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRInteractiveObject.SimpleInteraction -= new hook_SimpleInteraction(FVRInteractiveObject_SimpleInteraction); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRInteractiveObject.SimpleInteraction += new hook_SimpleInteraction(FVRInteractiveObject_SimpleInteraction); } private void FVRInteractiveObject_SimpleInteraction(orig_SimpleInteraction orig, FVRInteractiveObject self, FVRViveHand hand) { orig.Invoke(self, hand); if ((Object)(object)self == (Object)(object)reflexSightInterface) { UseNextTexture(); } } }
plugins/Attachable_Magazine.dll
Decompiled 10 months agousing 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 FistVR; using On.FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Attachable_Magazine")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Attachable_Magazine")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("756d19aa-c3dc-4fdc-ab01-314379156c9e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; [Obsolete("Attachable_Magazine is deprecated, please use Attachable_Magazine_MK2 instead.")] public class Attachable_Magazine : MonoBehaviour { public FVRFireArmMagazine mag; public FVRFireArmAttachment attachment; private bool magAttached; private Vector3 base_magPos; private Vector3 base_magEuler; private Vector3 secondary_magPos; private Vector3 secondary_magEuler; [HideInInspector] public bool mag_Ready; [HideInInspector] public bool attachment_Ready; public void Start() { if ((Object)(object)((Component)mag).transform.parent == (Object)(object)((Component)attachment).transform) { Transform parent = ((Component)attachment).transform.parent; SetBasePos(); UseSecondaryParenting(); SetSecondaryMagPos(); UseBaseParenting(parent); UseNormalTransform(); } else if ((Object)(object)((Component)attachment).transform.parent == (Object)(object)((Component)mag).transform) { Transform parent2 = ((Component)mag).transform.parent; SetSecondaryMagPos(); UseBaseParenting(); SetBasePos(); UseSecondaryParenting(); UseSecondaryTransform(); ((FVRPhysicalObject)mag).SetParentage(parent2); } ((FVRPhysicalObject)mag).StoreAndDestroyRigidbody(); Collider component = ((Component)mag).GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } if ((Object)(object)((Component)attachment).transform.parent == (Object)(object)((Component)mag).transform) { ((FVRPhysicalObject)attachment).StoreAndDestroyRigidbody(); } } public void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) if ((int)mag.State == 1 && !magAttached) { magAttached = true; ((FVRInteractiveObject)attachment).ForceBreakInteraction(); ((FVRInteractiveObject)attachment).IsHeld = false; ((FVRPhysicalObject)attachment).StoreAndDestroyRigidbody(); ((FVRPhysicalObject)attachment).SetParentage(((Component)mag).transform); List<Collider> list = new List<Collider>(); list.Add(((Component)attachment).GetComponent<Collider>()); ((FVRInteractiveObject)attachment).SetCollidersToLayer(list, true, "Default"); } else if ((int)mag.State == 0 && magAttached) { magAttached = false; ((FVRPhysicalObject)attachment).SetParentage((Transform)null); ((FVRPhysicalObject)attachment).RecoverRigidbody(); FVRViveHand val = null; val = ((FVRInteractiveObject)mag).m_hand; ((FVRInteractiveObject)mag).ForceBreakInteraction(); ((FVRPhysicalObject)mag).SetParentage(((Component)attachment).transform); ((FVRPhysicalObject)mag).StoreAndDestroyRigidbody(); if ((Object)(object)val != (Object)null) { val.ForceSetInteractable((FVRInteractiveObject)(object)attachment); ((FVRInteractiveObject)attachment).BeginInteraction(val); } List<Collider> list2 = new List<Collider>(); list2.Add(((Component)attachment).GetComponent<Collider>()); ((FVRInteractiveObject)attachment).SetCollidersToLayer(list2, true, "Interactable"); } if (magAttached) { UseSecondaryTransform(); return; } UseNormalTransform(); if ((Object)(object)((FVRInteractiveObject)attachment).m_hand != (Object)null) { MagEjectRound(); } } private void SetBasePos() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references) base_magPos = ((Component)mag).transform.localPosition; base_magEuler = ((Component)mag).transform.localEulerAngles; } private void SetSecondaryMagPos() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references) secondary_magPos = ((Component)attachment).transform.localPosition; secondary_magEuler = ((Component)attachment).transform.localEulerAngles; } private void UseNormalTransform() { //IL_000c: 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) ((Component)mag).transform.localPosition = base_magPos; ((Component)mag).transform.localEulerAngles = base_magEuler; } private void UseSecondaryTransform() { //IL_000c: 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) ((Component)attachment).transform.localPosition = secondary_magPos; ((Component)attachment).transform.localEulerAngles = secondary_magEuler; } private void UseBaseParenting(Transform parent = null) { ((Component)attachment).transform.SetParent(parent); ((Component)mag).transform.SetParent(((Component)attachment).transform); } private void UseSecondaryParenting() { ((Component)mag).transform.SetParent((Transform)null); ((FVRPhysicalObject)attachment).SetParentage(((Component)mag).transform); } public void MagEjectRound() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0482: 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_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) if (!mag.CanManuallyEjectRounds || !((Object)(object)mag.RoundEjectionPos != (Object)null) || !mag.HasARound()) { return; } bool flag = false; if (((FVRInteractiveObject)attachment).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)attachment).m_hand.Input.BYButtonDown) { flag = true; } else if (!((FVRInteractiveObject)attachment).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)attachment).m_hand.Input.TouchpadDown && Vector2.Angle(((FVRInteractiveObject)attachment).m_hand.Input.TouchpadAxes, Vector2.up) < 45f) { flag = true; } if (flag) { if ((Object)(object)mag.FireArm != (Object)null) { mag.FireArm.PlayAudioEvent((FirearmAudioEventType)29, 1f); } else { SM.PlayGenericSound(mag.Profile.MagazineEjectRound, ((Component)this).transform.position); } if ((Object)(object)((FVRInteractiveObject)attachment).m_hand.OtherHand.CurrentInteractable == (Object)null && ((FVRInteractiveObject)attachment).m_hand.OtherHand.Input.IsGrabbing && Vector3.Distance(mag.RoundEjectionPos.position, ((HandInput)(ref ((FVRInteractiveObject)attachment).m_hand.OtherHand.Input)).Pos) < 0.15f) { FVRFireArmRound component = Object.Instantiate<GameObject>(mag.RemoveRound(false), mag.RoundEjectionPos.position, mag.RoundEjectionPos.rotation).GetComponent<FVRFireArmRound>(); ((FVRPhysicalObject)component).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); ((FVRInteractiveObject)attachment).m_hand.OtherHand.ForceSetInteractable((FVRInteractiveObject)(object)component); ((FVRInteractiveObject)component).BeginInteraction(((FVRInteractiveObject)attachment).m_hand.OtherHand); } else if (((FVRInteractiveObject)attachment).m_hand.OtherHand.CurrentInteractable is FVRFireArmRound && ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.OtherHand.CurrentInteractable).RoundType == mag.RoundType && ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.OtherHand.CurrentInteractable).ProxyRounds.Count < ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.OtherHand.CurrentInteractable).MaxPalmedAmount && Vector3.Distance(((HandInput)(ref ((FVRInteractiveObject)attachment).m_hand.Input)).Pos, ((HandInput)(ref ((FVRInteractiveObject)attachment).m_hand.OtherHand.Input)).Pos) < 0.15f) { FireArmRoundClass lR_Class = mag.LoadedRounds[mag.m_numRounds - 1].LR_Class; FVRObject lR_ObjectWrapper = mag.LoadedRounds[mag.m_numRounds - 1].LR_ObjectWrapper; ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.OtherHand.CurrentInteractable).AddProxy(lR_Class, lR_ObjectWrapper); ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.OtherHand.CurrentInteractable).UpdateProxyDisplay(); mag.RemoveRound(); } else if ((Object)(object)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty != (Object)null && (Object)(object)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty.HeldObject == (Object)null) { FVRFireArmRound component2 = Object.Instantiate<GameObject>(mag.RemoveRound(false), mag.RoundEjectionPos.position, mag.RoundEjectionPos.rotation).GetComponent<FVRFireArmRound>(); ((FVRPhysicalObject)component2).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); ((FVRPhysicalObject)component2).SetQuickBeltSlot(((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty); } else if ((Object)(object)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty != (Object)null && ((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty.HeldObject is FVRFireArmRound && ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).RoundType == mag.RoundType && ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).ProxyRounds.Count < ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).MaxPalmedAmount) { FireArmRoundClass lR_Class2 = mag.LoadedRounds[mag.m_numRounds - 1].LR_Class; FVRObject lR_ObjectWrapper2 = mag.LoadedRounds[mag.m_numRounds - 1].LR_ObjectWrapper; ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).AddProxy(lR_Class2, lR_ObjectWrapper2); ((FVRFireArmRound)((FVRInteractiveObject)attachment).m_hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).UpdateProxyDisplay(); mag.RemoveRound(); } else { GameObject val = Object.Instantiate<GameObject>(mag.RemoveRound(false), mag.RoundEjectionPos.position, mag.RoundEjectionPos.rotation); ((FVRPhysicalObject)val.GetComponent<FVRFireArmRound>()).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); val.GetComponent<Rigidbody>().AddForce(val.transform.forward * 0.5f); } } } private IEnumerator Wait() { while (!mag_Ready || !attachment_Ready) { yield return null; } ((FVRPhysicalObject)mag).StoreAndDestroyRigidbody(); Collider component = ((Component)mag).GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } if ((Object)(object)((Component)attachment).transform.parent == (Object)(object)((Component)mag).transform) { ((FVRPhysicalObject)attachment).StoreAndDestroyRigidbody(); } } } public class Attachable_Magazine_MK2 : MonoBehaviour { public FVRFireArmMagazine mag; public FVRFireArmAttachment attachment; public bool attachInstantly; private bool attachmentLocked; private FVRFireArmReloadTriggerMag reloadTriggerMag; private Vector3 base_attachmentPos; private Vector3 base_attachmentEuler; private Vector3 secondary_attachmentPos; private Vector3 secondary_attachmentEuler; public void Start() { Hook(); if ((Object)(object)((Component)attachment).transform.parent == (Object)(object)((Component)mag).transform) { Transform parent = ((Component)mag).transform.parent; SetBaseTransform(); UseSecondaryParenting(); SetSecondaryTransform(); UseBaseParenting(parent); UseBaseTransform(); } else if ((Object)(object)((Component)mag).transform.parent == (Object)(object)((Component)attachment).transform) { Transform parent2 = ((Component)attachment).transform.parent; SetSecondaryTransform(); UseBaseParenting(); SetBaseTransform(); UseSecondaryParenting(parent2); UseSecondaryTransform(); attachmentLocked = true; attachment.Sensor.CurHoveredMount = attachment.curMount; } else { Debug.LogError((object)"Attachable Mag Setup failed!"); } if ((Object)(object)((Component)mag).transform.parent == (Object)(object)((Component)attachment).transform) { ((FVRPhysicalObject)mag).StoreAndDestroyRigidbody(); ((Component)mag).gameObject.layer = LayerMask.NameToLayer("NoCol"); } else { ((FVRPhysicalObject)attachment).StoreAndDestroyRigidbody(); ((Component)attachment).gameObject.layer = LayerMask.NameToLayer("NoCol"); } reloadTriggerMag = ((Component)mag).GetComponentInChildren<FVRFireArmReloadTriggerMag>(); } public void Update() { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 if ((!((Object)(object)attachment.Sensor.CurHoveredMount != (Object)null) || attachmentLocked) && (Object)(object)attachment.Sensor.CurHoveredMount == (Object)null && attachmentLocked) { attachmentLocked = false; ((Component)attachment).gameObject.layer = LayerMask.NameToLayer("NoCol"); ((FVRPhysicalObject)mag).SetParentage((Transform)null); ((FVRPhysicalObject)mag).RecoverRigidbody(); FVRViveHand hand = ((FVRInteractiveObject)attachment).m_hand; ((FVRInteractiveObject)attachment).ForceBreakInteraction(); ((FVRPhysicalObject)attachment).SetParentage(((Component)mag).transform); ((FVRPhysicalObject)attachment).StoreAndDestroyRigidbody(); if ((Object)(object)hand != (Object)null) { hand.ForceSetInteractable((FVRInteractiveObject)(object)mag); ((FVRInteractiveObject)mag).BeginInteraction(hand); } ((Component)mag).gameObject.layer = LayerMask.NameToLayer("Interactable"); } if (attachmentLocked) { UseSecondaryTransform(); } else { UseBaseTransform(); } if ((int)mag.State == 1) { ((Component)attachment.Sensor).gameObject.layer = LayerMask.NameToLayer("NoCol"); return; } if (((FVRInteractiveObject)attachment).IsHovered) { ((Component)reloadTriggerMag).gameObject.layer = LayerMask.NameToLayer("NoCol"); return; } ((Component)attachment.Sensor).gameObject.layer = LayerMask.NameToLayer("Interactable"); ((Component)reloadTriggerMag).gameObject.layer = LayerMask.NameToLayer("Interactable"); } private void SetBaseTransform() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references) base_attachmentPos = ((Component)attachment).transform.localPosition; base_attachmentEuler = ((Component)attachment).transform.localEulerAngles; } private void SetSecondaryTransform() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references) secondary_attachmentPos = ((Component)mag).transform.localPosition; secondary_attachmentEuler = ((Component)mag).transform.localEulerAngles; } private void UseBaseTransform() { //IL_000c: 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) ((Component)attachment).transform.localPosition = base_attachmentPos; ((Component)attachment).transform.localEulerAngles = base_attachmentEuler; } private void UseSecondaryTransform() { //IL_000c: 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) ((Component)mag).transform.localPosition = secondary_attachmentPos; ((Component)mag).transform.localEulerAngles = secondary_attachmentEuler; } private void UseBaseParenting(Transform magParent = null) { ((FVRPhysicalObject)mag).SetParentage(magParent); ((FVRPhysicalObject)attachment).SetParentage(((Component)mag).transform); } private void UseSecondaryParenting(Transform attachmentParent = null) { ((FVRPhysicalObject)attachment).SetParentage(attachmentParent); ((FVRPhysicalObject)mag).SetParentage(((Component)attachment).transform); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRFireArmAttachmentSensor.OnTriggerEnter += new hook_OnTriggerEnter(FVRFireArmAttachmentSensor_OnTriggerEnter); } private void FVRFireArmAttachmentSensor_OnTriggerEnter(orig_OnTriggerEnter orig, FVRFireArmAttachmentSensor self, Collider collider) { //IL_005b: 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) if ((Object)(object)self == (Object)(object)attachment.Sensor) { if (!((Object)(object)self.CurHoveredMount == (Object)null) || !self.Attachment.CanAttach() || !(((Component)collider).gameObject.tag == "FVRFireArmAttachmentMount")) { return; } FVRFireArmAttachmentMount component = ((Component)collider).gameObject.GetComponent<FVRFireArmAttachmentMount>(); if (component.Type != self.Attachment.Type || !component.isMountableOn(self.Attachment)) { return; } if (!attachInstantly) { if (!attachmentLocked) { StartHoverMode(); } self.SetHoveredMount(component); component.BeginHover(); } else { self.SetHoveredMount(component); if (!attachmentLocked) { InstantlyAttachToMount(component); } } } else { orig.Invoke(self, collider); } } private void StartHoverMode() { attachmentLocked = true; ((FVRPhysicalObject)attachment).RecoverRigidbody(); ((Component)attachment.AttachmentInterface).gameObject.layer = LayerMask.NameToLayer("Interactable"); FVRViveHand hand = ((FVRInteractiveObject)mag).m_hand; ((FVRInteractiveObject)mag).ForceBreakInteraction(); hand.ForceSetInteractable((FVRInteractiveObject)(object)attachment); ((FVRInteractiveObject)attachment).BeginInteraction(hand); ((FVRPhysicalObject)mag).StoreAndDestroyRigidbody(); ((FVRPhysicalObject)mag).SetParentage(((Component)attachment).transform); ((Component)mag).gameObject.layer = LayerMask.NameToLayer("NoCol"); } private void InstantlyAttachToMount(FVRFireArmAttachmentMount mount) { attachmentLocked = true; ((FVRInteractiveObject)mag).ForceBreakInteraction(); ((FVRPhysicalObject)mag).StoreAndDestroyRigidbody(); ((FVRPhysicalObject)attachment).RecoverRigidbody(); ((Component)attachment.AttachmentInterface).gameObject.layer = LayerMask.NameToLayer("Interactable"); UseSecondaryParenting(); attachment.AttachToMount(mount, true); ((Component)mag).gameObject.layer = LayerMask.NameToLayer("NoCol"); } }
plugins/AttachmentMountParentToThis.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("AttachmentMountParentToThis")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AttachmentMountParentToThis")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e6aab745-7af6-4fae-a54b-5ef72ea2ba3d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class AttachmentMountParentToThis : MonoBehaviour { public FVRFireArmAttachmentMount mount; public void Awake() { ((Component)mount).gameObject.AddComponent<AttachmentMountParentToThis>(); Object.Destroy((Object)(object)this); } }
plugins/AttachmentStock.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("AttachmentStock")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AttachmentStock")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d3a36f33-2ac5-4636-b4d3-32945d57ef98")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class AttachmentStock : FVRFireArmAttachment { [Header("VirtualStock config")] public bool HasActiveShoulderStock = true; public Transform StockPos; public override bool HasStockPos() { return HasActiveShoulderStock; } public override Transform GetStockPos() { return StockPos; } }
plugins/BreakActionWeapon_BarrelSwitch.dll
Decompiled 10 months agousing 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 OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BreakActionWeapon_BarrelSwitch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BreakActionWeapon_BarrelSwitch")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6f928133-cd8e-47ad-9cae-415ea4ade851")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class BreakActionWeapon_BarrelSwitch : MonoBehaviour { public enum Axis { x, y, z } public enum TransformType { translation, rotation } private enum SelectedBarrelGroup { primary, secondary } private class BarrelGroup { public List<int> indexList; public List<BreakActionBarrel> Barrels; public BarrelGroup() { indexList = new List<int>(); Barrels = new List<BreakActionBarrel>(); } } public BreakActionWeapon breakActionWeapon; public int[] primaryBarrelGroupIndex; public int[] secondaryBarrelGroupIndex; public bool hasFireSelector; public GameObject fireSelector; public TransformType transformType; public Axis axis; public float primaryMode; public float secondaryMode; private BarrelGroup primaryBarrelGroup = new BarrelGroup(); private BarrelGroup secondaryBarrelGroup = new BarrelGroup(); private SelectedBarrelGroup selectedBarrelGroup; private Transform origTransformFireSelector; public void Awake() { //IL_005f: 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) ((Component)this).gameObject.SetActive(false); BreakActionWeaponBarrelSwitch obj = ((Component)this).gameObject.AddComponent<BreakActionWeaponBarrelSwitch>(); obj.BreakActionWeapon = breakActionWeapon; obj.PrimaryBarrelGroupIndex = primaryBarrelGroupIndex; obj.SecondaryBarrelGroupIndex = secondaryBarrelGroupIndex; obj.HasFireSelector = hasFireSelector; obj.FireSelector = fireSelector.transform; obj.transformType = (TransformType)transformType; obj.TransformAxis = (Axis)axis; obj.FireSelectorInPrimaryMode = primaryMode; obj.FireSelectorInSecondaryMode = secondaryMode; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/CapAndBallRevolver.dll
Decompiled 10 months agousing 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 OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("CapAndBallRevolver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CapAndBallRevolver")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3953e6fb-eb76-4ee6-88ea-36e58a9256a0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class CapAndBallRevolver : SingleActionRevolver { [Header("Cap and Ball Revolver Config")] public Transform ramRodLever; public Vector3 lowerLimit; public Vector3 upperLimit; public Vector3 touchingRot; public float wiggleRoom = 5f; public int numberOfChambersBackwardsToRam; private CapAndBallRevolverCylinder CapCylinder; private int lastChamber = -1; private bool isRamRodExtended; public int RammingChamber { get { int num = ((SingleActionRevolver)this).CurChamber - numberOfChambersBackwardsToRam; if (num < 0) { return base.Cylinder.NumChambers + num; } return num; } } public int PrevChamber3 { get { int num = ((SingleActionRevolver)this).CurChamber - 3; if (num < 0) { return base.Cylinder.NumChambers + num; } return num; } } public override void Start() { ((FVRInteractiveObject)this).Start(); Hook(); CapCylinder = base.Cylinder as CapAndBallRevolverCylinder; numberOfChambersBackwardsToRam = Mathf.Abs(numberOfChambersBackwardsToRam); } public override void OnDestroy() { Unhook(); ((FVRPhysicalObject)this).OnDestroy(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown SingleActionRevolver.Fire -= new hook_Fire(SingleActionRevolver_Fire); SingleActionRevolver.EjectPrevCylinder -= new hook_EjectPrevCylinder(SingleActionRevolver_EjectPrevCylinder); SingleActionRevolver.UpdateCylinderRot -= new hook_UpdateCylinderRot(SingleActionRevolver_UpdateCylinderRot); SingleActionRevolver.AdvanceCylinder -= new hook_AdvanceCylinder(SingleActionRevolver_AdvanceCylinder); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown SingleActionRevolver.Fire += new hook_Fire(SingleActionRevolver_Fire); SingleActionRevolver.EjectPrevCylinder += new hook_EjectPrevCylinder(SingleActionRevolver_EjectPrevCylinder); SingleActionRevolver.UpdateCylinderRot += new hook_UpdateCylinderRot(SingleActionRevolver_UpdateCylinderRot); SingleActionRevolver.AdvanceCylinder += new hook_AdvanceCylinder(SingleActionRevolver_AdvanceCylinder); } public override void FVRUpdate() { //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_0030: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007d: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).FVRUpdate(); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(wiggleRoom, wiggleRoom, wiggleRoom); if (ramRodLever.localEulerAngles.IsLesserOrEqual(lowerLimit + val) && ramRodLever.localEulerAngles.IsGreaterOrEqual(lowerLimit - val)) { isRamRodExtended = false; } else { isRamRodExtended = true; } float num = ExtendingVector3.InverseLerp(touchingRot, upperLimit, ramRodLever.localEulerAngles); if (((SingleActionRevolverCylinder)CapCylinder).Chambers[RammingChamber].IsFull && num > 0f) { CapCylinder.RamChamber(RammingChamber, num); } } private void SingleActionRevolver_AdvanceCylinder(orig_AdvanceCylinder orig, SingleActionRevolver self) { if ((Object)(object)self == (Object)(object)this) { if (!isRamRodExtended && (CapCylinder.ChamberRammed(RammingChamber) || !((SingleActionRevolverCylinder)CapCylinder).Chambers[RammingChamber].IsFull)) { if (lastChamber == ((SingleActionRevolver)this).CurChamber) { lastChamber--; } else { int curChamber = ((SingleActionRevolver)this).CurChamber; ((SingleActionRevolver)this).CurChamber = curChamber + 1; lastChamber = ((SingleActionRevolver)this).CurChamber; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); } } else { orig.Invoke(self); } } private void SingleActionRevolver_UpdateCylinderRot(orig_UpdateCylinderRot orig, SingleActionRevolver self) { //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_022e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)this) { if (base.m_isStateToggled) { int num = ((SingleActionRevolver)this).PrevChamber; if (base.IsAccessTwoChambersBack) { num = ((SingleActionRevolver)this).PrevChamber2; } for (int i = 0; i < ((SingleActionRevolverCylinder)CapCylinder).Chambers.Length; i++) { ((SingleActionRevolverCylinder)CapCylinder).Chambers[i].IsAccessible = i == num; CapCylinder.capNipples[i].IsAccessible = i == num; if (lastChamber == ((SingleActionRevolver)this).CurChamber) { if (!base.IsAccessTwoChambersBack) { ((SingleActionRevolverCylinder)CapCylinder).Chambers[i].IsAccessible = i == ((SingleActionRevolver)this).PrevChamber2; CapCylinder.capNipples[i].IsAccessible = i == ((SingleActionRevolver)this).PrevChamber2; } else { ((SingleActionRevolverCylinder)CapCylinder).Chambers[i].IsAccessible = i == PrevChamber3; CapCylinder.capNipples[i].IsAccessible = i == PrevChamber3; } } } if (base.DoesHalfCockHalfRotCylinder) { int num2 = (((SingleActionRevolver)this).CurChamber + 1) % ((SingleActionRevolverCylinder)CapCylinder).NumChambers; ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num2), 0.5f); if (lastChamber == ((SingleActionRevolver)this).CurChamber) { ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num2), 0f); } } else { int num3 = (((SingleActionRevolver)this).CurChamber + 1) % ((SingleActionRevolverCylinder)CapCylinder).NumChambers; ((Component)CapCylinder).transform.localRotation = ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber); if (lastChamber == ((SingleActionRevolver)this).CurChamber) { ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num3), 0.5f); } } if (base.DoesCylinderTranslateForward) { ((Component)CapCylinder).transform.localPosition = base.CylinderBackPos; } } else { for (int j = 0; j < ((SingleActionRevolverCylinder)CapCylinder).Chambers.Length; j++) { ((SingleActionRevolverCylinder)CapCylinder).Chambers[j].IsAccessible = false; CapCylinder.capNipples[j].IsAccessible = false; } base.m_tarChamberLerp = ((!base.m_isHammerCocking) ? 0f : base.m_hammerCockLerp); base.m_curChamberLerp = Mathf.Lerp(base.m_curChamberLerp, base.m_tarChamberLerp, Time.deltaTime * 16f); int num4 = (((SingleActionRevolver)this).CurChamber + 1) % ((SingleActionRevolverCylinder)CapCylinder).NumChambers; ((Component)CapCylinder).transform.localRotation = Quaternion.Slerp(((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(((SingleActionRevolver)this).CurChamber), ((SingleActionRevolverCylinder)CapCylinder).GetLocalRotationFromCylinder(num4), base.m_curChamberLerp); if (base.DoesCylinderTranslateForward) { ((Component)CapCylinder).transform.localPosition = Vector3.Lerp(base.CylinderBackPos, base.CylinderFrontPos, base.m_hammerCockLerp); } } } else { orig.Invoke(self); } } private void SingleActionRevolver_EjectPrevCylinder(orig_EjectPrevCylinder orig, SingleActionRevolver self) { if ((Object)(object)self != (Object)(object)this) { orig.Invoke(self); } } private void SingleActionRevolver_Fire(orig_Fire orig, SingleActionRevolver self) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)this) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); bool num = CapCylinder.capNipples[((SingleActionRevolver)this).CurChamber].Fire(); if (num) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)102, 1f); } if (num && CapCylinder.ChamberRammed(((SingleActionRevolver)this).CurChamber) && ((SingleActionRevolverCylinder)CapCylinder).Chambers[((SingleActionRevolver)this).CurChamber].Fire()) { FVRFireArmChamber val = ((SingleActionRevolverCylinder)CapCylinder).Chambers[((SingleActionRevolver)this).CurChamber]; ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite && GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; CapCylinder.capNipples[((SingleActionRevolver)this).CurChamber].IsSpent = false; val.UpdateProxyDisplay(); } else { val.SetRound((FVRFireArmRound)null, false); CapCylinder.ChamberRammed(((SingleActionRevolver)this).CurChamber, set: true); } } } else { orig.Invoke(self); } } } public static class ExtendingVector3 { public static bool IsGreaterOrEqual(this Vector3 local, Vector3 other) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001c: 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) if (local.x >= other.x && local.y >= other.y && local.z >= other.z) { return true; } return false; } public static bool IsLesserOrEqual(this Vector3 local, Vector3 other) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001c: 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) if (local.x <= other.x && local.y <= other.y && local.z <= other.z) { return true; } return false; } public static float InverseLerp(Vector3 a, Vector3 b, Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0009: 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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) Vector3 val = b - a; return Mathf.Clamp01(Vector3.Dot(value - a, val) / Vector3.Dot(val, val)); } } public class CapAndBallRevolverCylinder : SingleActionRevolverCylinder { public FVRFireArmChamber[] capNipples; public float unrammedPos; public float rammedPos; private bool[] chamberRammed; private float[] lastLerp; public void Awake() { //IL_0040: 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_0067: Unknown result type (might be due to invalid IL or missing references) chamberRammed = new bool[base.NumChambers]; lastLerp = new float[base.NumChambers]; for (int i = 0; i < base.NumChambers; i++) { ((Component)base.Chambers[i]).transform.localPosition = new Vector3(((Component)base.Chambers[i]).transform.localPosition.x, ((Component)base.Chambers[i]).transform.localPosition.y, unrammedPos); chamberRammed[i] = false; lastLerp[i] = 0f; } } public bool ChamberRammed(int chamber, bool set = false, bool value = false) { //IL_0079: 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_00a0: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (set) { chamberRammed[chamber] = value; if (value) { ((Component)base.Chambers[chamber]).transform.localPosition = new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, rammedPos); } else { ((Component)base.Chambers[chamber]).transform.localPosition = new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, unrammedPos); } } return chamberRammed[chamber]; } public void RamChamber(int chamber, float lerp) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0088: 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_00a1: Unknown result type (might be due to invalid IL or missing references) if (!chamberRammed[chamber] && lerp > lastLerp[chamber]) { Vector3 localPosition = Vector3.Lerp(new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, unrammedPos), new Vector3(((Component)base.Chambers[chamber]).transform.localPosition.x, ((Component)base.Chambers[chamber]).transform.localPosition.y, rammedPos), lerp); ((Component)base.Chambers[chamber]).transform.localPosition = localPosition; lastLerp[chamber] = lerp; if (lerp == 1f) { chamberRammed[chamber] = true; lastLerp[chamber] = 0f; } } } } public class PaperCartridgeRenderer : MonoBehaviour { public FVRFireArmChamber chamber; public Mesh cartridgeMesh; public Material cartridgeMaterial; private GameObject _proxyGameObject; private MeshFilter _proxyMeshFilter; private MeshRenderer _proxyMeshRenderer; private static readonly Dictionary<FVRFireArmChamber, PaperCartridgeRenderer> _existingPaperCartridgeRenderers = new Dictionary<FVRFireArmChamber, PaperCartridgeRenderer>(); private static readonly Dictionary<Mesh, GameObject> _paperCartridgeMeshProxyDictionary = new Dictionary<Mesh, GameObject>(); public void Awake() { ((Component)this).gameObject.SetActive(false); PaperCartridgeRenderer obj = ((Component)this).gameObject.AddComponent<PaperCartridgeRenderer>(); obj.Chamber = chamber; obj.CartridgeMesh = cartridgeMesh; obj.CartridgeMaterial = cartridgeMaterial; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/CustomQuickBeltSlots.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using On.FistVR; using OpenScripts2; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("QuickBinSlot")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("QuickBinSlot")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b6975da5-0fac-43ba-b1f0-c507ca262ff7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; [RequireComponent(typeof(FVRQuickBeltSlot))] public class CustomQBSlotSounds : MonoBehaviour { public AudioEvent insertSound; public AudioEvent extractSound; private FVRQuickBeltSlot slot; private bool slotHasItem; private bool isHooked; public void Awake() { ((Component)this).gameObject.SetActive(false); CustomQBSlotSounds obj = ((Component)this).gameObject.AddComponent<CustomQBSlotSounds>(); obj.InsertSounds = insertSound; obj.ExtractSounds = extractSound; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class QuickBeltAreaCollisionDetector : MonoBehaviour { public QuickBeltArea ConnectedQuickBeltArea; [HideInInspector] public FVRPhysicalObject PhysicalObjectToDetect; public void OnCollisionEnter(Collision col) { if (col != null && !((Object)(object)col.collider == (Object)null) && !((Object)(object)col.collider.attachedRigidbody == (Object)null)) { FVRPhysicalObject component = ((Component)col.collider.attachedRigidbody).GetComponent<FVRPhysicalObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)PhysicalObjectToDetect) { ConnectedQuickBeltArea.ItemDidCollide = true; PhysicalObjectToDetect = null; } } } } public class QuickBeltArea : StandaloneQBSlot { private class SubQBSlot { public StandaloneQBSlot slot; public Vector3 localPos; public Quaternion localRot; private SubQBSlot(StandaloneQBSlot slot, Vector3 localPos, Quaternion localRot) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) this.slot = slot; this.localPos = localPos; this.localRot = localRot; } } public FVRPhysicalObject MainObject; [Tooltip("Preconfigured QBSlot that will be used as a reference to create all other slots.")] public GameObject SubQBSlotPrefab; [Tooltip("Please try to use base 2 numbers, like 2 ,4 ,8 ,16 ,32 ,64 etc.")] public int ItemLimit = 32; [Header("Advanced Size Options")] public bool UsesAdvancedSizeMode; [Tooltip("Capacity requirement for items of size Small, Medium, Large, Massive, CantCarryBig")] public int[] Sizes = new int[5] { 1, 2, 5, 10, 25 }; public int TotalCapacity = 50; [Header("Collision Settings")] public bool ObjectsKeepCollision; [Tooltip("This setting requires a manually placed QuickBeltAreaCollisionDetector on the FVRPhysicalObject.")] public bool CollisionActivatedFreeze; public QuickBeltAreaCollisionDetector CollisionDetector; public bool SetKinematic; [HideInInspector] public bool ItemDidCollide; private Dictionary<FVRQuickBeltSlot, FVRPhysicalObject> _quickBeltSlots; private FVRPhysicalObjectSize[] _sizes = (FVRPhysicalObjectSize[])(object)new FVRPhysicalObjectSize[5] { default(FVRPhysicalObjectSize), (FVRPhysicalObjectSize)1, (FVRPhysicalObjectSize)2, (FVRPhysicalObjectSize)3, (FVRPhysicalObjectSize)5 }; private Dictionary<FVRPhysicalObjectSize, int> _SizeRequirements; private int _currentLoad; public override void OnDestroy() { Unhook(); } public override void Start() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) base.Start(); Hook(); if ((Object)(object)MainObject == (Object)null) { FVRPhysicalObject component = ((Component)this).GetComponent<FVRPhysicalObject>(); while ((Object)(object)component == (Object)null) { component = ((Component)((Component)this).transform.parent).GetComponent<FVRPhysicalObject>(); } MainObject = component; } _quickBeltSlots = new Dictionary<FVRQuickBeltSlot, FVRPhysicalObject>(); _SizeRequirements = new Dictionary<FVRPhysicalObjectSize, int>(); for (int i = 0; i < _sizes.Length; i++) { _SizeRequirements.Add(_sizes[i], Sizes[i]); } List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>(); for (int j = 0; j < ItemLimit; j++) { FVRQuickBeltSlot component2 = Object.Instantiate<GameObject>(SubQBSlotPrefab).GetComponent<FVRQuickBeltSlot>(); ((Object)((Component)component2).gameObject).name = "QuickBeltAreaSubSlot_" + _quickBeltSlots.Count; ((Component)component2).gameObject.transform.parent = ((Component)this).transform; ((Component)component2).gameObject.transform.localPosition = Vector3.zero; ((Component)component2).gameObject.transform.localRotation = Quaternion.identity; Dictionary<string, string> flagDic = MainObject.GetFlagDic(); string key = "QuickBeltAreaSubSlot_" + _quickBeltSlots.Count; Vector3 zero = Vector3.zero; string text = ((Vector3)(ref zero)).ToString("F6"); Quaternion identity = Quaternion.identity; flagDic.Add(key, text + ";" + ((Quaternion)(ref identity)).ToString("F6")); _quickBeltSlots.Add(component2, null); list.Add(component2); } MainObject.Slots.Concat(list.ToArray()); SubQBSlotPrefab.SetActive(false); } public void LateUpdate() { //IL_00e8: 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_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_0104: 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_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) if (!CollisionActivatedFreeze && (Object)(object)((FVRQuickBeltSlot)this).CurObject != (Object)null) { CreateNewQBSlotPos(((FVRQuickBeltSlot)this).CurObject); } else if ((Object)(object)((FVRQuickBeltSlot)this).CurObject != (Object)null) { ((MonoBehaviour)this).StartCoroutine(WaitForCollision(((FVRQuickBeltSlot)this).CurObject)); } List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>(); foreach (KeyValuePair<FVRQuickBeltSlot, FVRPhysicalObject> quickBeltSlot in _quickBeltSlots) { FVRQuickBeltSlot key = quickBeltSlot.Key; if ((Object)(object)key.CurObject != (Object)null && !key.CurObject.m_isSpawnLock && !key.CurObject.m_isHardnessed) { key.HoverGeo.SetActive(false); } if (ObjectsKeepCollision && (Object)(object)key.CurObject != (Object)null) { ((FVRInteractiveObject)key.CurObject).SetAllCollidersToLayer(false, "Default"); } if (SetKinematic && (Object)(object)key.CurObject != (Object)null && ((Component)key.CurObject).transform.localPosition != Vector3.zero) { ((Component)key.CurObject).transform.localPosition = Vector3.zero; } if (SetKinematic && (Object)(object)key.CurObject != (Object)null && ((Component)key.CurObject).transform.localRotation != Quaternion.identity) { ((Component)key.CurObject).transform.localRotation = Quaternion.identity; } } foreach (KeyValuePair<FVRQuickBeltSlot, FVRPhysicalObject> quickBeltSlot2 in _quickBeltSlots) { if ((Object)(object)quickBeltSlot2.Value != (Object)(object)quickBeltSlot2.Key.CurObject) { list.Add(quickBeltSlot2.Key); } } foreach (FVRQuickBeltSlot item in list) { if (UsesAdvancedSizeMode) { FVRPhysicalObjectSize sizeLimit = item.SizeLimit; int value = 0; _SizeRequirements.TryGetValue(sizeLimit, out value); _currentLoad -= value; } _quickBeltSlots[item] = null; } if (UsesAdvancedSizeMode) { if (_currentLoad >= TotalCapacity) { ((FVRQuickBeltSlot)this).IsSelectable = false; } else { ((FVRQuickBeltSlot)this).IsSelectable = true; } } } public void CreateNewQBSlotPos(FVRPhysicalObject physicalObject) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_003b: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_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_00a2: 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_0082: Invalid comparison between Unknown and I4 //IL_0143: 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_014b: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) FVRPhysicalObjectSize size = physicalObject.Size; Vector3 position = ((Component)physicalObject).transform.position; Quaternion rotation = ((Component)physicalObject).transform.rotation; if (!SetKinematic && (Object)(object)((FVRInteractiveObject)physicalObject).QBPoseOverride != (Object)null) { position = ((FVRInteractiveObject)physicalObject).QBPoseOverride.position; rotation = ((FVRInteractiveObject)physicalObject).QBPoseOverride.rotation; _ = ((FVRInteractiveObject)physicalObject).QBPoseOverride.localRotation; } else if (!SetKinematic && (Object)(object)((FVRInteractiveObject)physicalObject).PoseOverride_Touch != (Object)null && ((int)GM.HMDMode == 1 || (int)GM.HMDMode == 3)) { position = ((FVRInteractiveObject)physicalObject).PoseOverride_Touch.position; rotation = ((FVRInteractiveObject)physicalObject).PoseOverride_Touch.rotation; _ = ((FVRInteractiveObject)physicalObject).PoseOverride_Touch.localRotation; } else if (!SetKinematic && (Object)(object)((FVRInteractiveObject)physicalObject).PoseOverride != (Object)null) { position = ((FVRInteractiveObject)physicalObject).PoseOverride.position; rotation = ((FVRInteractiveObject)physicalObject).PoseOverride.rotation; _ = ((FVRInteractiveObject)physicalObject).PoseOverride.localRotation; } if (UsesAdvancedSizeMode) { int value = 0; _SizeRequirements.TryGetValue(size, out value); if (_currentLoad + value > TotalCapacity) { physicalObject.ForceObjectIntoInventorySlot((FVRQuickBeltSlot)null); return; } _currentLoad += value; } FVRQuickBeltSlot emptySlot = GetEmptySlot(); if ((Object)(object)emptySlot == (Object)null) { physicalObject.ForceObjectIntoInventorySlot((FVRQuickBeltSlot)null); } ((Component)emptySlot).transform.SetPositionAndRotation(position, rotation); emptySlot.SizeLimit = size; physicalObject.ForceObjectIntoInventorySlot(emptySlot); _quickBeltSlots[emptySlot] = physicalObject; if (SetKinematic) { physicalObject.RootRigidbody.isKinematic = true; ((Component)emptySlot).transform.rotation = rotation; } else { emptySlot.PoseOverride.rotation = rotation; } } private IEnumerator WaitForCollision(FVRPhysicalObject physicalObject) { physicalObject.SetParentage((Transform)null); physicalObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); ItemDidCollide = false; CollisionDetector.PhysicalObjectToDetect = physicalObject; while (!ItemDidCollide) { yield return null; } ItemDidCollide = false; CreateNewQBSlotPos(physicalObject); } private FVRQuickBeltSlot GetEmptySlot() { foreach (KeyValuePair<FVRQuickBeltSlot, FVRPhysicalObject> quickBeltSlot in _quickBeltSlots) { if ((Object)(object)quickBeltSlot.Value == (Object)null) { return quickBeltSlot.Key; } } return null; } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRPhysicalObject.ConfigureFromFlagDic -= new hook_ConfigureFromFlagDic(FVRPhysicalObject_ConfigureFromFlagDic); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRPhysicalObject.ConfigureFromFlagDic += new hook_ConfigureFromFlagDic(FVRPhysicalObject_ConfigureFromFlagDic); } private void FVRPhysicalObject_ConfigureFromFlagDic(orig_ConfigureFromFlagDic orig, FVRPhysicalObject self, Dictionary<string, string> f) { //IL_00df: 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) orig.Invoke(self, f); if ((Object)(object)MainObject == (Object)(object)self) { Vector3 localPosition = default(Vector3); Quaternion localRotation = default(Quaternion); for (int i = 0; i < ItemLimit; i++) { string[] array = f["QuickBeltAreaSubSlot_" + i].Replace(" ", "").Split(new char[1] { ';' }); string[] array2 = array[0].Split(new char[1] { ',' }); string[] array3 = array[1].Split(new char[1] { ',' }); ((Vector3)(ref localPosition))..ctor(float.Parse(array2[0]), float.Parse(array2[1]), float.Parse(array2[2])); ((Quaternion)(ref localRotation))..ctor(float.Parse(array3[0]), float.Parse(array3[1]), float.Parse(array3[2]), float.Parse(array3[3])); ((Component)_quickBeltSlots.ElementAt(i).Key).transform.localPosition = localPosition; ((Component)_quickBeltSlots.ElementAt(i).Key).transform.localRotation = localRotation; } } } } public class LeftHandModeIgnoreQBSlot : FVRQuickBeltSlot { public virtual void Start() { //IL_001b: 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_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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_0062: 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_0079: 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_009a: 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) if (GM.Options.QuickbeltOptions.QuickbeltHandedness > 0) { Vector3 forward = base.PoseOverride.forward; Vector3 up = base.PoseOverride.up; forward = Vector3.Reflect(forward, -((Component)this).transform.right); up = Vector3.Reflect(up, -((Component)this).transform.right); base.PoseOverride.rotation = Quaternion.LookRotation(forward, up); ((Component)this).transform.localPosition = new Vector3(0f - ((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, ((Component)this).transform.localPosition.z); } } } public class HolsterStockQBSlot : StandaloneQBSlot { public enum Axis { X, Y, Z } [Header("Holster Config")] public FVRPhysicalObject PhysicalObject; public Transform StockCap; public float CapClosed; public float CapOpen; public Axis axis; public override void Start() { base.Start(); Hook(); } public override void OnDestroy() { base.OnDestroy(); Unhook(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update -= new hook_Update(FVRQuickBeltSlot_Update); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update += new hook_Update(FVRQuickBeltSlot_Update); } private void FVRQuickBeltSlot_Update(orig_Update orig, FVRQuickBeltSlot self) { //IL_0102: 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_0139: 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_0170: 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) orig.Invoke(self); if ((Object)(object)((FVRQuickBeltSlot)this).HeldObject != (Object)null && (Object)(object)PhysicalObject.QuickbeltSlot != (Object)null) { ((Component)PhysicalObject).gameObject.layer = LayerMask.NameToLayer("Default"); ((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable"); PhysicalObject.QuickbeltSlot.IsSelectable = false; } else if ((Object)(object)((FVRQuickBeltSlot)this).HeldObject == (Object)null && (Object)(object)PhysicalObject.QuickbeltSlot != (Object)null) { ((Component)PhysicalObject).gameObject.layer = LayerMask.NameToLayer("Interactable"); ((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable"); PhysicalObject.QuickbeltSlot.IsSelectable = true; } else { ((Component)this).gameObject.layer = LayerMask.NameToLayer("Interactable"); } switch (axis) { case Axis.X: if (StockCap.localRotation == Quaternion.Euler(CapOpen, 0f, 0f)) { ((FVRQuickBeltSlot)this).IsSelectable = true; } else { ((FVRQuickBeltSlot)this).IsSelectable = false; } break; case Axis.Y: if (StockCap.localRotation == Quaternion.Euler(0f, CapOpen, 0f)) { ((FVRQuickBeltSlot)this).IsSelectable = true; } else { ((FVRQuickBeltSlot)this).IsSelectable = false; } break; case Axis.Z: if (StockCap.localRotation == Quaternion.Euler(0f, 0f, CapOpen)) { ((FVRQuickBeltSlot)this).IsSelectable = true; } else { ((FVRQuickBeltSlot)this).IsSelectable = false; } break; } } } public class WristMounted_ClosedBoltWeapon : MonoBehaviour { public ClosedBoltWeapon closedBoltWeapon; public bool requiresEmptyHand; public void Start() { Hook(); } public void OnDestroy() { Unhook(); } public void Update() { if (!((Object)(object)((FVRPhysicalObject)closedBoltWeapon).m_quickbeltSlot != (Object)null)) { return; } WristQBSlot wristQBSlot = ((FVRPhysicalObject)closedBoltWeapon).m_quickbeltSlot as WristQBSlot; if ((Object)(object)wristQBSlot != (Object)null && (Object)(object)wristQBSlot.Hand != (Object)null && (!requiresEmptyHand || !((Object)(object)wristQBSlot.Hand.CurrentInteractable != (Object)null))) { if (wristQBSlot.Hand.Input.TriggerFloat < 0.15f) { ((FVRInteractiveObject)closedBoltWeapon).m_hasTriggeredUpSinceBegin = true; } closedBoltWeapon.UpdateInputAndAnimate(wristQBSlot.Hand); } } private void Unhook() { } private void Hook() { } } public class WristItem : FVRPhysicalObject { [Header("WristItem Config")] public bool requiresEmptyHand; private WristQBSlot wristQBSlot; private FVRViveHand m_wristHand; public WristQBSlot WristQBSlot => wristQBSlot; public FVRViveHand WristHand => m_wristHand; public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); wristQBSlot = base.m_quickbeltSlot as WristQBSlot; if ((Object)(object)wristQBSlot != (Object)null) { if (requiresEmptyHand && (Object)(object)wristQBSlot.Hand.CurrentInteractable != (Object)null) { m_wristHand = null; } else { m_wristHand = wristQBSlot.Hand; } } else { m_wristHand = null; } } } public class WristQBSlot_Item_test : WristItem { [Header("WristQBSlot Config")] public MeshRenderer render; public override void FVRUpdate() { //IL_0068: 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) base.FVRUpdate(); if ((Object)(object)base.WristHand != (Object)null) { ((Renderer)render).material.color = new Color(base.WristHand.Input.TriggerFloat, 0f, 0f, 1f); } else { ((Renderer)render).material.color = new Color(0f, 0f, 0f, 1f); } } } public class WristQBSlot : FVRQuickBeltSlot { public enum Wrist { leftWrist, rightWrist } [Header("WristQBSlot Config")] public Vector3 wristOffsetPosition; public Vector3 wristOffsetRotation; [SearchableEnum] public Wrist wrist; private FVRViveHand m_hand; public FVRViveHand Hand => m_hand; [ContextMenu("CopyQBSlot")] public void CopyQBSlot() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) FVRQuickBeltSlot component = ((Component)this).GetComponent<FVRQuickBeltSlot>(); base.QuickbeltRoot = component.QuickbeltRoot; base.PoseOverride = component.PoseOverride; base.SizeLimit = component.SizeLimit; base.Shape = component.Shape; base.Type = component.Type; base.HoverGeo = component.HoverGeo; base.RectBounds = component.RectBounds; base.CurObject = component.CurObject; base.IsSelectable = component.IsSelectable; base.IsPlayer = component.IsPlayer; base.UseStraightAxisAlignment = component.UseStraightAxisAlignment; base.HeldObject = component.HeldObject; } public void Start() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.LeftHand != (Object)null && (Object)(object)GM.CurrentPlayerBody.RightHand != (Object)null) { switch (wrist) { case Wrist.leftWrist: ((Component)this).transform.SetParent(GM.CurrentPlayerBody.LeftHand); m_hand = GameObject.Find("Controller (left)").GetComponent<FVRViveHand>(); break; case Wrist.rightWrist: ((Component)this).transform.SetParent(GM.CurrentPlayerBody.RightHand); m_hand = GameObject.Find("Controller (right)").GetComponent<FVRViveHand>(); break; } } ((Component)this).transform.localPosition = wristOffsetPosition; ((Component)this).transform.localRotation = Quaternion.Euler(wristOffsetRotation); } public void OnDestroy() { } } public class StandaloneQBSlot : FVRQuickBeltSlot { public virtual void Start() { _ = (Object)(object)GM.CurrentPlayerBody != (Object)null; } public virtual void OnEnable() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { RegisterQuickbeltSlot(); } } public virtual void OnDisable() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { DeRegisterQuickbeltSlot(); } } public virtual void OnDestroy() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { DeRegisterQuickbeltSlot(); } } public void RegisterQuickbeltSlot() { } public void DeRegisterQuickbeltSlot() { } } public class QuickBinSlot : FVRQuickBeltSlot { [Header("QuickBinSlot settings")] public Color hoverColor; public AudioEvent deleteSound; public AudioEvent deleteFailureSound; [ContextMenu("CopyQBSlot")] public void CopyQBSlot() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) FVRQuickBeltSlot component = ((Component)this).GetComponent<FVRQuickBeltSlot>(); base.QuickbeltRoot = component.QuickbeltRoot; base.PoseOverride = component.PoseOverride; base.SizeLimit = component.SizeLimit; base.Shape = component.Shape; base.Type = component.Type; base.HoverGeo = component.HoverGeo; base.RectBounds = component.RectBounds; base.CurObject = component.CurObject; base.IsSelectable = component.IsSelectable; base.IsPlayer = component.IsPlayer; base.UseStraightAxisAlignment = component.UseStraightAxisAlignment; base.HeldObject = component.HeldObject; } public void Start() { Hook(); } public void OnDestroy() { Unhook(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update -= new hook_Update(FVRQuickBeltSlot_Update); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRQuickBeltSlot.Update += new hook_Update(FVRQuickBeltSlot_Update); } private void FVRQuickBeltSlot_Update(orig_Update orig, FVRQuickBeltSlot self) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)this == (Object)(object)self) { if (!GM.CurrentSceneSettings.IsSpawnLockingEnabled && (Object)(object)base.HeldObject != (Object)null && ((FVRPhysicalObject)/*isinst with value type is only supported in some contexts*/).m_isSpawnLock) { FVRInteractiveObject heldObject = base.HeldObject; ((FVRPhysicalObject)((heldObject is FVRPhysicalObject) ? heldObject : null)).m_isSpawnLock = false; } if ((Object)(object)base.HeldObject != (Object)null) { FVRInteractiveObject heldObject2 = base.HeldObject; if (((FVRPhysicalObject)((heldObject2 is FVRPhysicalObject) ? heldObject2 : null)).m_isSpawnLock) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 0.3f, 1f, 1f)); } else { FVRInteractiveObject heldObject3 = base.HeldObject; if (((FVRPhysicalObject)((heldObject3 is FVRPhysicalObject) ? heldObject3 : null)).m_isHardnessed) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 1f, 0.3f, 1f)); } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } } } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } if ((Object)(object)base.CurObject != (Object)null && base.CurObject is FVRFireArmMagazine) { Object.Destroy((Object)(object)((Component)base.CurObject).gameObject); base.CurObject = null; base.HeldObject = null; ((FVRQuickBeltSlot)this).IsHovered = false; SM.PlayGenericSound(deleteSound, ((Component)this).transform.position); } if ((Object)(object)base.CurObject != (Object)null && !(base.CurObject is FVRFireArmMagazine)) { base.CurObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); base.CurObject = null; base.HeldObject = null; ((FVRQuickBeltSlot)this).IsHovered = false; SM.PlayGenericSound(deleteFailureSound, ((Component)this).transform.position); } } else { orig.Invoke(self); } } } public class BottomlessSlotItem : MonoBehaviour { public struct BottomlessSlotItemIDs { public readonly int slotID; public readonly int itemID; public BottomlessSlotItemIDs(int slotID, int itemID) { this.slotID = slotID; this.itemID = itemID; } } private BottomlessSlotItemIDs iDs; private bool valueSet; public BottomlessSlotItemIDs IDs { get { return iDs; } set { if (!valueSet) { iDs = value; valueSet = false; return; } throw new AccessViolationException(); } } } public class QuickBottomlessSlot : FVRQuickBeltSlot { [Header("QuickBottomlessSlot settings")] public int maxItems = 30; public float timeBetweenMagSwitch = 0.25f; public Color hoverColor; public bool storesMagazines = true; public bool storesClips = true; public bool storesSpeedloaders = true; public bool onlyStoresEmpty; public AudioEvent insertSound; public AudioEvent extractSound; public AudioEvent failureSound; public GameObject canvas; public string textPrefix = "Items: "; public Text numberOfItemsDisplay; public bool textTurnsOffOnNoItemsStored = true; private GameObject currentSelectedObject; private List<GameObject> storedGameObjects; private bool switchingObject; private int selectedObjectIndex; private float timeWaited; [ContextMenu("CopyQBSlot")] public void CopyQBSlot() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) FVRQuickBeltSlot component = ((Component)this).GetComponent<FVRQuickBeltSlot>(); base.QuickbeltRoot = component.QuickbeltRoot; base.PoseOverride = component.PoseOverride; base.SizeLimit = component.SizeLimit; base.Shape = component.Shape; base.Type = component.Type; base.HoverGeo = component.HoverGeo; base.RectBounds = component.RectBounds; base.CurObject = component.CurObject; base.IsSelectable = component.IsSelectable; base.IsPlayer = component.IsPlayer; base.UseStraightAxisAlignment = component.UseStraightAxisAlignment; base.HeldObject = component.HeldObject; } public void Start() { storedGameObjects = new List<GameObject>(); Hook(); } public void OnDestroy() { Unhook(); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown FVRQuickBeltSlot.Update -= new hook_Update(FVRQuickBeltSlot_Update); FVRQuickBeltSlot.MoveContents -= new hook_MoveContents(FVRQuickBeltSlot_MoveContents); FVRQuickBeltSlot.MoveContentsInstant -= new hook_MoveContentsInstant(FVRQuickBeltSlot_MoveContentsInstant); FVRQuickBeltSlot.MoveContentsCheap -= new hook_MoveContentsCheap(FVRQuickBeltSlot_MoveContentsCheap); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown FVRQuickBeltSlot.Update += new hook_Update(FVRQuickBeltSlot_Update); FVRQuickBeltSlot.MoveContents += new hook_MoveContents(FVRQuickBeltSlot_MoveContents); FVRQuickBeltSlot.MoveContentsInstant += new hook_MoveContentsInstant(FVRQuickBeltSlot_MoveContentsInstant); FVRQuickBeltSlot.MoveContentsCheap += new hook_MoveContentsCheap(FVRQuickBeltSlot_MoveContentsCheap); } private void FVRQuickBeltSlot_MoveContentsCheap(orig_MoveContentsCheap orig, FVRQuickBeltSlot self, Vector3 dir) { //IL_005b: 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_003e: 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) if ((Object)(object)self == (Object)(object)this) { if ((Object)(object)currentSelectedObject != (Object)null) { FVRPhysicalObject component = currentSelectedObject.GetComponent<FVRPhysicalObject>(); if (!((FVRInteractiveObject)component).IsHeld) { component.RootRigidbody.position = component.RootRigidbody.position + dir; component.RootRigidbody.velocity = Vector3.zero; } } } else { orig.Invoke(self, dir); } } private void FVRQuickBeltSlot_MoveContentsInstant(orig_MoveContentsInstant orig, FVRQuickBeltSlot self, Vector3 dir) { //IL_005b: 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_003e: 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) if ((Object)(object)self == (Object)(object)this) { if ((Object)(object)currentSelectedObject != (Object)null) { FVRPhysicalObject component = currentSelectedObject.GetComponent<FVRPhysicalObject>(); if (!((FVRInteractiveObject)component).IsHeld) { ((Component)component).transform.position = ((Component)component).transform.position + dir; component.RootRigidbody.velocity = Vector3.zero; } } } else { orig.Invoke(self, dir); } } private void FVRQuickBeltSlot_MoveContents(orig_MoveContents orig, FVRQuickBeltSlot self, Vector3 dir) { //IL_005b: 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_003e: 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) if ((Object)(object)self == (Object)(object)this) { if ((Object)(object)currentSelectedObject != (Object)null) { FVRPhysicalObject component = currentSelectedObject.GetComponent<FVRPhysicalObject>(); if (!((FVRInteractiveObject)component).IsHeld) { ((Component)component).transform.position = ((Component)component).transform.position + dir; component.RootRigidbody.velocity = Vector3.zero; } } } else { orig.Invoke(self, dir); } } private void FVRQuickBeltSlot_Update(orig_Update orig, FVRQuickBeltSlot self) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0441: Unknown result type (might be due to invalid IL or missing references) //IL_030f: 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_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_0364: 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) if ((Object)(object)this == (Object)(object)self) { if (!GM.CurrentSceneSettings.IsSpawnLockingEnabled && (Object)(object)base.HeldObject != (Object)null && ((FVRPhysicalObject)/*isinst with value type is only supported in some contexts*/).m_isSpawnLock) { FVRInteractiveObject heldObject = base.HeldObject; ((FVRPhysicalObject)((heldObject is FVRPhysicalObject) ? heldObject : null)).m_isSpawnLock = false; } if ((Object)(object)base.HeldObject != (Object)null) { FVRInteractiveObject heldObject2 = base.HeldObject; if (((FVRPhysicalObject)((heldObject2 is FVRPhysicalObject) ? heldObject2 : null)).m_isSpawnLock) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 0.3f, 1f, 1f)); } else { FVRInteractiveObject heldObject3 = base.HeldObject; if (((FVRPhysicalObject)((heldObject3 is FVRPhysicalObject) ? heldObject3 : null)).m_isHardnessed) { if (!base.HoverGeo.activeSelf) { base.HoverGeo.SetActive(true); } base.m_hoverGeoRend.material.SetColor("_RimColor", new Color(0.3f, 1f, 0.3f, 1f)); } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } } } else { if (base.HoverGeo.activeSelf != ((FVRQuickBeltSlot)this).IsHovered) { base.HoverGeo.SetActive(((FVRQuickBeltSlot)this).IsHovered); } base.m_hoverGeoRend.material.SetColor("_RimColor", hoverColor); } if (storesMagazines && (Object)(object)base.CurObject != (Object)null && base.CurObject is FVRFireArmMagazine && storedGameObjects.Count < maxItems) { StoreCurObject(); } else if (storesClips && (Object)(object)base.CurObject != (Object)null && base.CurObject is FVRFireArmClip && storedGameObjects.Count < maxItems) { StoreCurObject(); } else if (storesSpeedloaders && (Object)(object)base.CurObject != (Object)null && base.CurObject is Speedloader && storedGameObjects.Count < maxItems) { StoreCurObject(); } else if ((Object)(object)base.CurObject != (Object)null) { EjectCurObject(); } if (storedGameObjects.Count > 0) { timeWaited += Time.deltaTime; if (!switchingObject) { timeWaited = 0f; SelectObject(); } else if (timeWaited > timeBetweenMagSwitch) { switchingObject = false; } int num = -1; for (int i = 0; i < storedGameObjects.Count; i++) { storedGameObjects[i].SetActive(i == selectedObjectIndex); if (i != selectedObjectIndex) { if ((Object)(object)base.QuickbeltRoot != (Object)null) { storedGameObjects[i].transform.position = base.QuickbeltRoot.position; storedGameObjects[i].transform.rotation = base.QuickbeltRoot.rotation; } else if ((Object)(object)base.PoseOverride != (Object)null) { storedGameObjects[i].transform.position = base.PoseOverride.position; storedGameObjects[i].transform.rotation = base.PoseOverride.rotation; } else { storedGameObjects[i].transform.position = ((Component)this).transform.position; storedGameObjects[i].transform.rotation = ((Component)this).transform.rotation; } } FVRPhysicalObject component = storedGameObjects[i].GetComponent<FVRPhysicalObject>(); if (((FVRInteractiveObject)component).IsHeld) { num = i; } if (component.m_isSpawnLock) { component.m_isSpawnLock = false; } } if (num >= 0) { storedGameObjects[num].SetActive(true); storedGameObjects.RemoveAt(num); SM.PlayGenericSound(extractSound, ((Component)this).transform.position); switchingObject = false; } if ((Object)(object)canvas != (Object)null && (Object)(object)numberOfItemsDisplay != (Object)null) { if (textTurnsOffOnNoItemsStored) { canvas.SetActive(true); } numberOfItemsDisplay.text = textPrefix + storedGameObjects.Count; } } else if ((Object)(object)canvas != (Object)null && (Object)(object)numberOfItemsDisplay != (Object)null) { if (textTurnsOffOnNoItemsStored) { canvas.SetActive(false); } numberOfItemsDisplay.text = textPrefix + storedGameObjects.Count; } } else { orig.Invoke(self); } } private void StoreCurObject() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!storedGameObjects.Contains(((Component)base.CurObject).gameObject) && (!onlyStoresEmpty || CheckEmpty())) { storedGameObjects.Add(((Component)base.CurObject).gameObject); ((Component)base.CurObject).gameObject.SetActive(false); base.CurObject = null; base.HeldObject = null; SM.PlayGenericSound(insertSound, ((Component)this).transform.position); } } private bool EjectCurObject() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) base.CurObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); base.CurObject = null; base.HeldObject = null; SM.PlayGenericSound(failureSound, ((Component)this).transform.position); return false; } private bool CheckEmpty() { FVRFireArmMagazine component = ((Component)base.CurObject).gameObject.GetComponent<FVRFireArmMagazine>(); FVRFireArmClip component2 = ((Component)base.CurObject).gameObject.GetComponent<FVRFireArmClip>(); Speedloader component3 = ((Component)base.CurObject).gameObject.GetComponent<Speedloader>(); if ((Object)(object)component != (Object)null && component.m_numRounds > 0) { return EjectCurObject(); } if ((Object)(object)component2 != (Object)null && component2.m_numRounds > 0) { return EjectCurObject(); } if ((Object)(object)component3 != (Object)null) { bool flag = false; foreach (SpeedloaderChamber chamber in component3.Chambers) { flag = chamber.IsLoaded; } if (flag) { return EjectCurObject(); } } return true; } private Vector3 GetPointInside() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) //IL_000c: Invalid comparison between Unknown and I4 //IL_0039: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references) QuickbeltSlotShape shape = base.Shape; if ((int)shape != 0) { if ((int)shape == 1) { return new Vector3(Random.Range(0f - base.RectBounds.localScale.x, base.RectBounds.localScale.x), Random.Range(0f - base.RectBounds.localScale.y, base.RectBounds.localScale.y), Random.Range(0f - base.RectBounds.localScale.z, base.RectBounds.localScale.z)); } return default(Vector3); } return Random.insideUnitSphere * base.HoverGeo.transform.localScale.x; } private void SelectObject() { switchingObject = true; selectedObjectIndex = Random.Range(0, storedGameObjects.Count); currentSelectedObject = storedGameObjects[selectedObjectIndex]; currentSelectedObject.SetActive(true); } private IEnumerator SelectObjectSlow() { Debug.Log((object)"SelectingObjectSlow"); switchingObject = true; selectedObjectIndex = Random.Range(0, storedGameObjects.Count - 1); Debug.Log((object)("SelectedMag: " + selectedObjectIndex)); currentSelectedObject = storedGameObjects[selectedObjectIndex]; Debug.Log((object)("SelectedMagObject: " + (object)currentSelectedObject)); currentSelectedObject.SetActive(true); Debug.Log((object)("SelectedMagObject Active: " + currentSelectedObject.activeSelf)); yield return (object)new WaitForSeconds(0.25f); Debug.Log((object)("SelectedMagObject: " + (object)currentSelectedObject)); Debug.Log((object)"Checking hand"); Debug.Log((object)("StoredObjects: " + storedGameObjects)); Debug.Log((object)("StoredObjects: " + storedGameObjects.Count)); Debug.Log((object)("SelectedMag: " + selectedObjectIndex)); Debug.Log((object)("SelectedMagObject: " + (object)storedGameObjects[selectedObjectIndex])); currentSelectedObject = storedGameObjects[selectedObjectIndex]; Debug.Log((object)("SelectedMagObject: " + (object)currentSelectedObject)); FVRFireArmMagazine component = currentSelectedObject.GetComponent<FVRFireArmMagazine>(); Debug.Log((object)("SelectedMagMag: " + (object)component)); if (((FVRInteractiveObject)component).IsHeld) { Debug.Log((object)"isHeld"); storedGameObjects.RemoveAt(selectedObjectIndex); Debug.Log((object)"RemovedMagFromStorage"); SM.PlayGenericSound(extractSound, ((Component)this).transform.position); } else { Debug.Log((object)"!isHeld"); currentSelectedObject.SetActive(false); } Debug.Log((object)"SelectingObjectSlow End"); switchingObject = false; } private IEnumerator SelectObjectInstantly() { switchingObject = true; selectedObjectIndex = Random.Range(0, storedGameObjects.Count - 1); currentSelectedObject = storedGameObjects[selectedObjectIndex]; currentSelectedObject.SetActive(true); yield return (object)new WaitForEndOfFrame(); switchingObject = false; } }
plugins/DP12_Scripts.dll
Decompiled 10 months agousing 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; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("DP12_Scripts")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DP12_Scripts")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("95fccee2-10de-4a87-9534-472a18bc63b8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class DP12_BoltAction : BoltActionRifle { private enum EDP12State { FirstShot, SecondShot } [Header("DP-12 Config")] public FVRFireArmChamber SecondChamber; public Transform SecondMuzzlePos; [Header("Replacement Round Ejection Paramenters")] public Vector3 RoundEjectionSpeed; public Vector3 RoundEjectionSpin; [Header("Second Round Config")] public Transform Second_Extraction_MagazinePos; public Transform Second_Extraction_ChamberPos; public Transform Second_Extraction_Ejecting; public Transform Second_EjectionPos; public Vector3 Second_RoundEjectionSpeed; public Vector3 Second_RoundEjectionSpin; [Header("Second Hammer Config")] public bool HasSecondVisualHammer; public Transform Second_Hammer; public float Second_HammerUncocked; public float Second_HammerCocked; private FVRFirearmMovingProxyRound m_secondProxyRound; private bool _hasHammerDropped; private EDP12State _dP12State; [Tooltip("Use this if you're working with a BoltActionRifle prefab and don't feel like repopulating all the field of this script manually. Use the context menu after placing the BoltActionRifle here.")] public BoltActionRifle CopyBoltActionRifle; public override void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ((BoltActionRifle)this).Awake(); ((FVRFireArm)this).FChambers.Add(SecondChamber); GameObject val = new GameObject("m_secondProxyRound"); m_secondProxyRound = val.AddComponent<FVRFirearmMovingProxyRound>(); m_secondProxyRound.Init(((Component)this).transform); Hook(); } public override void OnDestroy() { ((FVRPhysicalObject)this).OnDestroy(); Unhook(); } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); } public bool FireSecondBarrel() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cc: Unknown result type (might be due to invalid IL or missing references) if (!SecondChamber.Fire()) { return false; } ((FVRFireArm)this).Fire(SecondChamber, ((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); ((FVRFireArm)this).PlayAudioGunShot(SecondChamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (base.PlaysExtraTailOnShot) { AudioEvent tailSet = SM.GetTailSet(base.ExtraTail, GM.CurrentPlayerBody.GetCurrentSoundEnvironment()); ((FVRFireArm)this).m_pool_tail.PlayClipVolumePitchOverride(tailSet, ((Component)this).transform.position, tailSet.VolumeRange * 1f, ((FVRFireArm)this).AudioClipSet.TailPitchMod_Main * tailSet.PitchRange.x, (AudioMixerGroup)null); } return true; } public override Transform GetMuzzle() { return (Transform)(_dP12State switch { EDP12State.FirstShot => ((FVRFireArm)this).MuzzlePos, EDP12State.SecondShot => SecondMuzzlePos, _ => ((FVRFireArm)this).MuzzlePos, }); } public override List<FireArmRoundClass> GetChamberRoundList() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) List<FireArmRoundClass> chamberRoundList = ((BoltActionRifle)this).GetChamberRoundList(); if (SecondChamber.IsFull && !SecondChamber.IsSpent) { chamberRoundList.Add(SecondChamber.GetRound().RoundClass); } return chamberRoundList; } public override void SetLoadedChambers(List<FireArmRoundClass> rounds) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((BoltActionRifle)this).SetLoadedChambers(rounds); if (rounds.Count > 1) { SecondChamber.Autochamber(rounds[0]); } } public override void ConfigureFromFlagDic(Dictionary<string, string> f) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) ((BoltActionRifle)this).ConfigureFromFlagDic(f); if (!((Object)(object)((FVRFireArm)this).Magazine != (Object)null) || !(((FVRFireArm)this).Magazine is DP12_Mag dP12_Mag)) { return; } string key = "SecondMagazineChamber"; _ = string.Empty; if (f.ContainsKey(key)) { string[] array = f[key].Split(new char[1] { ';' }); foreach (string value in array) { dP12_Mag.SecondMagazine.AddRound((FireArmRoundClass)Enum.Parse(typeof(FireArmRoundClass), value), false, false); } dP12_Mag.SecondMagazine.UpdateBulletDisplay(); } } public override Dictionary<string, string> GetFlagDic() { Dictionary<string, string> flagDic = ((BoltActionRifle)this).GetFlagDic(); string key = "SecondMagazineChamber"; string empty = string.Empty; if ((Object)(object)((FVRFireArm)this).Magazine != (Object)null && ((FVRFireArm)this).Magazine is DP12_Mag dP12_Mag && dP12_Mag.SecondMagazine.HasARound()) { empty += ((object)(FireArmRoundClass)(ref dP12_Mag.SecondMagazine.LoadedRounds[0].LR_Class)).ToString(); for (int i = 1; i < dP12_Mag.SecondMagazine.m_numRounds; i++) { empty = empty + ";" + ((object)(FireArmRoundClass)(ref dP12_Mag.SecondMagazine.LoadedRounds[i].LR_Class)).ToString(); } flagDic.Add(key, empty); } return flagDic; } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown BoltActionRifle.HasExtractedRound -= new hook_HasExtractedRound(BoltActionRifle_HasExtractedRound); BoltActionRifle.CockHammer -= new hook_CockHammer(BoltActionRifle_CockHammer); BoltActionRifle.DropHammer -= new hook_DropHammer(BoltActionRifle_DropHammer); BoltActionRifle.UpdateBolt -= new hook_UpdateBolt(BoltActionRifle_UpdateBolt); BoltActionRifle.UpdateInteraction -= new hook_UpdateInteraction(BoltActionRifle_UpdateInteraction); FVRFireArmRound.DuplicateFromSpawnLock -= new hook_DuplicateFromSpawnLock(FVRFireArmRound_DuplicateFromSpawnLock); FVRFireArmRound.GetNumRoundsPulled -= new hook_GetNumRoundsPulled(FVRFireArmRound_GetNumRoundsPulled); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown BoltActionRifle.HasExtractedRound += new hook_HasExtractedRound(BoltActionRifle_HasExtractedRound); BoltActionRifle.CockHammer += new hook_CockHammer(BoltActionRifle_CockHammer); BoltActionRifle.DropHammer += new hook_DropHammer(BoltActionRifle_DropHammer); BoltActionRifle.UpdateBolt += new hook_UpdateBolt(BoltActionRifle_UpdateBolt); BoltActionRifle.UpdateInteraction += new hook_UpdateInteraction(BoltActionRifle_UpdateInteraction); FVRFireArmRound.DuplicateFromSpawnLock += new hook_DuplicateFromSpawnLock(FVRFireArmRound_DuplicateFromSpawnLock); FVRFireArmRound.GetNumRoundsPulled += new hook_GetNumRoundsPulled(FVRFireArmRound_GetNumRoundsPulled); } private int FVRFireArmRound_GetNumRoundsPulled(orig_GetNumRoundsPulled orig, FVRFireArmRound self, FVRViveHand hand) { //IL_001a: 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) if (hand.OtherHand.CurrentInteractable is DP12_BoltAction dP12_BoltAction) { int num = 0; if (((FVRFireArm)dP12_BoltAction).RoundType == self.RoundType) { DP12_Mag dP12_Mag = ((FVRFireArm)dP12_BoltAction).Magazine as DP12_Mag; if ((Object)(object)dP12_Mag != (Object)null) { num = ((FVRFireArmMagazine)dP12_Mag).m_capacity - ((FVRFireArmMagazine)dP12_Mag).m_numRounds; num += dP12_Mag.SecondMagazine.m_capacity - dP12_Mag.SecondMagazine.m_numRounds; } for (int i = 0; i < ((FVRFireArm)dP12_BoltAction).GetChambers().Count; i++) { FVRFireArmChamber val = ((FVRFireArm)dP12_BoltAction).GetChambers()[i]; if (val.IsManuallyChamberable && (!val.IsFull || val.IsSpent)) { num++; } } } if (num == 0) { num = 1 + self.ProxyRounds.Count; } return num; } return orig.Invoke(self, hand); } private GameObject FVRFireArmRound_DuplicateFromSpawnLock(orig_DuplicateFromSpawnLock orig, FVRFireArmRound self, FVRViveHand hand) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) GameObject val = orig.Invoke(self, hand); FVRFireArmRound component = val.GetComponent<FVRFireArmRound>(); if ((int)GM.Options.ControlOptions.SmartAmmoPalming == 0 && (Object)(object)component != (Object)null && (Object)(object)hand.OtherHand.CurrentInteractable != (Object)null) { int num = 0; if (hand.OtherHand.CurrentInteractable is DP12_BoltAction dP12_BoltAction) { if (((FVRFireArm)dP12_BoltAction).RoundType == self.RoundType) { DP12_Mag dP12_Mag = ((FVRFireArm)dP12_BoltAction).Magazine as DP12_Mag; if ((Object)(object)dP12_Mag != (Object)null) { num = ((FVRFireArmMagazine)dP12_Mag).m_capacity - ((FVRFireArmMagazine)dP12_Mag).m_numRounds; num += dP12_Mag.SecondMagazine.m_capacity - dP12_Mag.SecondMagazine.m_numRounds; } for (int i = 0; i < ((FVRFireArm)dP12_BoltAction).GetChambers().Count; i++) { FVRFireArmChamber val2 = ((FVRFireArm)dP12_BoltAction).GetChambers()[i]; if (val2.IsManuallyChamberable && (!val2.IsFull || val2.IsSpent)) { num++; } } } if (num < 1) { num = self.ProxyRounds.Count; } component.DestroyAllProxies(); int num2 = Mathf.Min(self.ProxyRounds.Count, num - 1); for (int j = 0; j < num2; j++) { component.AddProxy(self.ProxyRounds[j].Class, self.ProxyRounds[j].ObjectWrapper); } component.UpdateProxyDisplay(); } } return val; } private void BoltActionRifle_UpdateInteraction(orig_UpdateInteraction orig, BoltActionRifle self, FVRViveHand hand) { orig.Invoke(self, hand); if (_hasHammerDropped && base.m_triggerFloat <= base.TriggerResetThreshold) { _hasHammerDropped = false; } } private FVRFireArmRound BoltActionRifle_UpdateBolt(orig_UpdateBolt orig, BoltActionRifle self, BoltActionHandleState State, float lerp, bool isCatchHeld) { //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Invalid comparison between Unknown and I4 //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Invalid comparison between Unknown and I4 //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Invalid comparison between Unknown and I4 //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Invalid comparison between Unknown and I4 //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: 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_01f6: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_069b: 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_024f: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: 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_02fa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)this) { FVRFireArmRound result = null; base.CurBoltHandleState = State; base.BoltLerp = lerp; if ((int)base.CurBoltHandleState != 0 && !base.m_proxy.IsFull && !base.Chamber.IsFull) { base.Chamber.IsAccessible = true; } else { base.Chamber.IsAccessible = false; } if ((int)base.CurBoltHandleState != 0 && !m_secondProxyRound.IsFull && !SecondChamber.IsFull) { SecondChamber.IsAccessible = true; } else { SecondChamber.IsAccessible = false; } if (((FVRFireArm)this).UsesClips && (Object)(object)((FVRFireArm)this).ClipTrigger != (Object)null) { if ((int)base.CurBoltHandleState == 2) { if (!((FVRFireArm)this).ClipTrigger.activeSelf) { ((FVRFireArm)this).ClipTrigger.SetActive(true); } } else if (((FVRFireArm)this).ClipTrigger.activeSelf) { ((FVRFireArm)this).ClipTrigger.SetActive(false); } } if ((int)base.CurBoltHandleState == 2 && (int)base.LastBoltHandleState != 2) { if ((int)base.CockType == 0) { ((BoltActionRifle)this).CockHammer(); } if (base.Chamber.IsFull || SecondChamber.IsFull) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f); } else { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)41, 1f); } if (base.Chamber.IsFull) { FVRFireArmRound val = base.Chamber.EjectRound(base.EjectionPos.position, ((Component)this).transform.right * RoundEjectionSpeed.x + ((Component)this).transform.up * RoundEjectionSpeed.y + ((Component)this).transform.forward * RoundEjectionSpeed.z, ((Component)this).transform.right * RoundEjectionSpin.x + ((Component)this).transform.up * RoundEjectionSpin.y + ((Component)this).transform.forward * RoundEjectionSpin.z, false); if (isCatchHeld) { result = val; } } if (SecondChamber.IsFull) { FVRFireArmRound val2 = SecondChamber.EjectRound(Second_EjectionPos.position, ((Component)this).transform.right * Second_RoundEjectionSpeed.x + ((Component)this).transform.up * Second_RoundEjectionSpeed.y + ((Component)this).transform.forward * Second_RoundEjectionSpeed.z, ((Component)this).transform.right * Second_RoundEjectionSpin.x + ((Component)this).transform.up * Second_RoundEjectionSpin.y + ((Component)this).transform.forward * Second_RoundEjectionSpin.z, false); if (isCatchHeld) { result = val2; } } base.BoltMovingForward = true; } else if ((int)base.CurBoltHandleState == 0 && (int)base.LastBoltHandleState != 0) { if ((int)base.CockType == 3) { ((BoltActionRifle)this).CockHammer(); } if ((base.m_proxy.IsFull && !base.Chamber.IsFull) || (m_secondProxyRound.IsFull && !SecondChamber.IsFull)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f); } else { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)40, 1f); } if (base.m_proxy.IsFull && !base.Chamber.IsFull) { base.Chamber.SetRound(base.m_proxy.Round, false); base.m_proxy.ClearProxy(); } if (m_secondProxyRound.IsFull && !SecondChamber.IsFull) { SecondChamber.SetRound(m_secondProxyRound.Round, false); m_secondProxyRound.ClearProxy(); } base.BoltMovingForward = false; } else if ((int)base.CurBoltHandleState == 1 && (int)base.LastBoltHandleState == 2 && (Object)(object)((FVRFireArm)this).Magazine != (Object)null) { if (!base.m_proxy.IsFull && ((FVRFireArm)this).Magazine.HasARound() && !base.Chamber.IsFull) { GameObject fromPrefabReference = ((FVRFireArm)this).Magazine.RemoveRound(false); base.m_proxy.SetFromPrefabReference(fromPrefabReference); } FVRFireArmMagazine secondMagazine = (((FVRFireArm)this).Magazine as DP12_Mag).SecondMagazine; if (!m_secondProxyRound.IsFull && secondMagazine.HasARound() && !SecondChamber.IsFull) { GameObject fromPrefabReference2 = secondMagazine.RemoveRound(false); m_secondProxyRound.SetFromPrefabReference(fromPrefabReference2); } if (base.EjectsMagazineOnEmpty && !((FVRFireArm)this).Magazine.HasARound() && !secondMagazine.HasARound()) { ((FVRFireArm)this).EjectMag(false); } } if (base.m_proxy.IsFull) { base.m_proxy.ProxyRound.position = Vector3.Lerp(base.Extraction_ChamberPos.position, base.Extraction_MagazinePos.position, base.BoltLerp); base.m_proxy.ProxyRound.rotation = Quaternion.Slerp(base.Extraction_ChamberPos.rotation, base.Extraction_MagazinePos.rotation, base.BoltLerp); } if (m_secondProxyRound.IsFull) { m_secondProxyRound.ProxyRound.position = Vector3.Lerp(Second_Extraction_ChamberPos.position, Second_Extraction_MagazinePos.position, base.BoltLerp); m_secondProxyRound.ProxyRound.rotation = Quaternion.Slerp(Second_Extraction_ChamberPos.rotation, Second_Extraction_MagazinePos.rotation, base.BoltLerp); } if (base.Chamber.IsFull) { base.Chamber.ProxyRound.position = Vector3.Lerp(base.Extraction_ChamberPos.position, base.Extraction_Ejecting.position, base.BoltLerp); base.Chamber.ProxyRound.rotation = Quaternion.Slerp(base.Extraction_ChamberPos.rotation, base.Extraction_Ejecting.rotation, base.BoltLerp); } if (SecondChamber.IsFull) { SecondChamber.ProxyRound.position = Vector3.Lerp(Second_Extraction_ChamberPos.position, Second_Extraction_Ejecting.position, base.BoltLerp); SecondChamber.ProxyRound.rotation = Quaternion.Slerp(Second_Extraction_ChamberPos.rotation, Second_Extraction_Ejecting.rotation, base.BoltLerp); } base.LastBoltHandleState = base.CurBoltHandleState; return result; } return orig.Invoke(self, State, lerp, isCatchHeld); } private void BoltActionRifle_DropHammer(orig_DropHammer orig, BoltActionRifle self) { if ((Object)(object)self == (Object)(object)this) { if (!base.m_isHammerCocked || _hasHammerDropped) { return; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); switch (_dP12State) { case EDP12State.FirstShot: ((BoltActionRifle)this).Fire(); base.m_isHammerCocked = true; _dP12State = EDP12State.SecondShot; if (base.HasVisualHammer && HasSecondVisualHammer) { ((FVRPhysicalObject)this).SetAnimatedComponent(base.Hammer, base.HammerUncocked, (InterpStyle)0, (Axis)2); } break; case EDP12State.SecondShot: FireSecondBarrel(); base.m_isHammerCocked = false; if (HasSecondVisualHammer) { ((FVRPhysicalObject)this).SetAnimatedComponent(Second_Hammer, Second_HammerUncocked, (InterpStyle)0, (Axis)2); } else if (base.HasVisualHammer) { ((FVRPhysicalObject)this).SetAnimatedComponent(base.Hammer, base.HammerUncocked, (InterpStyle)0, (Axis)2); } break; } _hasHammerDropped = true; } else { orig.Invoke(self); } } private void BoltActionRifle_CockHammer(orig_CockHammer orig, BoltActionRifle self) { orig.Invoke(self); if ((Object)(object)self == (Object)(object)this) { _dP12State = EDP12State.FirstShot; if (HasSecondVisualHammer) { ((FVRPhysicalObject)this).SetAnimatedComponent(Second_Hammer, Second_HammerCocked, (InterpStyle)0, (Axis)2); } } } private bool BoltActionRifle_HasExtractedRound(orig_HasExtractedRound orig, BoltActionRifle self) { bool result = orig.Invoke(self); if ((Object)(object)self == (Object)(object)this && m_secondProxyRound.IsFull) { return true; } return result; } [ContextMenu("Copy existing BoltActionRifle Parameters")] public void CopyBoltActionRifleParameters() { FieldInfo[] fields = ((object)CopyBoltActionRifle).GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(this, fieldInfo.GetValue(CopyBoltActionRifle)); } RoundEjectionSpeed.x = base.RightwardEjectionForce; RoundEjectionSpeed.y = base.UpwardEjectionForce; RoundEjectionSpin.y = base.YSpinEjectionTorque; } } public class DP12_Mag : FVRFireArmMagazine { [Header("DP-12 Mag Config")] public FVRFireArmMagazine SecondMagazine; [Tooltip("Use this if you're working with a FVRFireArmMagazine prefab and don't feel like repopulating all the field of this script manually. Use the context menu after placing the FVRFireArmMagazine here.")] public FVRFireArmMagazine CopyFVRFireArmMagazine; public override void Start() { ((FVRInteractiveObject)this).Start(); ((FVRPhysicalObject)SecondMagazine).StoreAndDestroyRigidbody(); ((Component)SecondMagazine).gameObject.layer = LayerMask.NameToLayer("Default"); Hook(); } public override void OnDestroy() { ((FVRPhysicalObject)this).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 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown FVRFireArmMagazine.ReloadMagWithType -= new hook_ReloadMagWithType(FVRFireArmMagazine_ReloadMagWithType); FVRFireArmRound.DuplicateFromSpawnLock -= new hook_DuplicateFromSpawnLock(FVRFireArmRound_DuplicateFromSpawnLock); FVRFireArmRound.GetNumRoundsPulled -= new hook_GetNumRoundsPulled(FVRFireArmRound_GetNumRoundsPulled); } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown FVRFireArmMagazine.ReloadMagWithType += new hook_ReloadMagWithType(FVRFireArmMagazine_ReloadMagWithType); FVRFireArmRound.DuplicateFromSpawnLock += new hook_DuplicateFromSpawnLock(FVRFireArmRound_DuplicateFromSpawnLock); FVRFireArmRound.GetNumRoundsPulled += new hook_GetNumRoundsPulled(FVRFireArmRound_GetNumRoundsPulled); } private int FVRFireArmRound_GetNumRoundsPulled(orig_GetNumRoundsPulled orig, FVRFireArmRound self, FVRViveHand hand) { //IL_0017: 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) if (hand.OtherHand.CurrentInteractable is DP12_Mag dP12_Mag) { int num = 0; if (((FVRFireArmMagazine)dP12_Mag).RoundType == self.RoundType) { num = ((FVRFireArmMagazine)dP12_Mag).m_capacity - ((FVRFireArmMagazine)dP12_Mag).m_numRounds; num += dP12_Mag.SecondMagazine.m_capacity - dP12_Mag.SecondMagazine.m_numRounds; } if (num == 0) { num = 1 + self.ProxyRounds.Count; } return num; } return orig.Invoke(self, hand); } private GameObject FVRFireArmRound_DuplicateFromSpawnLock(orig_DuplicateFromSpawnLock orig, FVRFireArmRound self, FVRViveHand hand) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) GameObject val = orig.Invoke(self, hand); FVRFireArmRound component = val.GetComponent<FVRFireArmRound>(); if ((int)GM.Options.ControlOptions.SmartAmmoPalming == 0 && (Object)(object)component != (Object)null && (Object)(object)hand.OtherHand.CurrentInteractable != (Object)null) { int num = 0; if (hand.OtherHand.CurrentInteractable is DP12_Mag dP12_Mag) { if (((FVRFireArmMagazine)dP12_Mag).RoundType == self.RoundType) { num = ((FVRFireArmMagazine)dP12_Mag).m_capacity - ((FVRFireArmMagazine)dP12_Mag).m_numRounds; num += dP12_Mag.SecondMagazine.m_capacity - dP12_Mag.SecondMagazine.m_numRounds; } if (num < 1) { num = self.ProxyRounds.Count; } component.DestroyAllProxies(); int num2 = Mathf.Min(self.ProxyRounds.Count, num - 1); for (int i = 0; i < num2; i++) { component.AddProxy(self.ProxyRounds[i].Class, self.ProxyRounds[i].ObjectWrapper); } component.UpdateProxyDisplay(); } } return val; } private void FVRFireArmMagazine_ReloadMagWithType(orig_ReloadMagWithType orig, FVRFireArmMagazine self, FireArmRoundClass rClass) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) if ((Object)(object)self == (Object)(object)this) { base.m_numRounds = 0; for (int i = 0; i < base.m_capacity; i++) { ((FVRFireArmMagazine)this).AddRound(rClass, false, false); } SecondMagazine.ReloadMagWithType(rClass); ((FVRFireArmMagazine)this).UpdateBulletDisplay(); } else { orig.Invoke(self, rClass); } } public override void UpdateInteraction(FVRViveHand hand) { //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_00c4: Unknown result type (might be due to invalid IL or missing references) //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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_01ca: 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_013c: 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_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0344: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_0359: 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_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArmMagazine)this).UpdateInteraction(hand); if (!SecondMagazine.CanManuallyEjectRounds || !((Object)(object)SecondMagazine.RoundEjectionPos != (Object)null) || !SecondMagazine.HasARound()) { return; } bool flag = false; if (hand.IsInStreamlinedMode && hand.Input.BYButtonDown) { flag = true; } else if (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { flag = true; } if (!flag) { return; } if ((Object)(object)base.FireArm != (Object)null) { base.FireArm.PlayAudioEvent((FirearmAudioEventType)29, 1f); } else { SM.PlayGenericSound(base.Profile.MagazineEjectRound, ((Component)this).transform.position); } if ((Object)(object)hand.OtherHand.CurrentInteractable == (Object)null && hand.OtherHand.Input.IsGrabbing && Vector3.Distance(SecondMagazine.RoundEjectionPos.position, ((HandInput)(ref hand.OtherHand.Input)).Pos) < 0.15f) { FVRFireArmRound component = Object.Instantiate<GameObject>(SecondMagazine.RemoveRound(false), SecondMagazine.RoundEjectionPos.position, SecondMagazine.RoundEjectionPos.rotation).GetComponent<FVRFireArmRound>(); ((FVRPhysicalObject)component).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); hand.OtherHand.ForceSetInteractable((FVRInteractiveObject)(object)component); ((FVRInteractiveObject)component).BeginInteraction(hand.OtherHand); return; } if (hand.OtherHand.CurrentInteractable is FVRFireArmRound && ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).RoundType == SecondMagazine.RoundType && ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).ProxyRounds.Count < ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).MaxPalmedAmount && Vector3.Distance(((HandInput)(ref hand.Input)).Pos, ((HandInput)(ref hand.OtherHand.Input)).Pos) < 0.15f) { FireArmRoundClass lR_Class = SecondMagazine.LoadedRounds[SecondMagazine.m_numRounds - 1].LR_Class; FVRObject lR_ObjectWrapper = SecondMagazine.LoadedRounds[SecondMagazine.m_numRounds - 1].LR_ObjectWrapper; ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).AddProxy(lR_Class, lR_ObjectWrapper); ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).UpdateProxyDisplay(); SecondMagazine.RemoveRound(); return; } if ((Object)(object)hand.CurrentHoveredQuickbeltSlotDirty != (Object)null && (Object)(object)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject == (Object)null) { FVRFireArmRound component2 = Object.Instantiate<GameObject>(SecondMagazine.RemoveRound(false), SecondMagazine.RoundEjectionPos.position, SecondMagazine.RoundEjectionPos.rotation).GetComponent<FVRFireArmRound>(); ((FVRPhysicalObject)component2).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); ((FVRPhysicalObject)component2).SetQuickBeltSlot(hand.CurrentHoveredQuickbeltSlotDirty); return; } if ((Object)(object)hand.CurrentHoveredQuickbeltSlotDirty != (Object)null && hand.CurrentHoveredQuickbeltSlotDirty.HeldObject is FVRFireArmRound && ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).RoundType == SecondMagazine.RoundType && ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).ProxyRounds.Count < ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).MaxPalmedAmount) { FireArmRoundClass lR_Class2 = SecondMagazine.LoadedRounds[SecondMagazine.m_numRounds - 1].LR_Class; FVRObject lR_ObjectWrapper2 = SecondMagazine.LoadedRounds[SecondMagazine.m_numRounds - 1].LR_ObjectWrapper; ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).AddProxy(lR_Class2, lR_ObjectWrapper2); ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).UpdateProxyDisplay(); SecondMagazine.RemoveRound(); return; } GameObject val = Object.Instantiate<GameObject>(SecondMagazine.RemoveRound(false), SecondMagazine.RoundEjectionPos.position, SecondMagazine.RoundEjectionPos.rotation); ((FVRPhysicalObject)val.GetComponent<FVRFireArmRound>()).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); val.GetComponent<Rigidbody>().AddForce(val.transform.forward * 0.5f); if (SecondMagazine.DisplayBullets.Length != 0 && (Object)(object)SecondMagazine.DisplayBullets[0] != (Object)null) { val.GetComponent<FVRFireArmRound>().BeginAnimationFrom(SecondMagazine.DisplayBullets[0].transform.position, SecondMagazine.DisplayBullets[0].transform.rotation); } } public override GameObject DuplicateFromSpawnLock(FVRViveHand hand) { //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) GameObject val = ((FVRFireArmMagazine)this).DuplicateFromSpawnLock(hand); FVRFireArmMagazine secondMagazine = val.GetComponent<DP12_Mag>().SecondMagazine; for (int i = 0; i < Mathf.Min(SecondMagazine.LoadedRounds.Length, secondMagazine.LoadedRounds.Length); i++) { if (SecondMagazine.LoadedRounds[i] != null && (Object)(object)SecondMagazine.LoadedRounds[i].LR_Mesh != (Object)null) { secondMagazine.LoadedRounds[i].LR_Class = SecondMagazine.LoadedRounds[i].LR_Class; secondMagazine.LoadedRounds[i].LR_Mesh = SecondMagazine.LoadedRounds[i].LR_Mesh; secondMagazine.LoadedRounds[i].LR_Material = SecondMagazine.LoadedRounds[i].LR_Material; secondMagazine.LoadedRounds[i].LR_ObjectWrapper = SecondMagazine.LoadedRounds[i].LR_ObjectWrapper; } } secondMagazine.m_numRounds = SecondMagazine.m_numRounds; secondMagazine.UpdateBulletDisplay(); return val; } [ContextMenu("Copy existing Magazine Parameters")] public void CopyFVRFireArmMagazineParameters() { FieldInfo[] fields = ((object)CopyFVRFireArmMagazine).GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(this, fieldInfo.GetValue(CopyFVRFireArmMagazine)); } } } public class DP12_Shotgun : TubeFedShotgun { private enum EDP12State { FirstShot, SecondShot } [Header("DP-12 Config")] public FVRFireArmChamber SecondChamber; public Transform SecondMuzzlePos; [Header("Second Round Config")] public Transform Second_RoundPos_LowerPath_Forward; public Transform Second_RoundPos_LowerPath_Rearward; public Transform Second_RoundPos_UpperPath_Forward; public Transform Second_RoundPos_UpperPath_Rearward; public Transform Second_RoundPos_Ejecting; public Transform Second_RoundPos_Ejection; public Vector3 Second_RoundEjectionSpeed; public Vector3 Second_RoundEjectionSpin; private FVRFirearmMovingProxyRound m_secondProxy; private bool m_isSecondExtractedRoundOnLowerPath = true; private bool m_isSecondChamberRoundOnExtractor; private EDP12State _dP12State; [Tooltip("Use this if you're working with a TubeFedMagazine prefab and don't feel like repopulating all the field of this script manually. Use the context menu after placing the TubeFedShotgun here.")] public TubeFedShotgun CopyTubeFedShotgun; public override void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ((TubeFedShotgun)this).Awake(); ((FVRFireArm)this).FChambers.Add(SecondChamber); GameObject val = new GameObject("m_secondProxyRound"); m_secondProxy = val.AddComponent<FVRFirearmMovingProxyRound>(); m_secondProxy.Init(((Component)this).transform); Hook(); } public override void OnDestroy() { ((FVRPhysicalObject)this).OnDestroy(); Unhook(); } public override void FVRUpdate() { ((TubeFedShotgun)this).FVRUpdate(); if ((Object)(object)((FVRFireArm)this).Magazine != (Object)null && ((FVRFireArm)this).Magazine is DP12_Mag dP12_Mag) { if (((TubeFedShotgun)this).HasExtractedRound() && m_isSecondExtractedRoundOnLowerPath) { dP12_Mag.SecondMagazine.IsDropInLoadable = false; } else { dP12_Mag.SecondMagazine.IsDropInLoadable = true; } } } public bool FireSecondBarrel() { //IL_0067: 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_007d: Invalid comparison between Unknown and I4 if (!SecondChamber.Fire()) { return false; } ((FVRFireArm)this).Fire(SecondChamber, ((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); ((FVRFireArm)this).PlayAudioGunShot(SecondChamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if ((int)base.Mode == 1 && SecondChamber.GetRound().IsHighPressure) { base.Bolt.ImpartFiringImpulse(); } return true; } public override Transform GetMuzzle() { return (Transform)(_dP12State switch { EDP12State.FirstShot => ((FVRFireArm)this).MuzzlePos, EDP12State.SecondShot => SecondMuzzlePos, _ => ((FVRFireArm)this).MuzzlePos, }); } public override List<FireArmRoundClass> GetChamberRoundList() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) List<FireArmRoundClass> chamberRoundList = ((TubeFedShotgun)this).GetChamberRoundList(); if (SecondChamber.IsFull && !SecondChamber.IsSpent) { chamberRoundList.Add(SecondChamber.GetRound().RoundClass); } return chamberRoundList; } public override void SetLoadedChambers(List<FireArmRoundClass> rounds) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((TubeFedShotgun)this).SetLoadedChambers(rounds); if (rounds.Count > 1) { SecondChamber.Autochamber(rounds[0]); } } public override void ConfigureFromFlagDic(Dictionary<string, string> f) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) ((TubeFedShotgun)this).ConfigureFromFlagDic(f); if (!((Object)(object)((FVRFireArm)this).Magazine != (Object)null) || !(((FVRFireArm)this).Magazine is DP12_Mag dP12_Mag)) { return; } string key = "SecondMagazine"; _ = string.Empty; if (f.ContainsKey(key)) { string[] array = f[key].Split(new char[1] { ';' }); foreach (string value in array) { dP12_Mag.SecondMagazine.AddRound((FireArmRoundClass)Enum.Parse(typeof(FireArmRoundClass), value), false, false); } dP12_Mag.SecondMagazine.UpdateBulletDisplay(); } } public override Dictionary<string, string> GetFlagDic() { Dictionary<string, string> flagDic = ((TubeFedShotgun)this).GetFlagDic(); if ((Object)(object)((FVRFireArm)this).Magazine != (Object)null && ((FVRFireArm)this).Magazine is DP12_Mag dP12_Mag) { string key = "SecondMagazine"; string empty = string.Empty; if (dP12_Mag.SecondMagazine.HasARound()) { empty += ((object)(FireArmRoundClass)(ref dP12_Mag.SecondMagazine.LoadedRounds[0].LR_Class)).ToString(); for (int i = 1; i < dP12_Mag.SecondMagazine.m_numRounds; i++) { empty = empty + ";" + ((object)(FireArmRoundClass)(ref dP12_Mag.SecondMagazine.LoadedRounds[i].LR_Class)).ToString(); } flagDic.Add(key, empty); } } return flagDic; } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown TubeFedShotgun.EjectExtractedRound -= new hook_EjectExtractedRound(TubeFedShotgun_EjectExtractedRound); TubeFedShotgun.ExtractRound -= new hook_ExtractRound(TubeFedShotgun_ExtractRound); TubeFedShotgun.ChamberRound -= new hook_ChamberRound(TubeFedShotgun_ChamberRound); TubeFedShotgun.ReturnCarrierRoundToMagazineIfRelevant -= new hook_ReturnCarrierRoundToMagazineIfRelevant(TubeFedShotgun_ReturnCarrierRoundToMagazineIfRelevant); TubeFedShotgun.UpdateDisplayRoundPositions -= new hook_UpdateDisplayRoundPositions(TubeFedShotgun_UpdateDisplayRoundPositions); TubeFedShotgun.ReleaseHammer -= new hook_ReleaseHammer(TubeFedShotgun_ReleaseHammer); TubeFedShotgun.CockHammer -= new hook_CockHammer(TubeFedShotgun_CockHammer); TubeFedShotgun.TransferShellToUpperTrack -= new hook_TransferShellToUpperTrack(TubeFedShotgun_TransferShellToUpperTrack); TubeFedShotgun.HasExtractedRound -= new hook_HasExtractedRound(TubeFedShotgun_HasExtractedRound); TubeFedShotgun.UpdateCarrier -= new hook_UpdateCarrier(TubeFedShotgun_UpdateCarrier); FVRFireArmRound.DuplicateFromSpawnLock -= new hook_DuplicateFromSpawnLock(FVRFireArmRound_DuplicateFromSpawnLock); FVRFireArmRound.GetNumRoundsPulled -= new hook_GetNumRoundsPulled(FVRFireArmRound_GetNumRoundsPulled); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown TubeFedShotgun.EjectExtractedRound += new hook_EjectExtractedRound(TubeFedShotgun_EjectExtractedRound); TubeFedShotgun.ExtractRound += new hook_ExtractRound(TubeFedShotgun_ExtractRound); TubeFedShotgun.ChamberRound += new hook_ChamberRound(TubeFedShotgun_ChamberRound); TubeFedShotgun.ReturnCarrierRoundToMagazineIfRelevant += new hook_ReturnCarrierRoundToMagazineIfRelevant(TubeFedShotgun_ReturnCarrierRoundToMagazineIfRelevant); TubeFedShotgun.UpdateDisplayRoundPositions += new hook_UpdateDisplayRoundPositions(TubeFedShotgun_UpdateDisplayRoundPositions); TubeFedShotgun.ReleaseHammer += new hook_ReleaseHammer(TubeFedShotgun_ReleaseHammer); TubeFedShotgun.CockHammer += new hook_CockHammer(TubeFedShotgun_CockHammer); TubeFedShotgun.TransferShellToUpperTrack += new hook_TransferShellToUpperTrack(TubeFedShotgun_TransferShellToUpperTrack); TubeFedShotgun.HasExtractedRound += new hook_HasExtractedRound(TubeFedShotgun_HasExtractedRound); TubeFedShotgun.UpdateCarrier += new hook_UpdateCarrier(TubeFedShotgun_UpdateCarrier); FVRFireArmRound.DuplicateFromSpawnLock += new hook_DuplicateFromSpawnLock(FVRFireArmRound_DuplicateFromSpawnLock); FVRFireArmRound.GetNumRoundsPulled += new hook_GetNumRoundsPulled(FVRFireArmRound_GetNumRoundsPulled); } private int FVRFireArmRound_GetNumRoundsPulled(orig_GetNumRoundsPulled orig, FVRFireArmRound self, FVRViveHand hand) { //IL_001a: 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) if (hand.OtherHand.CurrentInteractable is DP12_Shotgun dP12_Shotgun) { int num = 0; if (((FVRFireArm)dP12_Shotgun).RoundType == self.RoundType) { DP12_Mag dP12_Mag = ((FVRFireArm)dP12_Shotgun).Magazine as DP12_Mag; if ((Object)(object)dP12_Mag != (Object)null) { num = ((FVRFireArmMagazine)dP12_Mag).m_capacity - ((FVRFireArmMagazine)dP12_Mag).m_numRounds; num += dP12_Mag.SecondMagazine.m_capacity - dP12_Mag.SecondMagazine.m_numRounds; } for (int i = 0; i < ((FVRFireArm)dP12_Shotgun).GetChambers().Count; i++) { FVRFireArmChamber val = ((FVRFireArm)dP12_Shotgun).GetChambers()[i]; if (val.IsManuallyChamberable && (!val.IsFull || val.IsSpent)) { num++; } } } if (num == 0) { num = 1 + self.ProxyRounds.Count; } return num; } return orig.Invoke(self, hand); } private GameObject FVRFireArmRound_DuplicateFromSpawnLock(orig_DuplicateFromSpawnLock orig, FVRFireArmRound self, FVRViveHand hand) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) GameObject val = orig.Invoke(self, hand); FVRFireArmRound component = val.GetComponent<FVRFireArmRound>(); if ((int)GM.Options.ControlOptions.SmartAmmoPalming == 0 && (Object)(object)component != (Object)null && (Object)(object)hand.OtherHand.CurrentInteractable != (Object)null) { int num = 0; if (hand.OtherHand.CurrentInteractable is DP12_Shotgun dP12_Shotgun) { if (((FVRFireArm)dP12_Shotgun).RoundType == self.RoundType) { DP12_Mag dP12_Mag = ((FVRFireArm)dP12_Shotgun).Magazine as DP12_Mag; if ((Object)(object)dP12_Mag != (Object)null) { num = ((FVRFireArmMagazine)dP12_Mag).m_capacity - ((FVRFireArmMagazine)dP12_Mag).m_numRounds; num += dP12_Mag.SecondMagazine.m_capacity - dP12_Mag.SecondMagazine.m_numRounds; } for (int i = 0; i < ((FVRFireArm)dP12_Shotgun).GetChambers().Count; i++) { FVRFireArmChamber val2 = ((FVRFireArm)dP12_Shotgun).GetChambers()[i]; if (val2.IsManuallyChamberable && (!val2.IsFull || val2.IsSpent)) { num++; } } } if (num < 1) { num = self.ProxyRounds.Count; } component.DestroyAllProxies(); int num2 = Mathf.Min(self.ProxyRounds.Count, num - 1); for (int j = 0; j < num2; j++) { component.AddProxy(self.ProxyRounds[j].Class, self.ProxyRounds[j].ObjectWrapper); } component.UpdateProxyDisplay(); } } return val; } private void TubeFedShotgun_UpdateCarrier(orig_UpdateCarrier orig, TubeFedShotgun self) { //IL_006c: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)this) { if (!base.UsesAnimatedCarrier) { return; } if (((FVRInteractiveObject)this).IsHeld) { if ((Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable != (Object)null) { if (((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable is FVRFireArmRound) { if (Vector3.Distance(((Component)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).transform.position, ((FVRInteractiveObject)this).GetClosestValidPoint(base.CarrierComparePoint1.position, base.CarrierComparePoint2.position, ((Component)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).transform.position)) < base.CarrierDetectDistance) { base.m_tarCarrierRot = base.CarrierRots.y; } else { base.m_tarCarrierRot = base.CarrierRots.x; } } else { base.m_tarCarrierRot = base.CarrierRots.x; } } else { base.m_tarCarrierRot = base.CarrierRots.x; } } else { base.m_tarCarrierRot = base.CarrierRots.x; } if (((TubeFedShotgun)this).HasExtractedRound() && !base.m_isExtractedRoundOnLowerPath && !m_isSecondExtractedRoundOnLowerPath) { base.m_tarCarrierRot = base.CarrierRots.y; } if (Mathf.Abs(base.m_curCarrierRot - base.m_tarCarrierRot) > 0.001f) { base.m_curCarrierRot = Mathf.MoveTowards(base.m_curCarrierRot, base.m_tarCarrierRot, 270f * Time.deltaTime); base.Carrier.localEulerAngles = new Vector3(base.m_curCarrierRot, 0f, 0f); } } else { orig.Invoke(self); } } private bool TubeFedShotgun_HasExtractedRound(orig_HasExtractedRound orig, TubeFedShotgun self) { if ((Object)(object)self == (Object)(object)this) { if (!base.m_proxy.IsFull) { return m_secondProxy.IsFull; } return true; } return orig.Invoke(self); } private void TubeFedShotgun_TransferShellToUpperTrack(orig_TransferShellToUpperTrack orig, TubeFedShotgun self) { orig.Invoke(self); if ((Object)(object)self == (Object)(object)this && m_secondProxy.IsFull && m_isSecondExtractedRoundOnLowerPath && !SecondChamber.IsFull) { m_isSecondExtractedRoundOnLowerPath = false; } } private void TubeFedShotgun_EjectExtractedRound(orig_EjectExtractedRound orig, TubeFedShotgun self) { //IL_003f: 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_005a: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if ((Object)(object)self == (Object)(object)this && m_isSecondChamberRoundOnExtractor) { m_isSecondChamberRoundOnExtractor = false; if (SecondChamber.IsFull) { SecondChamber.EjectRound(Second_RoundPos_Ejection.position, ((Component)this).transform.right * Second_RoundEjectionSpeed.x + ((Component)this).transform.up * Second_RoundEjectionSpeed.y + ((Component)this).transform.forward * Second_RoundEjectionSpeed.z, ((Component)this).transform.right * Second_RoundEjectionSpin.x + ((Component)this).transform.up * Second_RoundEjectionSpin.y + ((Component)this).transform.forward * Second_RoundEjectionSpin.z, false); } } } private void TubeFedShotgun_ExtractRound(orig_ExtractRound orig, TubeFedShotgun self) { orig.Invoke(self); if ((Object)(object)self == (Object)(object)this) { DP12_Mag dP12_Mag = null; if ((Object)(object)((FVRFireArm)this).Magazine != (Object)null && ((FVRFireArm)this).Magazine is DP12_Mag) { dP12_Mag = ((FVRFireArm)this).Magazine as DP12_Mag; } if (!((Object)(object)dP12_Mag == (Object)null) && !m_secondProxy.IsFull && !m_secondProxy.IsFull && dP12_Mag.SecondMagazine.HasARound()) { GameObject fromPrefabReference = dP12_Mag.SecondMagazine.RemoveRound(false); m_secondProxy.SetFromPrefabReference(fromPrefabReference); m_isSecondExtractedRoundOnLowerPath = true; } } } private bool TubeFedShotgun_ChamberRound(orig_ChamberRound orig, TubeFedShotgun self) { bool result = orig.Invoke(self); if ((Object)(object)self == (Object)(object)this) { if (SecondChamber.IsFull) { m_isSecondChamberRoundOnExtractor = true; } if (m_secondProxy.IsFull && !SecondChamber.IsFull && !m_isSecondExtractedRoundOnLowerPath) { m_isSecondChamberRoundOnExtractor = true; SecondChamber.SetRound(m_secondProxy.Round, false); m_secondProxy.ClearProxy(); return true; } } return result; } private bool TubeFedShotgun_ReturnCarrierRoundToMagazineIfRelevant(orig_ReturnCarrierRoundToMagazineIfRelevant orig, TubeFedShotgun self) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) bool result = orig.Invoke(self); if ((Object)(object)self == (Object)(object)this && m_secondProxy.IsFull && m_isSecondExtractedRoundOnLowerPath && (Object)(object)((FVRFireArm)this).Magazine != (Object)null && ((FVRFireArm)this).Magazine is DP12_Mag dP12_Mag) { dP12_Mag.SecondMagazine.AddRound(m_secondProxy.Round.RoundClass, false, true); m_secondProxy.ClearProxy(); return true; } return result; } private void TubeFedShotgun_UpdateDisplayRoundPositions(orig_UpdateDisplayRoundPositions orig, TubeFedShotgun self) { //IL_00b1: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0089: 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_0111: 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_0122: 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_0148: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!((Object)(object)self == (Object)(object)this)) { return; } float boltLerpBetweenLockAndFore = base.Bolt.GetBoltLerpBetweenLockAndFore(); if (SecondChamber.IsFull) { if (m_isSecondChamberRoundOnExtractor) { SecondChamber.ProxyRound.position = Vector3.Lerp(Second_RoundPos_Ejecting.position, ((Component)SecondChamber).transform.position, boltLerpBetweenLockAndFore); SecondChamber.ProxyRound.rotation = Quaternion.Slerp(Second_RoundPos_Ejecting.rotation, ((Component)SecondChamber).transform.rotation, boltLerpBetweenLockAndFore); } else { SecondChamber.ProxyRound.position = ((Component)SecondChamber).transform.position; SecondChamber.ProxyRound.rotation = ((Component)SecondChamber).transform.rotation; } } if (m_secondProxy.IsFull) { if (m_isSecondExtractedRoundOnLowerPath || SecondChamber.IsFull) { m_secondProxy.ProxyRound.position = Vector3.Lerp(Second_RoundPos_LowerPath_Rearward.position, Second_RoundPos_LowerPath_Forward.position, boltLerpBetweenLockAndFore); m_secondProxy.ProxyRound.rotation = Quaternion.Slerp(Second_RoundPos_LowerPath_Rearward.rotation, Second_RoundPos_LowerPath_Forward.rotation, boltLerpBetweenLockAndFore); } else { m_secondProxy.ProxyRound.position = Vector3.Lerp(Second_RoundPos_UpperPath_Rearward.position, Second_RoundPos_UpperPath_Forward.position, boltLerpBetweenLockAndFore); m_secondProxy.ProxyRound.rotation = Quaternion.Slerp(Second_RoundPos_UpperPath_Rearward.rotation, Second_RoundPos_UpperPath_Forward.rotation, boltLerpBetweenLockAndFore); } } } private void TubeFedShotgun_CockHammer(orig_CockHammer orig, TubeFedShotgun self) { orig.Invoke(self); if ((Object)(object)self == (Object)(object)this) { _dP12State = EDP12State.FirstShot; } } private void TubeFedShotgun_ReleaseHammer(orig_ReleaseHammer orig, TubeFedShotgun self) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)this) { if (base.m_isHammerCocked && (int)base.Bolt.CurPos == 0) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); switch (_dP12State) { case EDP12State.FirstShot: ((TubeFedShotgun)this).Fire(); base.m_isHammerCocked = true; _dP12State = EDP12State.SecondShot; break; case EDP12State.SecondShot: FireSecondBarrel(); base.m_isHammerCocked = false; break; } if (base.HasHandle && !base.m_isHammerCocked && (int)base.Mode == 0 && _dP12State == EDP12State.SecondShot) { base.Handle.UnlockHandle(); } } } else { orig.Invoke(self); } } [ContextMenu("Copy existing TubeFedShotgun Parameters")] public void CopyTubeFedShotgunParameters() { FieldInfo[] fields = ((object)CopyTubeFedShotgun).GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(this, fieldInfo.GetValue(CopyTubeFedShotgun)); } } }
plugins/LongRecoilSystem.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LongRecoilSystem")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LongRecoilSystem")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a884ed99-57d2-4f6b-af43-06cc44340fc0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class LongRecoilSystem_OpenBolt : MonoBehaviour { public OpenBoltReceiverBolt originalBolt; public GameObject newBolt; public Transform newBoltForwardPos; public Transform newBoltLockingPos; public Transform newBoltRearwardPos; public GameObject barrel; public Transform barrelForwardPos; public Transform barrelLockingPos; public Transform barrelRearwardPos; [Range(0.01f, 0.99f)] public float barrelForwardThreshhold = 0.9f; [Header("Sound")] public AudioEvent barrelHitForward; private bool _wasHeld; private float _currentZ; private float _lastZ; private float _boltLerp; private Vector3 _lerpPosBolt; private Vector3 _lerpPosBarrel; private bool _soundPlayed; public void Awake() { ((Component)this).gameObject.SetActive(false); LongRecoilSystem_OpenBolt obj = ((Component)this).gameObject.AddComponent<LongRecoilSystem_OpenBolt>(); obj.OriginalBolt = originalBolt; obj.NewBolt = newBolt; obj.NewBoltForwardPos = newBoltForwardPos; obj.NewBoltLockingPos = newBoltLockingPos; obj.NewBoltRearwardPos = newBoltRearwardPos; obj.Barrel = barrel; obj.BarrelForwardPos = barrelForwardPos; obj.BarrelLockingPos = barrelLockingPos; obj.BarrelRearwardPos = barrelRearwardPos; obj.BarrelForwardThreshhold = barrelForwardThreshhold; obj.BarrelHitForward = barrelHitForward; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class LongRecoilSystem_TubeFedShotgun : MonoBehaviour { public TubeFedShotgunBolt originalBolt; public GameObject newBolt; public Transform newBoltForwardPos; public Transform newBoltLockingPos; public Transform newBoltRearwardPos; public GameObject barrel; public Transform barrelForwardPos; public Transform barrelLockingPos; public Transform barrelRearwardPos; [Range(0.01f, 0.99f)] public float barrelForwardThreshhold = 0.9f; [Header("Sound")] public AudioEvent barrelHitForward; private bool _wasHeld; private float _currentZ; private float _lastZ; private float _boltLerp; private Vector3 _lerpPosBolt; private Vector3 _lerpPosBarrel; private bool _soundPlayed; public void Awake() { ((Component)this).gameObject.SetActive(false); LongRecoilSystem_TubeFedShotgun obj = ((Component)this).gameObject.AddComponent<LongRecoilSystem_TubeFedShotgun>(); obj.OriginalBolt = originalBolt; obj.NewBolt = newBolt; obj.NewBoltForwardPos = newBoltForwardPos; obj.NewBoltLockingPos = newBoltLockingPos; obj.NewBoltRearwardPos = newBoltRearwardPos; obj.Barrel = barrel; obj.BarrelForwardPos = barrelForwardPos; obj.BarrelLockingPos = barrelLockingPos; obj.BarrelRearwardPos = barrelRearwardPos; obj.BarrelForwardThreshhold = barrelForwardThreshhold; obj.BarrelHitForward = barrelHitForward; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class LongRecoilSystem_ClosedBolt : MonoBehaviour { public ClosedBolt originalBolt; public GameObject newBolt; public Transform newBoltForwardPos; public Transform newBoltLockingPos; public Transform newBoltRearwardPos; public GameObject barrel; public Transform barrelForwardPos; public Transform barrelLockingPos; public Transform barrelRearwardPos; [Range(0.01f, 0.99f)] public float barrelForwardThreshhold = 0.9f; [Header("Sound")] public AudioEvent barrelHitForward; private bool _wasHeld; private float _currentZ; private float _lastZ; private float _boltLerp; private Vector3 _lerpPosBolt; private Vector3 _lerpPosBarrel; private bool _soundPlayed; public void Awake() { ((Component)this).gameObject.SetActive(false); LongRecoilSystem_ClosedBolt obj = ((Component)this).gameObject.AddComponent<LongRecoilSystem_ClosedBolt>(); obj.OriginalBolt = originalBolt; obj.NewBolt = newBolt; obj.NewBoltForwardPos = newBoltForwardPos; obj.NewBoltLockingPos = newBoltLockingPos; obj.NewBoltRearwardPos = newBoltRearwardPos; obj.Barrel = barrel; obj.BarrelForwardPos = barrelForwardPos; obj.BarrelLockingPos = barrelLockingPos; obj.BarrelRearwardPos = barrelRearwardPos; obj.BarrelForwardThreshhold = barrelForwardThreshhold; obj.BarrelHitForward = barrelHitForward; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/MagazineScripts.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using On.FistVR; using OpenScripts2; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MagazineScripts")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MagazineScripts")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f69e0da0-7ca5-44f7-ad21-e51d241ed7b2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class FireArmMagGrabTrigger : FVRInteractiveObject { public FVRFireArm FireArm; public override void Awake() { ((Component)this).gameObject.SetActive(false); ((Component)this).gameObject.AddComponent<UniversalMagazineGrabTrigger>().FireArm = FireArm; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class MagazineCutoff_Auto5 : FVRInteractiveObject { public enum TranslationType { Translation, Rotation } public enum Axis { X, Y, Z } [Header("Magazine Cutoff Config")] public TubeFedShotgun fireArm; public Transform cutoffLever; public float startLimit; public float stopLimit; public float speed; public TranslationType translationType; public Axis axis; [Header("Sound")] public AudioEvent sounds; private Vector3 startPos; private Vector3 stopPos; private Quaternion startRot; private Quaternion stopRot; private bool isMoving; private bool isActive; public override void Start() { ((FVRInteractiveObject)this).Start(); CalculatePositions(); } public override void SimpleInteraction(FVRViveHand hand) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); isActive = !isActive; SM.PlayGenericSound(sounds, cutoffLever.position); switch (translationType) { case TranslationType.Translation: if (isMoving) { ((MonoBehaviour)this).StopAllCoroutines(); } ((MonoBehaviour)this).StartCoroutine(Activate_Translation()); break; case TranslationType.Rotation: if (isMoving) { ((MonoBehaviour)this).StopAllCoroutines(); } ((MonoBehaviour)this).StartCoroutine(Activate_Rotation()); break; } } private void CalculatePositions() { //IL_003d: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01f5: 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_0204: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) switch (translationType) { case TranslationType.Translation: switch (axis) { case Axis.X: startPos = new Vector3(startLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); stopPos = new Vector3(stopLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); break; case Axis.Y: startPos = new Vector3(cutoffLever.localPosition.x, startLimit, cutoffLever.localPosition.z); stopPos = new Vector3(cutoffLever.localPosition.x, stopLimit, cutoffLever.localPosition.z); break; case Axis.Z: startPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, startLimit); stopPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, stopLimit); break; default: startPos = default(Vector3); stopPos = default(Vector3); break; } cutoffLever.localPosition = startPos; break; case TranslationType.Rotation: switch (axis) { case Axis.X: startRot = Quaternion.Euler(startLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); stopRot = Quaternion.Euler(stopLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); break; case Axis.Y: startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, startLimit, cutoffLever.localEulerAngles.z); stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, stopLimit, cutoffLever.localEulerAngles.z); break; case Axis.Z: startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, startLimit); stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, stopLimit); break; default: startRot = Quaternion.identity; stopRot = Quaternion.identity; break; } cutoffLever.localRotation = startRot; break; } } private IEnumerator Activate_Translation() { isMoving = true; Vector3 target = (isActive ? stopPos : startPos); while (cutoffLever.localPosition != target) { cutoffLever.localPosition = Vector3.MoveTowards(cutoffLever.localPosition, target, speed * Time.deltaTime); yield return null; } Activate_Magazine(); isMoving = false; } private IEnumerator Activate_Rotation() { isMoving = true; Quaternion target = (isActive ? stopRot : startRot); while (cutoffLever.localRotation != target) { cutoffLever.localRotation = Quaternion.RotateTowards(cutoffLever.localRotation, target, speed * Time.deltaTime); yield return null; } Activate_Magazine(); isMoving = false; } private void Activate_Magazine() { if (isActive) { ((FVRFireArm)fireArm).Magazine.IsExtractable = false; return; } ((FVRFireArm)fireArm).Magazine.IsExtractable = true; if (fireArm.Bolt.m_isBoltLocked) { fireArm.ExtractRound(); fireArm.TransferShellToUpperTrack(); fireArm.Bolt.ReleaseBolt(); } } } public class MagazineCutoff : FVRInteractiveObject { public enum TranslationType { Translation, Rotation } public enum Axis { X, Y, Z } [Header("Magazine Cutoff Config")] public FVRFireArm fireArm; public Transform cutoffLever; public float startLimit; public float stopLimit; public float speed; public TranslationType translationType; public Axis axis; [Header("Sound")] public AudioEvent sounds; private Vector3 _startPos; private Vector3 _stopPos; private Quaternion _startRot; private Quaternion _stopRot; private bool _magazineCuttoffActive; private FVRFireArmMagazine _mag; private Quaternion _targetRotation; private Vector3 _targetPosition; public override void Start() { ((FVRInteractiveObject)this).Start(); CalculatePositions(); } public override void SimpleInteraction(FVRViveHand hand) { //IL_0022: 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_0045: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); _magazineCuttoffActive = !_magazineCuttoffActive; SM.PlayGenericSound(sounds, cutoffLever.position); switch (translationType) { case TranslationType.Translation: _targetPosition = (_magazineCuttoffActive ? _stopPos : _startPos); break; case TranslationType.Rotation: _targetRotation = (_magazineCuttoffActive ? _stopRot : _startRot); break; } } public override void FVRUpdate() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (_magazineCuttoffActive && (Object)(object)_mag != (Object)null) { if ((Object)(object)_mag.FireArm == (Object)(object)fireArm) { _mag.IsExtractable = false; } else { _mag.IsExtractable = true; _mag = null; } } else if (!_magazineCuttoffActive && (Object)(object)_mag != (Object)null) { _mag.IsExtractable = true; } _mag = fireArm.Magazine; if (translationType == TranslationType.Rotation && cutoffLever.localRotation != _targetRotation) { cutoffLever.localRotation = Quaternion.RotateTowards(cutoffLever.localRotation, _targetRotation, speed * Time.deltaTime); } else if (translationType == TranslationType.Translation && cutoffLever.localPosition != _targetPosition) { cutoffLever.localPosition = Vector3.MoveTowards(cutoffLever.localPosition, _targetPosition, speed * Time.deltaTime); } } private void CalculatePositions() { //IL_003d: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01f5: 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_0204: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) switch (translationType) { case TranslationType.Translation: switch (axis) { case Axis.X: _startPos = new Vector3(startLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); _stopPos = new Vector3(stopLimit, cutoffLever.localPosition.y, cutoffLever.localPosition.z); break; case Axis.Y: _startPos = new Vector3(cutoffLever.localPosition.x, startLimit, cutoffLever.localPosition.z); _stopPos = new Vector3(cutoffLever.localPosition.x, stopLimit, cutoffLever.localPosition.z); break; case Axis.Z: _startPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, startLimit); _stopPos = new Vector3(cutoffLever.localPosition.x, cutoffLever.localPosition.y, stopLimit); break; default: _startPos = default(Vector3); _stopPos = default(Vector3); break; } cutoffLever.localPosition = _startPos; break; case TranslationType.Rotation: switch (axis) { case Axis.X: _startRot = Quaternion.Euler(startLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); _stopRot = Quaternion.Euler(stopLimit, cutoffLever.localEulerAngles.y, cutoffLever.localEulerAngles.z); break; case Axis.Y: _startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, startLimit, cutoffLever.localEulerAngles.z); _stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, stopLimit, cutoffLever.localEulerAngles.z); break; case Axis.Z: _startRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, startLimit); _stopRot = Quaternion.Euler(cutoffLever.localEulerAngles.x, cutoffLever.localEulerAngles.y, stopLimit); break; default: _startRot = Quaternion.identity; _stopRot = Quaternion.identity; break; } cutoffLever.localRotation = _startRot; break; } } } public class ForceMagazineMountingToMagMountPos : MonoBehaviour { public FVRFireArm fireArm; private bool posChanged; public void Awake() { ((Component)this).gameObject.SetActive(false); ((Component)this).gameObject.AddComponent<ForceMagazineMountingToMagMountPos>().FireArm = fireArm; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } internal class MagSafety : MonoBehaviour { public FVRFireArm fireArm; public int SafetyFireModePosition; private int lastFireMode; private bool magSafetyEngaged; public void Awake() { } public void Update() { FVRFireArm val = fireArm; OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val2 == null) { ClosedBoltWeapon val3 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val3 == null) { BoltActionRifle val4 = (BoltActionRifle)(object)((val is BoltActionRifle) ? val : null); if (val4 != null) { CheckState(val4); } } else { CheckState(val3); } } else { CheckState(val2); } } private void CheckState(OpenBoltReceiver s) { if ((Object)(object)((FVRFireArm)s).Magazine == (Object)null && s.m_fireSelectorMode != SafetyFireModePosition) { lastFireMode = s.m_fireSelectorMode; s.m_fireSelectorMode = SafetyFireModePosition; magSafetyEngaged = true; } else if ((Object)(object)((FVRFireArm)s).Magazine != (Object)null && magSafetyEngaged) { s.m_fireSelectorMode = lastFireMode; magSafetyEngaged = false; } } private void CheckState(ClosedBoltWeapon s) { if ((Object)(object)((FVRFireArm)s).Magazine == (Object)null && s.m_fireSelectorMode != SafetyFireModePosition) { lastFireMode = s.m_fireSelectorMode; s.m_fireSelectorMode = SafetyFireModePosition; magSafetyEngaged = true; } else if ((Object)(object)((FVRFireArm)s).Magazine != (Object)null && magSafetyEngaged) { s.m_fireSelectorMode = lastFireMode; magSafetyEngaged = false; } } private void CheckState(BoltActionRifle s) { if ((Object)(object)((FVRFireArm)s).Magazine == (Object)null && s.m_fireSelectorMode != SafetyFireModePosition) { lastFireMode = s.m_fireSelectorMode; s.m_fireSelectorMode = SafetyFireModePosition; magSafetyEngaged = true; } else if ((Object)(object)((FVRFireArm)s).Magazine != (Object)null && magSafetyEngaged) { s.m_fireSelectorMode = lastFireMode; magSafetyEngaged = false; } } } public class AutomaticStripperClip : MonoBehaviour { public FVRFireArmClip Clip; [Tooltip("Delay in Seconds. If equal to 0, all rounds will be loaded at the same time.")] public float DelayBetweenRounds; private bool _loadingRounds; public void Awake() { ((Component)this).gameObject.SetActive(false); AutomaticStripperClip obj = ((Component)this).gameObject.AddComponent<AutomaticStripperClip>(); obj.Clip = Clip; obj.DelayBetweenRounds = DelayBetweenRounds; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class MultiCaliberMagazine : MonoBehaviour { [Serializable] public class CaliberDefinition { [SearchableEnum] public FireArmRoundType RoundType; public int capacity; public GameObject[] DisplayBullets; public MeshFilter[] DisplayMeshFilters; public Renderer[] DisplayRenderers; [SearchableEnum] public FVRFireArmMechanicalAccuracyClass accuracyClass; public FVRFireArmRecoilProfile recoilProfile; public FVRFireArmRecoilProfile recoilProfileStocked; [Tooltip("Only replaces firing sounds!")] public FVRFirearmAudioSet ReplacementFiringSounds; public FVRObject objectWrapper; } public FVRFireArmMagazine magazine; public CaliberDefinition[] caliberDefinitions; [Header("Text field that shows current selected caliber on switching calibers manually.")] public GameObject canvas; public Text text; public bool alwaysShowText; public int currentCaliberDefinition; [Tooltip("Only allows insertion of mag into firearm if the caliber of the mag and the gun are equal")] public bool checksFirearmCompatibility; [Header("MeatKit required stuff. Use ContextMenu to populate.")] [SearchableEnum] public FireArmRoundType[] roundTypes; public int[] capacities; public GameObject[][] DisplayBulletss; public MeshFilter[][] DisplayMeshFilterss; public Renderer[][] DisplayRendererss; [SearchableEnum] public FVRFireArmMechanicalAccuracyClass[] accuracyClasses; public FVRFireArmRecoilProfile[] recoilProfiles; public FVRFireArmRecoilProfile[] recoilProfilesStocked; [Tooltip("Only replaces firing sounds!")] public FVRFirearmAudioSet[] ReplacementFiringSoundss; public FVRObject[] objectWrappers; public bool isMeatKit; private FVRFireArm _fireArm; private List<CaliberDefinition> _caliberDefinitionsList; private FVRFireArmMechanicalAccuracyClass _origAccuracyClass; private FVRFireArmRecoilProfile _origRecoilProfile; private FVRFireArmRecoilProfile _origRecoilProfileStocked; private AudioEvent _origFiringSounds; private AudioEvent _origSuppressedSounds; private AudioEvent _origLowPressureSounds; private bool _isDebug = true; [ContextMenu("Populate MeatKit Lists")] public void PopulateMeatKitLists() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected I4, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected I4, but got Unknown int num = caliberDefinitions.Length; roundTypes = (FireArmRoundType[])(object)new FireArmRoundType[num]; capacities = new int[num]; DisplayBulletss = new GameObject[num][]; DisplayMeshFilterss = new MeshFilter[num][]; DisplayRendererss = new Renderer[num][]; accuracyClasses = (FVRFireArmMechanicalAccuracyClass[])(object)new FVRFireArmMechanicalAccuracyClass[num]; recoilProfiles = (FVRFireArmRecoilProfile[])(object)new FVRFireArmRecoilProfile[num]; recoilProfilesStocked = (FVRFireArmRecoilProfile[])(object)new FVRFireArmRecoilProfile[num]; ReplacementFiringSoundss = (FVRFirearmAudioSet[])(object)new FVRFirearmAudioSet[num]; objectWrappers = (FVRObject[])(object)new FVRObject[num]; for (int i = 0; i < num; i++) { roundTypes[i] = (FireArmRoundType)(int)caliberDefinitions[i].RoundType; capacities[i] = caliberDefinitions[i].capacity; DisplayBulletss[i] = caliberDefinitions[i].DisplayBullets; DisplayMeshFilterss[i] = caliberDefinitions[i].DisplayMeshFilters; DisplayRendererss[i] = caliberDefinitions[i].DisplayRenderers; accuracyClasses[i] = (FVRFireArmMechanicalAccuracyClass)(int)caliberDefinitions[i].accuracyClass; recoilProfiles[i] = caliberDefinitions[i].recoilProfile; recoilProfilesStocked[i] = caliberDefinitions[i].recoilProfileStocked; ReplacementFiringSoundss[i] = caliberDefinitions[i].ReplacementFiringSounds; objectWrappers[i] = caliberDefinitions[i].objectWrapper; } if (_isDebug) { GameObject[][] displayBulletss = DisplayBulletss; foreach (GameObject[] array in displayBulletss) { foreach (GameObject val in array) { Debug.Log((object)("DisplayBullets: " + ((Object)val).name)); } } } isMeatKit = true; } public void Awake() { Hook(); } public void Start() { if (!isMeatKit) { _caliberDefinitionsList = new List<CaliberDefinition>(caliberDefinitions); } else { _caliberDefinitionsList = CreateListFromMeatKitDefines(); } PrepareCaliberDefinitions(); if (!alwaysShowText && (Object)(object)canvas != (Object)null) { canvas.SetActive(false); } } public void OnDestroy() { Unhook(); } public void Update() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Invalid comparison between Unknown and I4 //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0301: 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) FVRViveHand hand = ((FVRInteractiveObject)magazine).m_hand; if ((Object)(object)hand != (Object)null && magazine.m_numRounds == 0 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { NextCartridge(); if (!alwaysShowText && (Object)(object)text != (Object)null) { ((MonoBehaviour)this).StopCoroutine("ShowCaliberText"); ((MonoBehaviour)this).StartCoroutine("ShowCaliberText"); } } if ((int)magazine.State == 1 && (Object)(object)_fireArm == (Object)null) { _fireArm = magazine.FireArm; _origAccuracyClass = _fireArm.AccuracyClass; _origRecoilProfile = _fireArm.RecoilProfile; _origRecoilProfileStocked = _fireArm.RecoilProfileStocked; _origFiringSounds = _fireArm.AudioClipSet.Shots_Main; _origSuppressedSounds = _fireArm.AudioClipSet.Shots_Suppressed; _origLowPressureSounds = _fireArm.AudioClipSet.Shots_LowPressure; if ((int)_caliberDefinitionsList[currentCaliberDefinition].accuracyClass != 0) { _fireArm.AccuracyClass = _caliberDefinitionsList[currentCaliberDefinition].accuracyClass; } if ((Object)(object)_caliberDefinitionsList[currentCaliberDefinition].recoilProfile != (Object)null) { _fireArm.RecoilProfile = _caliberDefinitionsList[currentCaliberDefinition].recoilProfile; } if ((Object)(object)_caliberDefinitionsList[currentCaliberDefinition].recoilProfileStocked != (Object)null) { _fireArm.RecoilProfileStocked = _caliberDefinitionsList[currentCaliberDefinition].recoilProfileStocked; } if ((Object)(object)_caliberDefinitionsList[currentCaliberDefinition].ReplacementFiringSounds != (Object)null) { ReplaceFiringSounds(_caliberDefinitionsList[currentCaliberDefinition].ReplacementFiringSounds); } } else if ((int)magazine.State == 0 && (Object)(object)_fireArm != (Object)null) { _fireArm.AccuracyClass = _origAccuracyClass; _fireArm.RecoilProfile = _origRecoilProfile; _fireArm.RecoilProfileStocked = _origRecoilProfileStocked; _fireArm.AudioClipSet.Shots_Main = _origFiringSounds; _fireArm.AudioClipSet.Shots_Suppressed = _origSuppressedSounds; _fireArm.AudioClipSet.Shots_LowPressure = _origLowPressureSounds; _fireArm = null; } else if ((int)magazine.State == 1 && (Object)(object)_fireArm != (Object)null && _fireArm.RoundType != _caliberDefinitionsList[currentCaliberDefinition].RoundType && !SetCartridge(_fireArm.RoundType) && magazine.m_numRounds == 0 && checksFirearmCompatibility) { _fireArm.EjectMag(false); } if (alwaysShowText && (Object)(object)text != (Object)null) { FireArmRoundType roundType = _caliberDefinitionsList[currentCaliberDefinition].RoundType; if (AM.SRoundDisplayDataDic.ContainsKey(roundType)) { string displayName = AM.SRoundDisplayDataDic[roundType].DisplayName; text.text = displayName; } } } public void NextCartridge() { currentCaliberDefinition++; if (currentCaliberDefinition >= _caliberDefinitionsList.Count) { currentCaliberDefinition = 0; } ConfigureMagazine(currentCaliberDefinition); } public bool SetCartridge(FireArmRoundType fireArmRoundType) { //IL_0026: 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) if (magazine.m_numRounds != 0) { return false; } int num = 0; using (List<CaliberDefinition>.Enumerator enumerator = _caliberDefinitionsList.GetEnumerator()) { while (enumerator.MoveNext() && enumerator.Current.RoundType != fireArmRoundType) { num++; } } if (num == _caliberDefinitionsList.Count) { return false; } ConfigureMagazine(num); currentCaliberDefinition = num; return true; } public void ConfigureMagazine(int CaliberDefinitionIndex) { //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_0086: 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_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) magazine.RoundType = _caliberDefinitionsList[CaliberDefinitionIndex].RoundType; if (_caliberDefinitionsList[CaliberDefinitionIndex].capacity > 0) { magazine.m_capacity = _caliberDefinitionsList[CaliberDefinitionIndex].capacity; } if (_caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets.Length != 0) { magazine.m_roundInsertionTarget.localPosition = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[0].transform.localPosition; magazine.m_roundInsertionTarget.localRotation = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[0].transform.localRotation; magazine.DisplayBullets = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets; magazine.DisplayMeshFilters = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayMeshFilters; magazine.DisplayRenderers = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayRenderers; magazine.m_DisplayStartPositions = (Vector3[])(object)new Vector3[_caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets.Length]; for (int i = 0; i < _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets.Length; i++) { if ((Object)(object)_caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[i] != (Object)null) { magazine.m_DisplayStartPositions[i] = _caliberDefinitionsList[CaliberDefinitionIndex].DisplayBullets[i].transform.localPosition; } } } ((FVRPhysicalObject)magazine).ObjectWrapper = _caliberDefinitionsList[CaliberDefinitionIndex].objectWrapper; } public void ReplaceFiringSounds(FVRFirearmAudioSet set) { if (set.Shots_Main.Clips.Count > 0) { _fireArm.AudioClipSet.Shots_Main = set.Shots_Main; } if (set.Shots_Suppressed.Clips.Count > 0) { _fireArm.AudioClipSet.Shots_Suppressed = set.Shots_Suppressed; } if (set.Shots_LowPressure.Clips.Count > 0) { _fireArm.AudioClipSet.Shots_LowPressure = set.Shots_LowPressure; } } public void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown FVRFireArmRound.OnTriggerEnter -= new hook_OnTriggerEnter(FVRFireArmRound_OnTriggerEnter); if (checksFirearmCompatibility) { FVRFireArmReloadTriggerMag.OnTriggerEnter -= new hook_OnTriggerEnter(FVRFireArmReloadTriggerMag_OnTriggerEnter); } } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown FVRFireArmRound.OnTriggerEnter += new hook_OnTriggerEnter(FVRFireArmRound_OnTriggerEnter); if (checksFirearmCompatibility) { FVRFireArmReloadTriggerMag.OnTriggerEnter += new hook_OnTriggerEnter(FVRFireArmReloadTriggerMag_OnTriggerEnter); } } private void FVRFireArmReloadTriggerMag_OnTriggerEnter(orig_OnTriggerEnter orig, FVRFireArmReloadTriggerMag self, Collider collider) { //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_00f6: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)magazine == (Object)(object)self.Magazine) { if (!((Object)(object)self.Magazine != (Object)null) || !((Object)(object)self.Magazine.FireArm == (Object)null) || !((Object)(object)((FVRPhysicalObject)self.Magazine).QuickbeltSlot == (Object)null) || !(((Component)collider).gameObject.tag == "FVRFireArmReloadTriggerWell")) { return; } FVRFireArmReloadTriggerWell component = ((Component)collider).gameObject.GetComponent<FVRFireArmReloadTriggerWell>(); bool flag = false; if ((Object)(object)component != (Object)null && !self.Magazine.IsBeltBox && component.FireArm.HasBelt) { flag = true; } if (!(!((Object)(object)component != (Object)null) || component.IsBeltBox != self.Magazine.IsBeltBox || !((Object)(object)component.FireArm != (Object)null) || !((Object)(object)component.FireArm.Magazine == (Object)null) || flag)) { FireArmMagazineType val = component.FireArm.MagazineType; if (component.UsesTypeOverride) { val = component.TypeOverride; } if (val == self.Magazine.MagazineType && (!((double)component.FireArm.EjectDelay > 0.0) || (Object)(object)self.Magazine != (Object)(object)component.FireArm.LastEjectedMag) && (Object)(object)component.FireArm.Magazine == (Object)null && (!checksFirearmCompatibility || magazine.RoundType == component.FireArm.RoundType)) { self.Magazine.Load(component.FireArm); } } } else { orig.Invoke(self, collider); } } private void FVRFireArmRound_OnTriggerEnter(orig_OnTriggerEnter orig, FVRFireArmRound self, Collider collider) { //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) if (self.IsSpent) { return; } if (self.isManuallyChamberable && !self.IsSpent && (Object)(object)self.HoveredOverChamber == (Object)null && (Object)(object)self.m_hoverOverReloadTrigger == (Object)null && !self.IsSpent && ((Component)collider).gameObject.CompareTag("FVRFireArmChamber")) { FVRFireArmChamber component = ((Component)collider).gameObject.GetComponent<FVRFireArmChamber>(); if (component.RoundType == self.RoundType && component.IsManuallyChamberable && component.IsAccessible && !component.IsFull) { self.HoveredOverChamber = component; } } if (self.isMagazineLoadable && (Object)(object)self.HoveredOverChamber == (Object)null && !self.IsSpent && ((Component)collider).gameObject.CompareTag("FVRFireArmMagazineReloadTrigger")) { FVRFireArmMagazineReloadTrigger component2 = ((Component)collider).gameObject.GetComponent<FVRFireArmMagazineReloadTrigger>(); if (component2.IsClipTrigger) { if ((Object)(object)component2 != (Object)null && (Object)(object)component2.Clip != (Object)null && component2.Clip.RoundType == self.RoundType && !component2.Clip.IsFull() && ((Object)(object)component2.Clip.FireArm == (Object)null || component2.Clip.IsDropInLoadable)) { self.m_hoverOverReloadTrigger = component2; } } else if (component2.IsSpeedloaderTrigger) { if (!component2.SpeedloaderChamber.IsLoaded) { self.m_hoverOverReloadTrigger = component2; } } else if ((Object)(object)component2 != (Object)null && (Object)(object)component2.Magazine != (Object)null && component2.Magazine.RoundType == self.RoundType && !component2.Magazine.IsFull() && ((Object)(object)component2.Magazine.FireArm == (Object)null || component2.Magazine.IsDropInLoadable)) { self.m_hoverOverReloadTrigger = component2; } else if ((Object)(object)component2 != (Object)null && (Object)(object)component2.Magazine == (Object)(object)magazine && !component2.Magazine.IsFull() && ((Object)(object)component2.Magazine.FireArm == (Object)null || component2.Magazine.IsDropInLoadable) && ((Component)component2.Magazine).GetComponent<MultiCaliberMagazine>().SetCartridge(self.RoundType)) { self.m_hoverOverReloadTrigger = component2; } } if (self.isPalmable && self.ProxyRounds.Count < self.MaxPalmedAmount && !self.IsSpent && ((Component)collider).gameObject.CompareTag("FVRFireArmRound")) { FVRFireArmRound component3 = ((Component)collider).gameObject.GetComponent<FVRFireArmRound>(); if (component3.RoundType == self.RoundType && !component3.IsSpent && (Object)(object)((FVRPhysicalObject)component3).QuickbeltSlot == (Object)null) { self.HoveredOverRound = component3; } } } public IEnumerator ShowCaliberText() { FireArmRoundType roundType = _caliberDefinitionsList[currentCaliberDefinition].RoundType; if (AM.SRoundDisplayDataDic.ContainsKey(roundType)) { string displayName = AM.SRoundDisplayDataDic[roundType].DisplayName; text.text = displayName; canvas.SetActive(true); yield return (object)new WaitForSeconds(1f); } canvas.SetActive(false); yield return null; } private void PrepareCaliberDefinitions() { CaliberDefinition[] array = caliberDefinitions; foreach (CaliberDefinition caliberDefinition in array) { for (int j = 0; j < caliberDefinition.DisplayMeshFilters.Length; j++) { if (!magazine.DisplayMeshFilters.Contains(caliberDefinition.DisplayMeshFilters[j])) { caliberDefinition.DisplayMeshFilters[j].mesh = null; } } for (int k = 0; k < caliberDefinition.DisplayRenderers.Length; k++) { if (!magazine.DisplayRenderers.Contains(caliberDefinition.DisplayRenderers[k])) { caliberDefinition.DisplayRenderers[k].material = null; } } } } private List<CaliberDefinition> CreateListFromMeatKitDefines() { //IL_001b: 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) List<CaliberDefinition> result = new List<CaliberDefinition>(); for (int i = 0; i < roundTypes.Length; i++) { new CaliberDefinition { RoundType = roundTypes[i], capacity = capacities[i], DisplayBullets = DisplayBulletss[i], DisplayMeshFilters = DisplayMeshFilterss[i], DisplayRenderers = DisplayRendererss[i], accuracyClass = accuracyClasses[i], recoilProfile = recoilProfiles[i], recoilProfileStocked = recoilProfilesStocked[i], objectWrapper = objectWrappers[i] }; } return result; } }
plugins/Magazine_Tape.dll
Decompiled 10 months agousing System; using System.ComponentModel; 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("Magazine_Tape")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Magazine_Tape")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("357a6bd5-915c-4a5b-847e-7b20fab66d47")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [Obsolete("Magazine_Tape_Proxy is deprecated, please use MagazineTapeMK2 instead.")] public class Magazine_Tape_Proxy : MonoBehaviour { public FVRFireArmMagazine Magazine_1; public FVRFireArmMagazine Magazine_2; public FVRPhysicalObject PhysicalObject; private void Awake() { Magazine_Tape magazine_Tape = Magazine_Tape.CopyFromObject(PhysicalObject, ((Component)this).gameObject); magazine_Tape.Magazine_1 = Magazine_1; magazine_Tape.Magazine_2 = Magazine_2; ((Component)this).gameObject.SetActive(true); } } namespace FistVR { public class Magazine_Tape : FVRPhysicalObject { public FVRFireArmMagazine Magazine_1; public FVRFireArmMagazine Magazine_2; private Vector3 mag1pos; private Vector3 mag2pos; private Vector3 mag1euler; private Vector3 mag2euler; private Vector3 tape1pos; private Vector3 tape1euler; private Vector3 tape2pos; private Vector3 tape2euler; private bool mag1_attached; private bool mag2_attached; public override void Awake() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).Awake(); ((FVRPhysicalObject)Magazine_1).StoreAndDestroyRigidbody(); ((FVRPhysicalObject)Magazine_2).StoreAndDestroyRigidbody(); if (((FVRInteractiveObject)Magazine_1).Transform.IsChildOf(((FVRInteractiveObject)this).Transform) && ((FVRInteractiveObject)Magazine_2).Transform.IsChildOf(((FVRInteractiveObject)this).Transform)) { mag1_attached = false; mag2_attached = false; SetStandard_Transform(); ((FVRPhysicalObject)Magazine_1).SetParentage((Transform)null); Use_Mag1_Attached_Parenting(); SetMag1_Attached_Transform(); ((FVRPhysicalObject)Magazine_2).SetParentage((Transform)null); Use_Mag2_Attached_Parenting(); SetMag2_Attached_Transform(); ((FVRPhysicalObject)this).SetParentage((Transform)null); Use_Standard_Parenting(); Use_Standard_Transform(); } else if (!((FVRInteractiveObject)Magazine_1).Transform.IsChildOf(((FVRInteractiveObject)this).Transform) && ((FVRInteractiveObject)Magazine_2).Transform.IsChildOf(((FVRInteractiveObject)this).Transform)) { mag1_attached = true; mag2_attached = false; Transform parent = ((FVRInteractiveObject)Magazine_1).Transform.parent; SetMag1_Attached_Transform(); ((FVRPhysicalObject)this).SetParentage((Transform)null); Use_Standard_Parenting(); SetStandard_Transform(); ((FVRPhysicalObject)Magazine_2).SetParentage((Transform)null); Use_Mag2_Attached_Parenting(); SetMag2_Attached_Transform(); ((FVRPhysicalObject)Magazine_1).SetParentage(parent); Magazine_1.State = (MagazineState)1; Parent_to_mag1(); } else if (((FVRInteractiveObject)Magazine_1).Transform.IsChildOf(((FVRInteractiveObject)this).Transform) && !((FVRInteractiveObject)Magazine_2).Transform.IsChildOf(((FVRInteractiveObject)this).Transform)) { mag1_attached = false; mag2_attached = true; Transform parent2 = ((FVRInteractiveObject)Magazine_2).Transform.parent; SetMag2_Attached_Transform(); ((FVRPhysicalObject)this).SetParentage((Transform)null); Use_Standard_Parenting(); SetStandard_Transform(); ((FVRPhysicalObject)Magazine_1).SetParentage((Transform)null); Use_Mag1_Attached_Parenting(); SetMag1_Attached_Transform(); ((FVRPhysicalObject)Magazine_2).SetParentage(parent2); Magazine_2.State = (MagazineState)1; Parent_to_mag2(); } } public override void FVRUpdate() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); try { if ((int)Magazine_1.State == 1 && !mag1_attached) { Parent_to_mag1(); } else if ((int)Magazine_2.State == 1 && !mag2_attached) { Parent_to_mag2(); } else if ((int)Magazine_1.State == 0 && (int)Magazine_2.State == 0 && (mag1_attached || mag2_attached)) { Parent_to_null(); } if (mag1_attached) { UseMag1_Attached_Transform(); } else if (mag2_attached) { UseMag2_Attached_Transform(); } else { Use_Standard_Transform(); } } catch (Exception) { if ((Object)(object)Magazine_1 == (Object)null || (Object)(object)Magazine_2 == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Debug.LogError((object)"Error in MagTape Script!"); } } } private void Parent_to_mag1() { mag1_attached = true; mag2_attached = false; if ((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null) { ((FVRInteractiveObject)this).SetAllCollidersToLayer(true, "NoCol"); ((FVRInteractiveObject)Magazine_2).SetAllCollidersToLayer(true, "NoCol"); } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(true, "Default"); ((FVRInteractiveObject)Magazine_2).SetAllCollidersToLayer(true, "Default"); } ((FVRInteractiveObject)this).ForceBreakInteraction(); ((FVRInteractiveObject)this).IsHeld = false; ((FVRPhysicalObject)this).StoreAndDestroyRigidbody(); Use_Mag1_Attached_Parenting(); } private void Parent_to_mag2() { mag1_attached = false; mag2_attached = true; if ((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null) { ((FVRInteractiveObject)this).SetAllCollidersToLayer(true, "NoCol"); ((FVRInteractiveObject)Magazine_1).SetAllCollidersToLayer(true, "NoCol"); } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(true, "Default"); ((FVRInteractiveObject)Magazine_1).SetAllCollidersToLayer(true, "Default"); } ((FVRInteractiveObject)this).ForceBreakInteraction(); ((FVRInteractiveObject)this).IsHeld = false; ((FVRPhysicalObject)this).StoreAndDestroyRigidbody(); Use_Mag2_Attached_Parenting(); } private void Parent_to_null() { ((FVRPhysicalObject)this).SetParentage((Transform)null); ((FVRPhysicalObject)this).RecoverRigidbody(); FVRViveHand val = null; if (mag1_attached) { val = ((FVRInteractiveObject)Magazine_1).m_hand; ((FVRInteractiveObject)Magazine_1).ForceBreakInteraction(); ((FVRPhysicalObject)Magazine_1).SetParentage(((FVRInteractiveObject)this).Transform); ((FVRPhysicalObject)Magazine_1).StoreAndDestroyRigidbody(); mag1_attached = false; } if (mag2_attached) { val = ((FVRInteractiveObject)Magazine_2).m_hand; ((FVRInteractiveObject)Magazine_2).ForceBreakInteraction(); ((FVRPhysicalObject)Magazine_2).SetParentage(((FVRInteractiveObject)this).Transform); ((FVRPhysicalObject)Magazine_2).StoreAndDestroyRigidbody(); mag2_attached = false; } if ((Object)(object)val != (Object)null) { val.ForceSetInteractable((FVRInteractiveObject)(object)this); ((FVRInteractiveObject)this).BeginInteraction(val); } ((FVRInteractiveObject)Magazine_1).SetAllCollidersToLayer(true, "Interactable"); ((FVRInteractiveObject)Magazine_2).SetAllCollidersToLayer(true, "Interactable"); ((FVRInteractiveObject)this).SetAllCollidersToLayer(true, "Interactable"); ((FVRInteractiveObject)Magazine_1).SetAllCollidersToLayer(false, "Default"); ((FVRInteractiveObject)Magazine_2).SetAllCollidersToLayer(false, "Default"); ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, "Default"); } private void Use_Standard_Parenting() { ((FVRPhysicalObject)Magazine_1).SetParentage(((FVRInteractiveObject)this).Transform); ((FVRPhysicalObject)Magazine_2).SetParentage(((FVRInteractiveObject)this).Transform); } private void Use_Mag1_Attached_Parenting() { ((FVRPhysicalObject)this).SetParentage(((FVRInteractiveObject)Magazine_1).Transform); ((FVRPhysicalObject)Magazine_2).SetParentage(((FVRInteractiveObject)this).Transform); } private void Use_Mag2_Attached_Parenting() { ((FVRPhysicalObject)this).SetParentage(((FVRInteractiveObject)Magazine_2).Transform); ((FVRPhysicalObject)Magazine_1).SetParentage(((FVRInteractiveObject)this).Transform); } private void Use_Standard_Transform() { //IL_000c: 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_0038: 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) ((FVRInteractiveObject)Magazine_1).Transform.localPosition = mag1pos; ((FVRInteractiveObject)Magazine_1).Transform.localEulerAngles = mag1euler; ((FVRInteractiveObject)Magazine_2).Transform.localPosition = mag2pos; ((FVRInteractiveObject)Magazine_2).Transform.localEulerAngles = mag2euler; } private void UseMag1_Attached_Transform() { //IL_0007: 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_002e: 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) ((FVRInteractiveObject)this).Transform.localPosition = tape1pos; ((FVRInteractiveObject)this).Transform.localEulerAngles = tape1euler; ((FVRInteractiveObject)Magazine_2).Transform.localPosition = mag2pos; ((FVRInteractiveObject)Magazine_2).Transform.localEulerAngles = mag2euler; } private void UseMag2_Attached_Transform() { //IL_0007: 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_002e: 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) ((FVRInteractiveObject)this).Transform.localPosition = tape2pos; ((FVRInteractiveObject)this).Transform.localEulerAngles = tape2euler; ((FVRInteractiveObject)Magazine_1).Transform.localPosition = mag1pos; ((FVRInteractiveObject)Magazine_1).Transform.localEulerAngles = mag1euler; } private void SetStandard_Transform() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0027: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) mag1pos = ((FVRInteractiveObject)Magazine_1).Transform.localPosition; mag2pos = ((FVRInteractiveObject)Magazine_2).Transform.localPosition; mag1euler = ((FVRInteractiveObject)Magazine_1).Transform.localEulerAngles; mag2euler = ((FVRInteractiveObject)Magazine_2).Transform.localEulerAngles; } private void SetMag1_Attached_Transform() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) tape1pos = ((FVRInteractiveObject)this).Transform.localPosition; tape1euler = ((FVRInteractiveObject)this).Transform.localEulerAngles; } private void SetMag2_Attached_Transform() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) tape2pos = ((FVRInteractiveObject)this).Transform.localPosition; tape2euler = ((FVRInteractiveObject)this).Transform.localEulerAngles; } public static Magazine_Tape CopyFromObject(FVRPhysicalObject original, GameObject target) { //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_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_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_011c: 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_0128: 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_0134: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) target.gameObject.SetActive(false); Magazine_Tape magazine_Tape = target.AddComponent<Magazine_Tape>(); ((FVRInteractiveObject)magazine_Tape).ControlType = ((FVRInteractiveObject)original).ControlType; ((FVRInteractiveObject)magazine_Tape).IsSimpleInteract = ((FVRInteractiveObject)original).IsSimpleInteract; ((FVRInteractiveObject)magazine_Tape).HandlingGrabSound = ((FVRInteractiveObject)original).HandlingGrabSound; ((FVRInteractiveObject)magazine_Tape).HandlingReleaseSound = ((FVRInteractiveObject)original).HandlingReleaseSound; ((FVRInteractiveObject)magazine_Tape).PoseOverride = ((FVRInteractiveObject)original).PoseOverride; ((FVRInteractiveObject)magazine_Tape).QBPoseOverride = ((FVRInteractiveObject)original).QBPoseOverride; ((FVRInteractiveObject)magazine_Tape).PoseOverride_Touch = ((FVRInteractiveObject)original).PoseOverride_Touch; ((FVRInteractiveObject)magazine_Tape).UseGrabPointChild = ((FVRInteractiveObject)original).UseGrabPointChild; ((FVRInteractiveObject)magazine_Tape).UseGripRotInterp = ((FVRInteractiveObject)original).UseGripRotInterp; ((FVRInteractiveObject)magazine_Tape).PositionInterpSpeed = ((FVRInteractiveObject)original).PositionInterpSpeed; ((FVRInteractiveObject)magazine_Tape).RotationInterpSpeed = ((FVRInteractiveObject)original).RotationInterpSpeed; ((FVRInteractiveObject)magazine_Tape).EndInteractionIfDistant = ((FVRInteractiveObject)original).EndInteractionIfDistant; ((FVRInteractiveObject)magazine_Tape).EndInteractionDistance = ((FVRInteractiveObject)original).EndInteractionDistance; ((FVRInteractiveObject)magazine_Tape).UXGeo_Held = ((FVRInteractiveObject)original).UXGeo_Held; ((FVRInteractiveObject)magazine_Tape).UXGeo_Hover = ((FVRInteractiveObject)original).UXGeo_Hover; ((FVRInteractiveObject)magazine_Tape).UseFilteredHandTransform = ((FVRInteractiveObject)original).UseFilteredHandTransform; ((FVRInteractiveObject)magazine_Tape).UseFilteredHandRotation = ((FVRInteractiveObject)original).UseFilteredHandRotation; ((FVRInteractiveObject)magazine_Tape).UseFilteredHandPosition = ((FVRInteractiveObject)original).UseFilteredHandPosition; ((FVRInteractiveObject)magazine_Tape).UseSecondStepRotationFiltering = ((FVRInteractiveObject)original).UseSecondStepRotationFiltering; ((FVRPhysicalObject)magazine_Tape).ObjectWrapper = original.ObjectWrapper; ((FVRPhysicalObject)magazine_Tape).SpawnLockable = original.SpawnLockable; ((FVRPhysicalObject)magazine_Tape).Harnessable = original.Harnessable; ((FVRPhysicalObject)magazine_Tape).HandlingReleaseIntoSlotSound = original.HandlingReleaseIntoSlotSound; ((FVRPhysicalObject)magazine_Tape).Size = original.Size; ((FVRPhysicalObject)magazine_Tape).QBSlotType = original.QBSlotType; ((FVRPhysicalObject)magazine_Tape).ThrowVelMultiplier = original.ThrowVelMultiplier; ((FVRPhysicalObject)magazine_Tape).ThrowAngMultiplier = original.ThrowAngMultiplier; ((FVRPhysicalObject)magazine_Tape).UsesGravity = original.UsesGravity; ((FVRPhysicalObject)magazine_Tape).DependantRBs = original.DependantRBs; ((FVRPhysicalObject)magazine_Tape).DistantGrabbable = original.DistantGrabbable; ((FVRPhysicalObject)magazine_Tape).IsDebug = original.IsDebug; ((FVRPhysicalObject)magazine_Tape).IsAltHeld = original.IsAltHeld; ((FVRPhysicalObject)magazine_Tape).IsKinematicLocked = original.IsKinematicLocked; ((FVRPhysicalObject)magazine_Tape).DoesQuickbeltSlotFollowHead = original.DoesQuickbeltSlotFollowHead; ((FVRPhysicalObject)magazine_Tape).IsInWater = original.IsInWater; ((FVRPhysicalObject)magazine_Tape).AttachmentMounts = original.AttachmentMounts; ((FVRPhysicalObject)magazine_Tape).IsAltToAltTransfer = original.IsAltToAltTransfer; ((FVRPhysicalObject)magazine_Tape).CollisionSound = original.CollisionSound; ((FVRPhysicalObject)magazine_Tape).IsPickUpLocked = original.IsPickUpLocked; ((FVRPhysicalObject)magazine_Tape).OverridesObjectToHand = original.OverridesObjectToHand; ((FVRPhysicalObject)magazine_Tape).MP = original.MP; Object.Destroy((Object)(object)original); return magazine_Tape; } } } namespace System.Runtime.CompilerServices { [EditorBrowsable(EditorBrowsableState.Never)] internal class IsExternalInit { } } namespace Cityrobo { public class MagazineTapeMK2 : MonoBehaviour { private enum ActiveMagazine { primary, secondary } private enum AttachedMagazine { none, primary, secondary } [Tooltip("Main Magazine")] public FVRFireArmMagazine primaryMagazine; [Tooltip("Attached Magazine")] public FVRFireArmMagazine secondaryMagazine; [Tooltip("Tape visuals and colliders (not a requirement)")] public GameObject tape; [Header("Relative Mag Positions (Use Context Menu to calculate)")] [Tooltip("Primary mag position when parented to secondary mag.")] [ReadOnly] public Vector3 primary2SecondaryPos; [Tooltip("Primary mag rotation when parented to secondary mag.")] [ReadOnly] public Quaternion primary2SecondaryRot; [Tooltip("Secondary mag position when parented to primary mag.")] [ReadOnly] public Vector3 secondary2PrimaryPos; [Tooltip("Primary mag rotation when parented to primary mag.")] [ReadOnly] public Quaternion secondary2PrimaryRot; private ActiveMagazine activeMagazine; private AttachedMagazine attachedMagazine; [ContextMenu("Calculate Relative Mag Positions")] public void CalculateReltativeMagPositions() { //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_0021: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) secondary2PrimaryPos = ((Component)primaryMagazine).transform.InverseTransformPoint(((Component)secondaryMagazine).transform.position); secondary2PrimaryRot = Quaternion.Inverse(((Component)primaryMagazine).transform.rotation) * ((Component)secondaryMagazine).transform.rotation; primary2SecondaryPos = ((Component)secondaryMagazine).transform.InverseTransformPoint(((Component)primaryMagazine).transform.position); primary2SecondaryRot = Quaternion.Inverse(((Component)secondaryMagazine).transform.rotation) * ((Component)primaryMagazine).transform.rotation; } public void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 if ((int)primaryMagazine.State == 1) { attachedMagazine = AttachedMagazine.primary; ((FVRPhysicalObject)secondaryMagazine).StoreAndDestroyRigidbody(); ((Component)secondaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); } else if ((int)secondaryMagazine.State == 1) { attachedMagazine = AttachedMagazine.secondary; activeMagazine = ActiveMagazine.secondary; ((FVRPhysicalObject)primaryMagazine).StoreAndDestroyRigidbody(); ((Component)primaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); } else if ((Object)(object)((Component)primaryMagazine).transform.parent == (Object)(object)((Component)secondaryMagazine).transform) { activeMagazine = ActiveMagazine.secondary; ((FVRPhysicalObject)primaryMagazine).StoreAndDestroyRigidbody(); ((Component)primaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); } else { activeMagazine = ActiveMagazine.primary; ((FVRPhysicalObject)secondaryMagazine).StoreAndDestroyRigidbody(); ((Component)secondaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); } Hook(); } public void OnDestroy() { Unhook(); } public void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Invalid comparison between Unknown and I4 //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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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) try { if ((int)primaryMagazine.State == 1 && attachedMagazine == AttachedMagazine.none && activeMagazine == ActiveMagazine.secondary) { attachedMagazine = AttachedMagazine.primary; ((FVRInteractiveObject)secondaryMagazine).ForceBreakInteraction(); ((FVRInteractiveObject)secondaryMagazine).IsHeld = false; ((Component)secondaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); ((Component)primaryMagazine).gameObject.layer = LayerMask.NameToLayer("Interactable"); UsePrimaryAsParent(((Component)primaryMagazine).transform.parent); ((FVRPhysicalObject)secondaryMagazine).StoreAndDestroyRigidbody(); } else if ((int)secondaryMagazine.State == 1 && attachedMagazine == AttachedMagazine.none && activeMagazine == ActiveMagazine.primary) { attachedMagazine = AttachedMagazine.secondary; ((FVRInteractiveObject)primaryMagazine).ForceBreakInteraction(); ((FVRInteractiveObject)primaryMagazine).IsHeld = false; ((Component)primaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); ((Component)secondaryMagazine).gameObject.layer = LayerMask.NameToLayer("Interactable"); UseSecondaryAsParent(((Component)secondaryMagazine).transform.parent); ((FVRPhysicalObject)primaryMagazine).StoreAndDestroyRigidbody(); } else if ((int)primaryMagazine.State == 0 && (int)secondaryMagazine.State == 0) { attachedMagazine = AttachedMagazine.none; } if (activeMagazine == ActiveMagazine.primary) { UpdateSecondaryMagTransform(); } else if (activeMagazine == ActiveMagazine.secondary) { UpdatePrimaryMagTransform(); } } catch (Exception ex) { if ((Object)(object)primaryMagazine == (Object)null || (Object)(object)secondaryMagazine == (Object)null) { Object.Destroy((Object)(object)tape); Object.Destroy((Object)(object)((Component)this).GetComponent<MagazineTapeMK2>()); } else { Debug.LogError((object)"Error in MagazineTapeMK2 Script!"); Debug.LogException(ex); } } if (activeMagazine == ActiveMagazine.primary) { if ((Object)(object)((FVRInteractiveObject)primaryMagazine).m_hand != (Object)null) { FVRViveHand hand = ((FVRInteractiveObject)primaryMagazine).m_hand; if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { ChangeActiveToSecondary(hand); } } } else if (activeMagazine == ActiveMagazine.secondary && (Object)(object)((FVRInteractiveObject)secondaryMagazine).m_hand != (Object)null) { FVRViveHand hand2 = ((FVRInteractiveObject)secondaryMagazine).m_hand; if (hand2.Input.TouchpadDown && Vector2.Angle(hand2.Input.TouchpadAxes, Vector2.right) < 45f) { ChangeActiveToPrimary(hand2); } } } private void UsePrimaryAsParent(Transform parent = null) { activeMagazine = ActiveMagazine.primary; ((Component)primaryMagazine).transform.SetParent(parent); ((Component)secondaryMagazine).transform.SetParent(((Component)primaryMagazine).transform); } private void UseSecondaryAsParent(Transform parent = null) { activeMagazine = ActiveMagazine.secondary; ((Component)secondaryMagazine).transform.SetParent(parent); ((Component)primaryMagazine).transform.SetParent(((Component)secondaryMagazine).transform); } private void UpdateSecondaryMagTransform() { //IL_000c: 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) ((Component)secondaryMagazine).transform.localPosition = secondary2PrimaryPos; ((Component)secondaryMagazine).transform.localRotation = secondary2PrimaryRot; } private void UpdatePrimaryMagTransform() { //IL_000c: 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) ((Component)primaryMagazine).transform.localPosition = primary2SecondaryPos; ((Component)primaryMagazine).transform.localRotation = primary2SecondaryRot; } private void ChangeActiveToPrimary(FVRViveHand hand) { ((FVRInteractiveObject)secondaryMagazine).ForceBreakInteraction(); ((FVRInteractiveObject)secondaryMagazine).IsHeld = false; ((Component)secondaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); ((FVRPhysicalObject)primaryMagazine).RecoverRigidbody(); UsePrimaryAsParent(); ((FVRPhysicalObject)secondaryMagazine).StoreAndDestroyRigidbody(); hand.ForceSetInteractable((FVRInteractiveObject)(object)primaryMagazine); ((FVRInteractiveObject)primaryMagazine).BeginInteraction(hand); ((Component)primaryMagazine).gameObject.layer = LayerMask.NameToLayer("Interactable"); } private void ChangeActiveToSecondary(FVRViveHand hand) { ((FVRInteractiveObject)primaryMagazine).ForceBreakInteraction(); ((FVRInteractiveObject)primaryMagazine).IsHeld = false; ((Component)primaryMagazine).gameObject.layer = LayerMask.NameToLayer("NoCol"); ((FVRPhysicalObject)secondaryMagazine).RecoverRigidbody(); UseSecondaryAsParent(); ((FVRPhysicalObject)primaryMagazine).StoreAndDestroyRigidbody(); hand.ForceSetInteractable((FVRInteractiveObject)(object)secondaryMagazine); ((FVRInteractiveObject)secondaryMagazine).BeginInteraction(hand); ((Component)secondaryMagazine).gameObject.layer = LayerMask.NameToLayer("Interactable"); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown FVRFireArmMagazine.DuplicateFromSpawnLock -= new hook_DuplicateFromSpawnLock(FVRFireArmMagazine_DuplicateFromSpawnLock); FVRWristMenu.CleanUpScene_Empties -= new hook_CleanUpScene_Empties(FVRWristMenu_CleanUpScene_Empties); } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown FVRFireArmMagazine.DuplicateFromSpawnLock += new hook_DuplicateFromSpawnLock(FVRFireArmMagazine_DuplicateFromSpawnLock); FVRWristMenu.CleanUpScene_Empties += new hook_CleanUpScene_Empties(FVRWristMenu_CleanUpScene_Empties); } private void FVRWristMenu_CleanUpScene_Empties(orig_CleanUpScene_Empties orig, FVRWristMenu self) { self.Aud.PlayOneShot(self.AudClip_Engage, 1f); if (!self.askConfirm_CleanupEmpties) { self.ResetConfirm(); self.AskConfirm_CleanupEmpties(); return; } self.ResetConfirm(); FVRFireArmMagazine[] array = Object.FindObjectsOfType<FVRFireArmMagazine>(); for (int num = array.Length - 1; num >= 0; num--) { if (!((FVRInteractiveObject)array[num]).IsHeld && (Object)(object)((FVRPhysicalObject)array[num]).QuickbeltSlot == (Object)null && (Object)(object)array[num].FireArm == (Object)null && array[num].m_numRounds == 0 && (Object)(object)((Component)array[num]).GetComponentInChildren<MagazineTapeMK2>() == (Object)null) { Object.Destroy((Object)(object)((Component)array[num]).gameObject); } } FVRFireArmRound[] array2 = Object.FindObjectsOfType<FVRFireArmRound>(); for (int num2 = array2.Length - 1; num2 >= 0; num2--) { if (!((FVRInteractiveObject)array2[num2]).IsHeld && (Object)(object)((FVRPhysicalObject)array2[num2]).QuickbeltSlot == (Object)null && (Object)(object)((FVRPhysicalObject)array2[num2]).RootRigidbody != (Object)null) { Object.Destroy((Object)(object)((Component)array2[num2]).gameObject); } } FVRFireArmClip[] array3 = Object.FindObjectsOfType<FVRFireArmClip>(); for (int num3 = array3.Length - 1; num3 >= 0; num3--) { if (!((FVRInteractiveObject)array3[num3]).IsHeld && (Object)(object)((FVRPhysicalObject)array3[num3]).QuickbeltSlot == (Object)null && (Object)(object)array3[num3].FireArm == (Object)null && array3[num3].m_numRounds == 0) { Object.Destroy((Object)(object)((Component)array3[num3]).gameObject); } } Speedloader[] array4 = Object.FindObjectsOfType<Speedloader>(); for (int num4 = array4.Length - 1; num4 >= 0; num4--) { if (!((FVRInteractiveObject)array4[num4]).IsHeld && (Object)(object)((FVRPhysicalObject)array4[num4]).QuickbeltSlot == (Object)null) { Object.Destroy((Object)(object)((Component)array4[num4]).gameObject); } } } private GameObject FVRFireArmMagazine_DuplicateFromSpawnLock(orig_DuplicateFromSpawnLock orig, FVRFireArmMagazine self, FVRViveHand hand) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) GameObject val = orig.Invoke(self, hand); if ((Object)(object)self == (Object)(object)primaryMagazine) { FVRFireArmMagazine val2 = val.GetComponent<MagazineTapeMK2>().secondaryMagazine; for (int i = 0; i < Mathf.Min(secondaryMagazine.LoadedRounds.Length, val2.LoadedRounds.Length); i++) { if (secondaryMagazine.LoadedRounds[i] != null && (Object)(object)secondaryMagazine.LoadedRounds[i].LR_Mesh != (Object)null) { val2.LoadedRounds[i].LR_Class = secondaryMagazine.LoadedRounds[i].LR_Class; val2.LoadedRounds[i].LR_Mesh = secondaryMagazine.LoadedRounds[i].LR_Mesh; val2.LoadedRounds[i].LR_Material = secondaryMagazine.LoadedRounds[i].LR_Material; val2.LoadedRounds[i].LR_ObjectWrapper = secondaryMagazine.LoadedRounds[i].LR_ObjectWrapper; } } val2.m_numRounds = secondaryMagazine.m_numRounds; val2.UpdateBulletDisplay(); return val; } if ((Object)(object)self == (Object)(object)secondaryMagazine) { FVRFireArmMagazine val3 = val.GetComponentInChildren<MagazineTapeMK2>().primaryMagazine; for (int j = 0; j < Mathf.Min(primaryMagazine.LoadedRounds.Length, val3.LoadedRounds.Length); j++) { if (primaryMagazine.LoadedRounds[j] != null && (Object)(object)primaryMagazine.LoadedRounds[j].LR_Mesh != (Object)null) { val3.LoadedRounds[j].LR_Class = primaryMagazine.LoadedRounds[j].LR_Class; val3.LoadedRounds[j].LR_Mesh = primaryMagazine.LoadedRounds[j].LR_Mesh; val3.LoadedRounds[j].LR_Material = primaryMagazine.LoadedRounds[j].LR_Material; val3.LoadedRounds[j].LR_ObjectWrapper = primaryMagazine.LoadedRounds[j].LR_ObjectWrapper; } } val3.m_numRounds = primaryMagazine.m_numRounds; val3.UpdateBulletDisplay(); return val; } return val; } private void FVRFireArmMagazine_ReloadMagWithType(orig_ReloadMagWithType orig, FVRFireArmMagazine self, FireArmRoundClass rClass) { //IL_0095: 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_006d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)primaryMagazine || (Object)(object)self == (Object)(object)secondaryMagazine) { primaryMagazine.m_numRounds = 0; for (int i = 0; i < primaryMagazine.m_capacity; i++) { primaryMagazine.AddRound(rClass, false, false); } primaryMagazine.UpdateBulletDisplay(); secondaryMagazine.m_numRounds = 0; for (int j = 0; j < secondaryMagazine.m_capacity; j++) { secondaryMagazine.AddRound(rClass, false, false); } secondaryMagazine.UpdateBulletDisplay(); } else { orig.Invoke(self, rClass); } } } }
plugins/MagPoseCycler.dll
Decompiled 10 months agousing 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 OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MagPoseCycler")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MagPoseCycler")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("10998b6d-3a0b-44ac-9238-31427237c3a7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class HandDependentPoseOverride : MonoBehaviour { public FVRPhysicalObject physicalObject; public Transform leftPoseOverride; public Transform leftPoseOverride_Touch; public Transform rightPoseOverride; public Transform rightPoseOverride_Touch; private bool hasPoseOverride_Touch; public void Awake() { ((Component)this).gameObject.SetActive(false); HandDependentPoseOverride obj = ((Component)this).gameObject.AddComponent<HandDependentPoseOverride>(); obj.PhysicalObject = physicalObject; obj.LeftPoseOverride = leftPoseOverride; obj.LeftPoseOverride_Touch = leftPoseOverride_Touch; obj.RightPoseOverride = rightPoseOverride; obj.RightPoseOverride_Touch = rightPoseOverride_Touch; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class MagPoseCycler : MonoBehaviour { public FVRFireArmMagazine magazine; public List<Transform> alternatePoseOverrides; private int poseIndex; private Vector3 positionalOffset = new Vector3(0f, 0f, 0f); private Quaternion rotationalOffset; private bool offsetCalculated; public void Awake() { ((Component)this).gameObject.SetActive(false); MagazinePoseCycler obj = ((Component)this).gameObject.AddComponent<MagazinePoseCycler>(); obj.Magazine = magazine; obj.AlternatePoseOverrides = alternatePoseOverrides; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/ManipulateObjectAttachmentProxy.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ManipulateObjectAttachmentProxy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ManipulateObjectAttachmentProxy")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("51009977-eafe-4a7b-874f-8fc024600c3b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class ManipulateObjectAttachmentProxy : MonoBehaviour { public enum TargetType { Bolt, Trigger, BoltHandle, Safety, FireSelector, MagazineRelease, BoltRelease, Hammer } public FVRFireArmAttachment attachment; public TargetType targetType; [Header("Alternative target by name:")] public bool useAlternativeMethod; [Tooltip("If the part you wanna monitor doesn't exist as a type, you can put in the exact path of the part (without the parent) that you wanna proxy and it will get that one on the gun instead.")] public string targetPath; private FVRPhysicalObject weapon; private Transform proxy; private bool debug; public void Update() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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) if ((Object)(object)attachment.curMount != (Object)null && !useAlternativeMethod) { if ((Object)(object)proxy == (Object)null) { DebugMessage("Grabbing mounted item."); weapon = attachment.curMount.GetRootMount().MyObject; DebugMessage("Mounted Item: " + ((Object)weapon).name); FVRPhysicalObject val = weapon; OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val2 == null) { ClosedBoltWeapon val3 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val3 == null) { Handgun val4 = (Handgun)(object)((val is Handgun) ? val : null); if (val4 == null) { TubeFedShotgun val5 = (TubeFedShotgun)(object)((val is TubeFedShotgun) ? val : null); if (val5 == null) { BoltActionRifle val6 = (BoltActionRifle)(object)((val is BoltActionRifle) ? val : null); if (val6 != null) { DebugMessage("BoltActionRifle found!"); SetProxy(val6); } else { Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: Parent object is not a supported firearm!"); } } else { DebugMessage("TubeFedShotgun found!"); SetProxy(val5); } } else { DebugMessage("Handgun found!"); SetProxy(val4); } } else { DebugMessage("ClosedBoltWeapon found!"); SetProxy(val3); } } else { DebugMessage("OpenBoltReceiver found!"); SetProxy(val2); } } if ((Object)(object)proxy != (Object)null) { ((Component)this).transform.localPosition = proxy.localPosition; ((Component)this).transform.localRotation = proxy.localRotation; ((Component)this).transform.localScale = proxy.localScale; } } else if ((Object)(object)attachment.curMount != (Object)null && useAlternativeMethod) { if ((Object)(object)proxy == (Object)null) { DebugMessage("Grabbing mounted item."); weapon = attachment.curMount.GetRootMount().MyObject; DebugMessage("Mounted Item: " + ((Object)weapon).name); proxy = ((Component)weapon).transform.Find(targetPath); } if ((Object)(object)proxy != (Object)null) { ((Component)this).transform.localPosition = proxy.localPosition; ((Component)this).transform.localRotation = proxy.localRotation; ((Component)this).transform.localScale = proxy.localScale; } else { Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: Could not find target with alternative mode path!"); } } else { proxy = null; } } private void SetProxy(OpenBoltReceiver s) { switch (targetType) { case TargetType.Bolt: proxy = ((Component)s.Bolt).transform; break; case TargetType.Trigger: proxy = s.Trigger; break; case TargetType.BoltHandle: { OpenBoltChargingHandle componentInChildren = ((Component)s).GetComponentInChildren<OpenBoltChargingHandle>(); proxy = ((Component)componentInChildren).transform; break; } case TargetType.Safety: proxy = s.FireSelectorSwitch; break; case TargetType.FireSelector: proxy = s.FireSelectorSwitch2; break; case TargetType.MagazineRelease: proxy = s.MagReleaseButton; break; default: Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: TargetType not available for this type of FireArm!"); break; } } private void SetProxy(ClosedBoltWeapon s) { switch (targetType) { case TargetType.Bolt: proxy = ((Component)s.Bolt).transform; break; case TargetType.Trigger: proxy = s.Trigger; break; case TargetType.BoltHandle: proxy = ((Component)s.Handle).transform; break; case TargetType.Safety: proxy = s.FireSelectorSwitch; break; case TargetType.FireSelector: proxy = s.FireSelectorSwitch2; break; case TargetType.Hammer: proxy = s.Bolt.Hammer; break; default: Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: TargetType not available for this type of FireArm!"); break; } } private void SetProxy(Handgun s) { switch (targetType) { case TargetType.Bolt: proxy = ((Component)s.Slide).transform; break; case TargetType.Trigger: proxy = s.Trigger; break; case TargetType.MagazineRelease: proxy = s.MagazineReleaseButton; break; case TargetType.Safety: if (debug && (Object)(object)s.Safety == (Object)null) { Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: Handgun.Safety == null"); } if (debug) { DebugMessage("Safety: " + (object)s.Safety); } proxy = s.Safety; if (debug) { DebugMessage("proxy: " + (object)proxy); } break; case TargetType.FireSelector: proxy = s.FireSelector; break; case TargetType.BoltRelease: proxy = s.SlideRelease; break; case TargetType.Hammer: proxy = s.Hammer; break; default: Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: TargetType not available for this type of FireArm!"); break; } if (debug && (Object)(object)proxy == (Object)null) { Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: Proxy should be set but isn't!"); } } private void SetProxy(TubeFedShotgun s) { switch (targetType) { case TargetType.Bolt: proxy = ((Component)s.Bolt).transform; break; case TargetType.Trigger: proxy = s.Trigger; break; case TargetType.Safety: proxy = s.Safety; break; case TargetType.Hammer: proxy = s.Bolt.Hammer; break; default: Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: TargetType not available for this type of FireArm!"); break; } } private void SetProxy(BoltActionRifle s) { switch (targetType) { case TargetType.Bolt: proxy = ((Component)s.BoltHandle).transform; break; case TargetType.Trigger: proxy = ((Component)s.Trigger_Display).transform; break; case TargetType.Safety: proxy = s.FireSelector_Display; break; case TargetType.Hammer: proxy = s.Hammer; break; default: Debug.LogWarning((object)"ManipulateObjectAttachmentProxy: TargetType not available for this type of FireArm!"); break; } } private void DebugMessage(string message) { if (debug) { Debug.Log((object)("ManipulateObjectAttachmentProxy: " + message)); } } }
plugins/Manipulate_Animator.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Manipulate_Animator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Manipulate_Animator")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c64e08e2-d992-40e3-9d08-d558dcaddbd7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace Manipulate_Animator; public class Manipulate_BlendShape : MonoBehaviour { public enum Axis { X, Y, Z } public SkinnedMeshRenderer SkinnedMeshRenderer; public int BlendShapeIndex; public Transform ObservedObject; public Vector3 ObservedObject_Start; public Vector3 ObservedObject_End; public Axis Direction; private float _lastLerp; public void Awake() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.SetActive(false); ManipulateBlendShape obj = ((Component)this).gameObject.AddComponent<ManipulateBlendShape>(); obj.skinnedMeshRenderer = SkinnedMeshRenderer; obj.ObservedObject = ObservedObject; obj.BlendShapeIndex = BlendShapeIndex; obj.ObservedObject_Start = ObservedObject_Start; obj.ObservedObject_End = ObservedObject_End; obj.Direction = (Axis)Direction; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class Manipulate_Animator : MonoBehaviour { public enum dirtype { x, y, z } public Animator animator; public GameObject Observed_Object; public float wiggleroom = 0.05f; public Vector3 start; public Vector3 end; public dirtype direction; public bool isRotation; public void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.SetActive(false); ManipulateAnimator obj = ((Component)this).gameObject.AddComponent<ManipulateAnimator>(); obj.Animator = animator; obj.ObservedObject = Observed_Object; obj.AnimationNodeName = "animation"; obj.Start = UnityEngineExtensions.GetAxisValue(start, (Axis)direction); obj.End = UnityEngineExtensions.GetAxisValue(end, (Axis)direction); obj.Direction = (Axis)direction; obj.IsRotation = isRotation; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/MeatBeatScanner.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MeatBeatScanner")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MeatBeatScanner")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3f33c54a-7bcb-4398-8643-82ab4c47c6f8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class MeatBeatScanner : FVRFireArmAttachment { [Header("MeatBeat Scanner Config")] public float range; public float EngageAngle; public RectTransform currentScreen; public GameObject pingDotReference; public LayerMask LatchingMask; public bool canRotateScreen; [Tooltip("Different Screen orientations")] public GameObject[] images; private Dictionary<SosigLink, GameObject> pings; private GameObject directionReference; private int currentImage; public override void Awake() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArmAttachment)this).Awake(); pingDotReference.SetActive(false); pings = new Dictionary<SosigLink, GameObject>(); directionReference = new GameObject("MeatBeatScanner DirectionReference"); directionReference.transform.parent = ((Component)this).transform; directionReference.transform.localPosition = default(Vector3); if (canRotateScreen) { currentScreen = images[0].GetComponent<RectTransform>(); } } public override void Start() { ((FVRInteractiveObject)this).Start(); } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if (canRotateScreen && (Object)(object)base.curMount != (Object)null && (Object)(object)((FVRInteractiveObject)base.AttachmentInterface).m_hand != (Object)null) { UpdateInputs(((FVRInteractiveObject)base.AttachmentInterface).m_hand); } UpdateScreen(); } public override void UpdateInteraction(FVRViveHand hand) { ((FVRFireArmAttachment)this).UpdateInteraction(hand); if (canRotateScreen) { UpdateInputs(hand); } } public void UpdateScreen() { //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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_006c: 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_00d5: 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_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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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) List<SosigLink> list = FindSosigs(); ClearPings(list); Vector3 val3 = default(Vector3); foreach (SosigLink item in list) { Vector3 position = ((Component)item).transform.position; Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.forward, Vector3.up); directionReference.transform.rotation = Quaternion.LookRotation(val, Vector3.up); Vector3 val2 = directionReference.transform.InverseTransformPoint(position); _ = ((Vector3)(ref val2)).magnitude; if (!pings.TryGetValue(item, out var value)) { value = Object.Instantiate<GameObject>(pingDotReference); value.transform.SetParent((Transform)(object)currentScreen); pings.Add(item, value); } ((Vector3)(ref val3))..ctor(0f, 0f, -0.0001f); Rect rect = currentScreen.rect; float num = ((Rect)(ref rect)).width / 2f; rect = currentScreen.rect; float height = ((Rect)(ref rect)).height; float num2 = Mathf.Max(num, height); val3.x = val2.x / range * num2; val3.y = val2.z / range * num2; if (Mathf.Abs(val3.x) > num || Mathf.Abs(val3.y) > height) { value.SetActive(false); } else { value.SetActive(true); } value.transform.localPosition = val3; value.transform.localRotation = pingDotReference.transform.localRotation; value.transform.localScale = pingDotReference.transform.localScale; } } private List<SosigLink> FindSosigs() { //IL_000c: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Invalid comparison between Unknown and I4 //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) List<SosigLink> list = new List<SosigLink>(); Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, range, LayerMask.op_Implicit(LatchingMask)); List<Rigidbody> list2 = new List<Rigidbody>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].attachedRigidbody != (Object)null && !list2.Contains(array[i].attachedRigidbody)) { list2.Add(array[i].attachedRigidbody); } } SosigLink val = null; float num = EngageAngle / 2f; for (int j = 0; j < list2.Count; j++) { SosigLink component = ((Component)list2[j]).GetComponent<SosigLink>(); if (!((Object)(object)component == (Object)null) && (int)component.S.BodyState != 3) { Vector3 val2 = ((Component)component).transform.position - ((Component)this).transform.position; float num2; try { num2 = Vector3.Angle(new Vector3(((Component)this).transform.forward.x, 0f, ((Component)this).transform.forward.z), new Vector3(val2.x, 0f, val2.z)); } catch (Exception) { num2 = 360f; } val = component.S.Links[0]; if (num2 < num && !list.Contains(val)) { list.Add(val); } } } return list; } private void ClearPings(List<SosigLink> sosigs) { if (pings == null) { pings = new Dictionary<SosigLink, GameObject>(); } if (sosigs.Count > 0) { for (int i = 0; i < pings.Count; i++) { SosigLink key = pings.ElementAt(i).Key; if (!sosigs.Contains(key)) { pings.TryGetValue(key, out var value); Object.Destroy((Object)(object)value); pings.Remove(key); } } return; } foreach (KeyValuePair<SosigLink, GameObject> ping in pings) { Object.Destroy((Object)(object)ping.Value); } pings.Clear(); } private void UpdateInputs(FVRViveHand hand) { //IL_001b: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!hand.IsInStreamlinedMode) { if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { NextRotation(); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { PreviousRotation(); } } else if (hand.Input.BYButtonDown) { NextRotation(); } } private void NextRotation() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) currentImage++; if (currentImage >= images.Length) { currentImage = 0; } for (int i = 0; i < images.Length; i++) { images[i].SetActive(i == currentImage); } currentScreen = images[currentImage].GetComponent<RectTransform>(); foreach (KeyValuePair<SosigLink, GameObject> ping in pings) { Vector3 localPosition = ping.Value.transform.localPosition; ping.Value.transform.SetParent((Transform)(object)currentScreen); ping.Value.transform.localPosition = localPosition; } } private void PreviousRotation() { //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_00b3: Unknown result type (might be due to invalid IL or missing references) currentImage--; if (currentImage < 0) { currentImage = images.Length - 1; } for (int i = 0; i < images.Length; i++) { images[i].SetActive(i == currentImage); } currentScreen = images[currentImage].GetComponent<RectTransform>(); foreach (KeyValuePair<SosigLink, GameObject> ping in pings) { Vector3 localPosition = ping.Value.transform.localPosition; ping.Value.transform.SetParent((Transform)(object)currentScreen); ping.Value.transform.localPosition = localPosition; } } }
plugins/MeatyPages.dll
Decompiled 10 months agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MeatyPages")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MeatyPages")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6611fe91-3e6d-4e72-8581-926f9d531c5b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class Booklet : FVRPhysicalObject { [Header("Booklet Config")] public GameObject[] pages; public float startAngle; public float flipAngle = 180f; public float flipSpeed = 180f; public Axis pageAxis; [Header("Booklet Sounds")] public AudioEvent flipPageLeft; public AudioEvent flipPageRight; public AudioEvent closeBooklet; private int currentPage; private bool isFlipping; private bool isClosing; public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); UpdateInputsAndAnimate(hand); } private void UpdateInputsAndAnimate(FVRViveHand hand) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hand != (Object)null) { if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { FlipLeft(); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { FlipRight(); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { CloseBooklet(); } } } private void FlipLeft() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!isClosing && currentPage < pages.Length) { SM.PlayGenericSound(flipPageLeft, ((Component)this).transform.position); if (isFlipping) { ((MonoBehaviour)this).StopAllCoroutines(); pages[currentPage - 1].transform.localRotation = Quaternion.Euler(GetRotationalVector(flipAngle)); } ((MonoBehaviour)this).StartCoroutine(FlipPage(pages[currentPage], flipAngle)); currentPage++; } } private void FlipRight() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!isClosing && currentPage > 0) { SM.PlayGenericSound(flipPageRight, ((Component)this).transform.position); if (isFlipping) { ((MonoBehaviour)this).StopAllCoroutines(); pages[currentPage].transform.localRotation = Quaternion.Euler(GetRotationalVector(startAngle)); } ((MonoBehaviour)this).StartCoroutine(FlipPage(pages[currentPage - 1], startAngle)); currentPage--; } } private void CloseBooklet() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!isClosing) { SM.PlayGenericSound(closeBooklet, ((Component)this).transform.position); if (isFlipping) { ((MonoBehaviour)this).StopAllCoroutines(); } ((MonoBehaviour)this).StartCoroutine(ClosingBooklet()); currentPage = 0; } } private IEnumerator FlipPage(GameObject page, float angle) { isFlipping = true; Vector3 rotationalVector = GetRotationalVector(angle); Quaternion targetRotation = Quaternion.Euler(rotationalVector); while (page.transform.localRotation != targetRotation) { page.transform.localRotation = Quaternion.RotateTowards(page.transform.localRotation, targetRotation, flipSpeed * Time.deltaTime); yield return null; } isFlipping = false; } private IEnumerator ClosingBooklet() { isClosing = true; for (int i = 0; i < pages.Length; i++) { ((MonoBehaviour)this).StartCoroutine(FlipPage(pages[i], startAngle)); yield return null; } isClosing = false; } private Vector3 GetRotationalVector(float angle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected I4, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Axis val = pageAxis; Vector3 result = default(Vector3); switch ((int)val) { case 0: ((Vector3)(ref result))..ctor(angle, 0f, 0f); break; case 1: ((Vector3)(ref result))..ctor(0f, angle, 0f); break; case 2: ((Vector3)(ref result))..ctor(0f, 0f, angle); break; default: result = default(Vector3); break; } return result; } }
plugins/ModifyWeaponCartrideAndMagazineAttachment.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ModifyWeaponCartrideAndMagazineAttachment")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ModifyWeaponCartrideAndMagazineAttachment")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("29f9d976-6df8-491e-a25c-f8f6a2191694")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class ModifyWeaponCartrideAndMagazineAttachment : MonoBehaviour { public FVRFireArmAttachment attachment; [Header("Caliber Modification")] public bool changesCaliber = true; [SearchableEnum] public FireArmRoundType roundType; [Header("MagazineType Modification")] public bool changesMagType = true; [SearchableEnum] public FireArmMagazineType magType; [Header("MagPos Calculation Modification")] [Header("Place Firearm and the new mag pos into these fields and use the context menu to calculate the position.")] public FVRFireArm temp_firearm; public Transform magMountPos; public Transform magEjectPos; [Header("Recoil Modification")] public bool changesRecoil = true; public FVRFireArmRecoilProfile recoilProfile; public FVRFireArmRecoilProfile recoilProfileStocked; public Vector3 relativeMagPos; public Quaternion relativeMagRot; public Vector3 relativeMagEjectPos; public Quaternion relativeMagEjectRot; private Vector3 origMagPos; private Quaternion origMagRot; private Vector3 origMagEjectPos; private Quaternion origMagEjectRot; private FVRFireArm fireArm; private FireArmRoundType origRoundType; private FireArmMagazineType origMagType; private FVRFireArmRecoilProfile origRecoilProfile; private FVRFireArmRecoilProfile origRecoilProfileStocked; public void Update() { //IL_0059: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00ac: 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_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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)attachment.curMount != (Object)null && (Object)(object)fireArm == (Object)null) { ref FVRFireArm reference = ref fireArm; FVRPhysicalObject myObject = attachment.curMount.GetRootMount().MyObject; reference = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); if (changesMagType) { origMagType = fireArm.MagazineType; if ((Object)(object)magMountPos != (Object)null) { origMagPos = fireArm.MagazineMountPos.localPosition; origMagRot = fireArm.MagazineMountPos.localRotation; origMagEjectPos = fireArm.MagazineEjectPos.localPosition; origMagEjectRot = fireArm.MagazineEjectPos.localRotation; fireArm.MagazineMountPos.localPosition = relativeMagPos; fireArm.MagazineMountPos.localRotation = relativeMagRot; fireArm.MagazineEjectPos.localPosition = relativeMagEjectPos; fireArm.MagazineEjectPos.localRotation = relativeMagEjectRot; } fireArm.MagazineType = magType; } if (changesCaliber) { origRoundType = fireArm.RoundType; fireArm.RoundType = roundType; FVRFireArm val = fireArm; ClosedBoltWeapon val2 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val2 == null) { OpenBoltReceiver val3 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val3 == null) { Handgun val4 = (Handgun)(object)((val is Handgun) ? val : null); if (val4 == null) { BoltActionRifle val5 = (BoltActionRifle)(object)((val is BoltActionRifle) ? val : null); if (val5 == null) { TubeFedShotgun val6 = (TubeFedShotgun)(object)((val is TubeFedShotgun) ? val : null); if (val6 != null) { val6.Chamber.RoundType = roundType; } else { Debug.LogWarning((object)"ModifyWeaponCartrideAndMagazineAttachment: FireArm type not supported!"); } } else { val5.Chamber.RoundType = roundType; } } else { val4.Chamber.RoundType = roundType; } } else { val3.Chamber.RoundType = roundType; } } else { val2.Chamber.RoundType = roundType; } } if (changesRecoil) { origRecoilProfile = fireArm.RecoilProfile; origRecoilProfileStocked = fireArm.RecoilProfileStocked; fireArm.RecoilProfile = recoilProfile; fireArm.RecoilProfileStocked = recoilProfileStocked; } } else { if (!((Object)(object)attachment.curMount == (Object)null) || !((Object)(object)fireArm != (Object)null)) { return; } if (changesMagType) { fireArm.MagazineType = origMagType; if ((Object)(object)magMountPos != (Object)null) { fireArm.MagazineMountPos.localPosition = origMagPos; fireArm.MagazineMountPos.localRotation = origMagRot; fireArm.MagazineEjectPos.localPosition = origMagEjectPos; fireArm.MagazineEjectPos.localRotation = origMagEjectRot; } } if (changesCaliber) { fireArm.RoundType = origRoundType; FVRFireArm val = fireArm; ClosedBoltWeapon val7 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val7 == null) { OpenBoltReceiver val8 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val8 == null) { Handgun val9 = (Handgun)(object)((val is Handgun) ? val : null); if (val9 == null) { BoltActionRifle val10 = (BoltActionRifle)(object)((val is BoltActionRifle) ? val : null); if (val10 == null) { TubeFedShotgun val11 = (TubeFedShotgun)(object)((val is TubeFedShotgun) ? val : null); if (val11 != null) { val11.Chamber.RoundType = origRoundType; } else { Debug.LogWarning((object)"ModifyWeaponCartrideAndMagazineAttachment: FireArm type not supported!"); } } else { val10.Chamber.RoundType = origRoundType; } } else { val9.Chamber.RoundType = origRoundType; } } else { val8.Chamber.RoundType = origRoundType; } } else { val7.Chamber.RoundType = origRoundType; } } if (changesRecoil) { fireArm.RecoilProfile = origRecoilProfile; fireArm.RecoilProfileStocked = origRecoilProfileStocked; } fireArm = null; } } [ContextMenu("Calculate relative magazine transforms")] public void CaluculateRelativeMagPos() { //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_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) relativeMagPos = ((Component)temp_firearm).transform.InverseTransformPoint(magMountPos.position); relativeMagRot = Quaternion.Inverse(((Component)temp_firearm).transform.rotation) * magMountPos.rotation; relativeMagEjectPos = ((Component)temp_firearm).transform.InverseTransformPoint(magEjectPos.position); relativeMagEjectRot = Quaternion.Inverse(((Component)temp_firearm).transform.rotation) * magEjectPos.rotation; } }
plugins/MountedGunControls.dll
Decompiled 10 months agousing 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("MountedGunControls")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MountedGunControls")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1875a600-3cc5-4f25-ab86-69ac79ac9fc6")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class AttachableGunControls_ClosedBolt : MonoBehaviour { public FVRInteractiveObject controlHandle; public ClosedBoltWeapon closedBoltWeapon; public FVRFireArmAttachment attachment; private FVRViveHand hand; private FVRAlternateGrip alternateGrip; public void Start() { Hook(); } public void OnDestroy() { Unhook(); } public void Update() { if ((Object)(object)hand != (Object)null) { closedBoltWeapon.UpdateInputAndAnimate(hand); } } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown ClosedBoltWeapon.UpdateInputAndAnimate += new hook_UpdateInputAndAnimate(ClosedBoltWeapon_UpdateInputAndAnimate); FVRFireArmMagazine.Release += new hook_Release(FVRFireArmMagazine_Release); AttachableForegrip.BeginInteraction += new hook_BeginInteraction(AttachableForegrip_BeginInteraction); FVRAlternateGrip.EndInteraction += new hook_EndInteraction(FVRAlternateGrip_EndInteraction); FVRFireArmAttachment.BeginInteraction += new hook_BeginInteraction(FVRFireArmAttachment_BeginInteraction); FVRFireArmAttachment.EndInteraction += new hook_EndInteraction(FVRFireArmAttachment_EndInteraction); FVRPhysicalObject.EndInteractionIntoInventorySlot += new hook_EndInteractionIntoInventorySlot(FVRPhysicalObject_EndInteractionIntoInventorySlot); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown ClosedBoltWeapon.UpdateInputAndAnimate -= new hook_UpdateInputAndAnimate(ClosedBoltWeapon_UpdateInputAndAnimate); FVRFireArmMagazine.Release -= new hook_Release(FVRFireArmMagazine_Release); AttachableForegrip.BeginInteraction -= new hook_BeginInteraction(AttachableForegrip_BeginInteraction); FVRAlternateGrip.EndInteraction -= new hook_EndInteraction(FVRAlternateGrip_EndInteraction); FVRFireArmAttachment.BeginInteraction -= new hook_BeginInteraction(FVRFireArmAttachment_BeginInteraction); FVRFireArmAttachment.EndInteraction -= new hook_EndInteraction(FVRFireArmAttachment_EndInteraction); FVRPhysicalObject.EndInteractionIntoInventorySlot -= new hook_EndInteractionIntoInventorySlot(FVRPhysicalObject_EndInteractionIntoInventorySlot); } private void ClosedBoltWeapon_UpdateInputAndAnimate(orig_UpdateInputAndAnimate orig, ClosedBoltWeapon self, FVRViveHand hand) { //IL_01b8: 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_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_011d: Invalid comparison between Unknown and I4 //IL_0371: 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_0327: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Invalid comparison between Unknown and I4 //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Invalid comparison between Unknown and I4 //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Invalid comparison between Unknown and I4 //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Invalid comparison between Unknown and I4 if ((Object)(object)self == (Object)(object)closedBoltWeapon) { self.IsBoltReleaseButtonHeld = false; self.IsBoltCatchButtonHeld = false; if ((Object)(object)hand != (Object)null) { self.m_triggerFloat = this.hand.Input.TriggerFloat; if (!self.m_hasTriggerReset && self.m_triggerFloat <= self.TriggerResetThreshold) { self.m_hasTriggerReset = true; if (self.FireSelector_Modes.Length != 0) { self.m_CamBurst = self.FireSelector_Modes[self.m_fireSelectorMode].BurstAmount; } ((FVRFireArm)self).PlayAudioEvent((FirearmAudioEventType)16, 1f); } if (this.hand.IsInStreamlinedMode) { if (this.hand.Input.BYButtonDown) { if (self.Bolt.IsBoltLocked() && self.HasBoltReleaseButton) { self.Bolt.ReleaseBolt(); } else { self.ToggleFireSelector(); } if (self.UsesStickyDetonation) { self.Detonate(); } } if (this.hand.Input.AXButtonDown && self.HasMagReleaseButton && (!self.EjectsMagazineOnEmpty || ((int)self.Bolt.CurPos >= 2 && ((FVRInteractiveObject)self.Bolt).IsHeld && !self.m_proxy.IsFull))) { self.ReleaseMag(); } if (self.UsesStickyDetonation) { if (this.hand.Input.BYButtonDown) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.y, (InterpStyle)1, (Axis)0); } else if (this.hand.Input.BYButtonUp) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.x, (InterpStyle)1, (Axis)0); } } } else { Vector2 touchpadAxes = this.hand.Input.TouchpadAxes; if (this.hand.Input.TouchpadDown) { if (self.UsesStickyDetonation) { self.Detonate(); } if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f) { if (Vector2.Angle(touchpadAxes, Vector2.left) <= 45f) { self.ToggleFireSelector(); } else if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f) { if (self.HasBoltReleaseButton) { self.Bolt.ReleaseBolt(); } } else if (Vector2.Angle(touchpadAxes, Vector2.right) <= 45f && self.HasMagReleaseButton && (!self.EjectsMagazineOnEmpty || ((int)self.Bolt.CurPos >= 2 && ((FVRInteractiveObject)self.Bolt).IsHeld && !self.m_proxy.IsFull))) { self.ReleaseMag(); } } } if (self.UsesStickyDetonation) { if (this.hand.Input.TouchpadDown) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.y, (InterpStyle)1, (Axis)0); } else if (this.hand.Input.TouchpadUp) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.x, (InterpStyle)1, (Axis)0); } } if (this.hand.Input.TouchpadPressed && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f) { if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f) { if (self.HasBoltReleaseButton) { self.IsBoltReleaseButtonHeld = true; } } else if (Vector2.Angle(touchpadAxes, Vector2.right) <= 45f && self.HasBoltCatchButton) { self.IsBoltCatchButtonHeld = true; } } } FireSelectorModeType modeType = self.FireSelector_Modes[self.m_fireSelectorMode].ModeType; if ((int)modeType == 0) { return; } if (self.UsesStickyDetonation) { if ((int)self.Bolt.CurPos != 0 || !self.Chamber.IsFull || self.Chamber.IsSpent) { return; } if (this.hand.Input.TriggerPressed && self.m_hasTriggerReset) { self.m_hasStickTriggerDown = true; self.m_stickyChargeUp += Time.deltaTime * 0.25f * self.StickyChargeUpSpeed; self.m_stickyChargeUp = Mathf.Clamp(self.m_stickyChargeUp, 0f, 1f); if (self.m_stickyChargeUp > 0.05f && !self.m_chargeSound.isPlaying) { self.m_chargeSound.Play(); } } else { if (self.m_chargeSound.isPlaying) { self.m_chargeSound.Stop(); } self.m_stickyChargeUp = 0f; } if (self.m_hasStickTriggerDown && (this.hand.Input.TriggerUp || self.m_stickyChargeUp >= 1f)) { self.m_hasStickTriggerDown = false; self.DropHammer(); self.EndStickyCharge(); } } else if (self.m_triggerFloat >= self.TriggerFiringThreshold && (int)self.Bolt.CurPos == 0 && (self.m_hasTriggerReset || ((int)modeType == 3 && !self.UsesDualStageFullAuto) || ((int)modeType == 3 && self.UsesDualStageFullAuto && self.m_triggerFloat > self.TriggerDualStageThreshold) || ((int)modeType == 2 && self.m_CamBurst > 0))) { self.DropHammer(); self.m_hasTriggerReset = false; if (self.m_CamBurst > 0) { self.m_CamBurst--; } } } else { self.m_triggerFloat = 0f; } } else { orig.Invoke(self, hand); } } private void FVRFireArmMagazine_Release(orig_Release orig, FVRFireArmMagazine self, bool PhysicalRelease) { //IL_0018: 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_00a8: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_016b: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self.FireArm == (Object)(object)closedBoltWeapon) { self.State = (MagazineState)0; ((FVRPhysicalObject)self).SetParentage((Transform)null); if (self.UsesVizInterp) { self.m_vizLerpStartPos = ((Component)self.Viz).transform.position; self.m_vizLerp = 0f; self.m_isVizLerpInward = false; self.m_isVizLerping = true; } if ((Object)(object)self.FireArm.MagazineEjectPos != (Object)null) { ((Component)self).transform.position = self.FireArm.GetMagEjectPos(self.IsBeltBox).position; } else { ((Component)self).transform.position = self.FireArm.GetMagMountPos(self.IsBeltBox).position; } if (self.UsesVizInterp) { self.Viz.position = self.m_vizLerpStartPos; self.m_vizLerpReferenceTransform = self.FireArm.GetMagMountPos(self.IsBeltBox); } ((FVRPhysicalObject)self).RecoverRigidbody(); ((FVRPhysicalObject)self).RootRigidbody.isKinematic = false; if ((Object)(object)((FVRInteractiveObject)self.FireArm).m_hand != (Object)null && !PhysicalRelease) { FVRViveHand otherHand = ((FVRInteractiveObject)self.FireArm).m_hand.OtherHand; if ((Object)(object)otherHand.CurrentInteractable == (Object)null && otherHand.Input.IsGrabbing) { Vector3 position = ((Component)otherHand).transform.position; if (GM.Options.ControlOptions.UseInvertedHandgunMagPose) { position = otherHand.GetMagPose().position; } Vector3 val = position - self.FireArm.GetMagMountPos(self.IsBeltBox).position; if (Vector3.Distance(((Component)self).transform.position, position) < 0.2f && Vector3.Angle(((Component)self).transform.up, val) > 90f) { otherHand.ForceSetInteractable((FVRInteractiveObject)(object)self); ((FVRInteractiveObject)self).BeginInteraction(otherHand); } } else if ((int)GM.Options.ControlOptions.MagPalming == 0 && self.GetCanPalm() && otherHand.Input.IsGrabbing && (Object)(object)otherHand.CurrentInteractable != (Object)null && otherHand.CurrentInteractable is FVRFireArmMagazine && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetCanPalm() && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagParent() == (Object)null && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagChild() == (Object)null && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).MagazineType == self.MagazineType && Vector3.Distance(((Component)otherHand.CurrentInteractable).transform.position, self.FireArm.GetMagMountPos(self.IsBeltBox).position) < 0.2f) { ? val2 = self; FVRInteractiveObject currentInteractable = otherHand.CurrentInteractable; ((FVRFireArmMagazine)val2).SetMagParent((FVRFireArmMagazine)(object)((currentInteractable is FVRFireArmMagazine) ? currentInteractable : null)); } } self.FireArm = null; ((FVRInteractiveObject)self).SetAllCollidersToLayer(false, "Default"); } else { orig.Invoke(self, PhysicalRelease); } } private void AttachableForegrip_BeginInteraction(orig_BeginInteraction orig, AttachableForegrip self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)controlHandle) { FVRFireArm val = self.OverrideFirearm; if ((Object)(object)val == (Object)null) { FVRPhysicalObject rootObject = ((FVRFireArmAttachmentInterface)self).Attachment.GetRootObject(); val = (FVRFireArm)(object)((rootObject is FVRFireArm) ? rootObject : null); } if ((Object)(object)val != (Object)null && (Object)(object)val.Foregrip != (Object)null) { FVRAlternateGrip component = val.Foregrip.GetComponent<FVRAlternateGrip>(); hand.ForceSetInteractable((FVRInteractiveObject)(object)component); component.BeginInteractionFromAttachedGrip(self, hand); this.hand = ((FVRInteractiveObject)component).m_hand; alternateGrip = component; } } else { orig.Invoke(self, hand); } } private void FVRAlternateGrip_EndInteraction(orig_EndInteraction orig, FVRAlternateGrip self, FVRViveHand hand) { if ((Object)(object)alternateGrip == (Object)(object)self) { this.hand = null; alternateGrip = null; } orig.Invoke(self, hand); } private void FVRFireArmAttachment_BeginInteraction(orig_BeginInteraction orig, FVRFireArmAttachment self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)attachment) { this.hand = hand; } orig.Invoke(self, hand); } private void FVRFireArmAttachment_EndInteraction(orig_EndInteraction orig, FVRFireArmAttachment self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)attachment) { this.hand = null; } orig.Invoke(self, hand); } private void FVRPhysicalObject_EndInteractionIntoInventorySlot(orig_EndInteractionIntoInventorySlot orig, FVRPhysicalObject self, FVRViveHand hand, FVRQuickBeltSlot slot) { if ((Object)(object)self == (Object)(object)attachment) { this.hand = null; } orig.Invoke(self, hand, slot); } } public class AttachableGunControls_OpenBolt : MonoBehaviour { public FVRInteractiveObject controlHandle; public OpenBoltReceiver openBoltWeapon; public FVRFireArmAttachment attachment; private FVRViveHand hand; private FVRAlternateGrip alternateGrip; public void Start() { Hook(); } public void OnDestroy() { Unhook(); } public void Update() { } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown OpenBoltReceiver.UpdateControls += new hook_UpdateControls(OpenBoltReceiver_UpdateControls); FVRFireArmMagazine.Release += new hook_Release(FVRFireArmMagazine_Release); AttachableForegrip.BeginInteraction += new hook_BeginInteraction(AttachableForegrip_BeginInteraction); FVRAlternateGrip.EndInteraction += new hook_EndInteraction(FVRAlternateGrip_EndInteraction); FVRFireArmAttachment.BeginInteraction += new hook_BeginInteraction(FVRFireArmAttachment_BeginInteraction); FVRFireArmAttachment.EndInteraction += new hook_EndInteraction(FVRFireArmAttachment_EndInteraction); FVRPhysicalObject.EndInteractionIntoInventorySlot += new hook_EndInteractionIntoInventorySlot(FVRPhysicalObject_EndInteractionIntoInventorySlot); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown OpenBoltReceiver.UpdateControls -= new hook_UpdateControls(OpenBoltReceiver_UpdateControls); FVRFireArmMagazine.Release -= new hook_Release(FVRFireArmMagazine_Release); AttachableForegrip.BeginInteraction -= new hook_BeginInteraction(AttachableForegrip_BeginInteraction); FVRAlternateGrip.EndInteraction -= new hook_EndInteraction(FVRAlternateGrip_EndInteraction); FVRFireArmAttachment.BeginInteraction -= new hook_BeginInteraction(FVRFireArmAttachment_BeginInteraction); FVRFireArmAttachment.EndInteraction -= new hook_EndInteraction(FVRFireArmAttachment_EndInteraction); FVRPhysicalObject.EndInteractionIntoInventorySlot -= new hook_EndInteractionIntoInventorySlot(FVRPhysicalObject_EndInteractionIntoInventorySlot); } private void OpenBoltReceiver_UpdateControls(orig_UpdateControls orig, OpenBoltReceiver self) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)openBoltWeapon) { if ((Object)(object)hand != (Object)null) { if (self.HasTriggerButton && (int)self.FireSelector_Modes[self.m_fireSelectorMode].ModeType != 0) { self.m_triggerFloat = hand.Input.TriggerFloat; } else { self.m_triggerFloat = 0f; } bool flag = false; if (self.Bolt.HasLastRoundBoltHoldOpen && (Object)(object)((FVRFireArm)self).Magazine != (Object)null && !((FVRFireArm)self).Magazine.HasARound() && !((FVRFireArm)self).Magazine.IsBeltBox) { flag = true; } if (!self.m_hasTriggerCycled) { if (self.m_triggerFloat >= self.TriggerFiringThreshold) { self.m_hasTriggerCycled = true; if (!flag) { self.ReleaseSeer(); } } } else if (self.m_triggerFloat <= self.TriggerResetThreshold && self.m_hasTriggerCycled) { self.EngageSeer(); self.m_hasTriggerCycled = false; ((FVRFireArm)self).PlayAudioEvent((FirearmAudioEventType)16, 1f); } if (((FVRPhysicalObject)self).IsAltHeld) { return; } if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && self.HasFireSelectorButton) { self.ToggleFireSelector(); } if (hand.Input.AXButtonDown && self.HasMagReleaseButton) { ((FVRFireArm)self).EjectMag(false); } } else if (hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.1f) { if (self.HasFireSelectorButton && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f) { self.ToggleFireSelector(); } else if (self.HasMagReleaseButton && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f) { ((FVRFireArm)self).EjectMag(false); } } } else { self.m_triggerFloat = 0f; } } else { orig.Invoke(self); } } private void FVRFireArmMagazine_Release(orig_Release orig, FVRFireArmMagazine self, bool PhysicalRelease) { //IL_0018: 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_00a8: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_016b: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self.FireArm == (Object)(object)openBoltWeapon) { self.State = (MagazineState)0; ((FVRPhysicalObject)self).SetParentage((Transform)null); if (self.UsesVizInterp) { self.m_vizLerpStartPos = ((Component)self.Viz).transform.position; self.m_vizLerp = 0f; self.m_isVizLerpInward = false; self.m_isVizLerping = true; } if ((Object)(object)self.FireArm.MagazineEjectPos != (Object)null) { ((Component)self).transform.position = self.FireArm.GetMagEjectPos(self.IsBeltBox).position; } else { ((Component)self).transform.position = self.FireArm.GetMagMountPos(self.IsBeltBox).position; } if (self.UsesVizInterp) { self.Viz.position = self.m_vizLerpStartPos; self.m_vizLerpReferenceTransform = self.FireArm.GetMagMountPos(self.IsBeltBox); } ((FVRPhysicalObject)self).RecoverRigidbody(); ((FVRPhysicalObject)self).RootRigidbody.isKinematic = false; if ((Object)(object)((FVRInteractiveObject)self.FireArm).m_hand != (Object)null && !PhysicalRelease) { FVRViveHand otherHand = ((FVRInteractiveObject)self.FireArm).m_hand.OtherHand; if ((Object)(object)otherHand.CurrentInteractable == (Object)null && otherHand.Input.IsGrabbing) { Vector3 position = ((Component)otherHand).transform.position; if (GM.Options.ControlOptions.UseInvertedHandgunMagPose) { position = otherHand.GetMagPose().position; } Vector3 val = position - self.FireArm.GetMagMountPos(self.IsBeltBox).position; if (Vector3.Distance(((Component)self).transform.position, position) < 0.2f && Vector3.Angle(((Component)self).transform.up, val) > 90f) { otherHand.ForceSetInteractable((FVRInteractiveObject)(object)self); ((FVRInteractiveObject)self).BeginInteraction(otherHand); } } else if ((int)GM.Options.ControlOptions.MagPalming == 0 && self.GetCanPalm() && otherHand.Input.IsGrabbing && (Object)(object)otherHand.CurrentInteractable != (Object)null && otherHand.CurrentInteractable is FVRFireArmMagazine && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetCanPalm() && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagParent() == (Object)null && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagChild() == (Object)null && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).MagazineType == self.MagazineType && Vector3.Distance(((Component)otherHand.CurrentInteractable).transform.position, self.FireArm.GetMagMountPos(self.IsBeltBox).position) < 0.2f) { ? val2 = self; FVRInteractiveObject currentInteractable = otherHand.CurrentInteractable; ((FVRFireArmMagazine)val2).SetMagParent((FVRFireArmMagazine)(object)((currentInteractable is FVRFireArmMagazine) ? currentInteractable : null)); } } self.FireArm = null; ((FVRInteractiveObject)self).SetAllCollidersToLayer(false, "Default"); } else { orig.Invoke(self, PhysicalRelease); } } private void AttachableForegrip_BeginInteraction(orig_BeginInteraction orig, AttachableForegrip self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)controlHandle) { FVRFireArm val = self.OverrideFirearm; if ((Object)(object)val == (Object)null) { FVRPhysicalObject rootObject = ((FVRFireArmAttachmentInterface)self).Attachment.GetRootObject(); val = (FVRFireArm)(object)((rootObject is FVRFireArm) ? rootObject : null); } if ((Object)(object)val != (Object)null && (Object)(object)val.Foregrip != (Object)null) { FVRAlternateGrip component = val.Foregrip.GetComponent<FVRAlternateGrip>(); hand.ForceSetInteractable((FVRInteractiveObject)(object)component); component.BeginInteractionFromAttachedGrip(self, hand); this.hand = ((FVRInteractiveObject)component).m_hand; alternateGrip = component; } } else { orig.Invoke(self, hand); } } private void FVRAlternateGrip_EndInteraction(orig_EndInteraction orig, FVRAlternateGrip self, FVRViveHand hand) { if ((Object)(object)alternateGrip == (Object)(object)self) { this.hand = null; alternateGrip = null; } orig.Invoke(self, hand); } private void FVRFireArmAttachment_BeginInteraction(orig_BeginInteraction orig, FVRFireArmAttachment self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)attachment) { this.hand = hand; } orig.Invoke(self, hand); } private void FVRFireArmAttachment_EndInteraction(orig_EndInteraction orig, FVRFireArmAttachment self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)attachment) { this.hand = null; } orig.Invoke(self, hand); } private void FVRPhysicalObject_EndInteractionIntoInventorySlot(orig_EndInteractionIntoInventorySlot orig, FVRPhysicalObject self, FVRViveHand hand, FVRQuickBeltSlot slot) { if ((Object)(object)self == (Object)(object)attachment) { this.hand = null; } orig.Invoke(self, hand, slot); } } public class MountedGunControls_ClosedBolt : MonoBehaviour { public wwGatlingControlHandle controlHandle; public ClosedBoltWeapon closedBoltWeapon; private FVRPhysicalObject mount; private bool hooked; private FVRViveHand hand; public void Start() { Hook(); mount = ((Component)controlHandle.BaseFrame).gameObject.GetComponent<FVRPhysicalObject>(); } public void OnDestroy() { Unhook(); } public void Update() { if ((Object)(object)hand != (Object)(object)((FVRInteractiveObject)controlHandle).m_hand) { hand = ((FVRInteractiveObject)controlHandle).m_hand; } if ((Object)(object)hand != (Object)null && !hooked) { ((FVRInteractiveObject)closedBoltWeapon).m_hand = hand; ((FVRInteractiveObject)closedBoltWeapon).m_hasTriggeredUpSinceBegin = true; hooked = true; } else if ((Object)(object)hand == (Object)null && hooked) { ((FVRInteractiveObject)closedBoltWeapon).m_hand = hand; ((FVRInteractiveObject)closedBoltWeapon).m_hasTriggeredUpSinceBegin = false; hooked = false; } if ((Object)(object)hand != (Object)null) { closedBoltWeapon.UpdateInputAndAnimate(hand); } } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ClosedBoltWeapon.UpdateInputAndAnimate += new hook_UpdateInputAndAnimate(ClosedBoltWeapon_UpdateInputAndAnimate); FVRFireArmMagazine.Release += new hook_Release(FVRFireArmMagazine_Release); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ClosedBoltWeapon.UpdateInputAndAnimate -= new hook_UpdateInputAndAnimate(ClosedBoltWeapon_UpdateInputAndAnimate); FVRFireArmMagazine.Release -= new hook_Release(FVRFireArmMagazine_Release); } private void ClosedBoltWeapon_UpdateInputAndAnimate(orig_UpdateInputAndAnimate orig, ClosedBoltWeapon self, FVRViveHand hand) { //IL_01b8: 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_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_011d: Invalid comparison between Unknown and I4 //IL_0371: 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_0327: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Invalid comparison between Unknown and I4 //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Invalid comparison between Unknown and I4 //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Invalid comparison between Unknown and I4 //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Invalid comparison between Unknown and I4 if ((Object)(object)self == (Object)(object)closedBoltWeapon) { self.IsBoltReleaseButtonHeld = false; self.IsBoltCatchButtonHeld = false; if ((Object)(object)hand != (Object)null) { self.m_triggerFloat = this.hand.Input.TriggerFloat; if (!self.m_hasTriggerReset && self.m_triggerFloat <= self.TriggerResetThreshold) { self.m_hasTriggerReset = true; if (self.FireSelector_Modes.Length != 0) { self.m_CamBurst = self.FireSelector_Modes[self.m_fireSelectorMode].BurstAmount; } ((FVRFireArm)self).PlayAudioEvent((FirearmAudioEventType)16, 1f); } if (this.hand.IsInStreamlinedMode) { if (this.hand.Input.BYButtonDown) { if (self.Bolt.IsBoltLocked() && self.HasBoltReleaseButton) { self.Bolt.ReleaseBolt(); } else { self.ToggleFireSelector(); } if (self.UsesStickyDetonation) { self.Detonate(); } } if (this.hand.Input.AXButtonDown && self.HasMagReleaseButton && (!self.EjectsMagazineOnEmpty || ((int)self.Bolt.CurPos >= 2 && ((FVRInteractiveObject)self.Bolt).IsHeld && !self.m_proxy.IsFull))) { self.ReleaseMag(); } if (self.UsesStickyDetonation) { if (this.hand.Input.BYButtonDown) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.y, (InterpStyle)1, (Axis)0); } else if (this.hand.Input.BYButtonUp) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.x, (InterpStyle)1, (Axis)0); } } } else { Vector2 touchpadAxes = this.hand.Input.TouchpadAxes; if (this.hand.Input.TouchpadDown) { if (self.UsesStickyDetonation) { self.Detonate(); } if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f) { if (Vector2.Angle(touchpadAxes, Vector2.left) <= 45f) { self.ToggleFireSelector(); } else if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f) { if (self.HasBoltReleaseButton) { self.Bolt.ReleaseBolt(); } } else if (Vector2.Angle(touchpadAxes, Vector2.right) <= 45f && self.HasMagReleaseButton && (!self.EjectsMagazineOnEmpty || ((int)self.Bolt.CurPos >= 2 && ((FVRInteractiveObject)self.Bolt).IsHeld && !self.m_proxy.IsFull))) { self.ReleaseMag(); } } } if (self.UsesStickyDetonation) { if (this.hand.Input.TouchpadDown) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.y, (InterpStyle)1, (Axis)0); } else if (this.hand.Input.TouchpadUp) { ((FVRPhysicalObject)self).SetAnimatedComponent(self.StickyTrigger, self.StickyRotRange.x, (InterpStyle)1, (Axis)0); } } if (this.hand.Input.TouchpadPressed && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f) { if (Vector2.Angle(touchpadAxes, Vector2.up) <= 45f) { if (self.HasBoltReleaseButton) { self.IsBoltReleaseButtonHeld = true; } } else if (Vector2.Angle(touchpadAxes, Vector2.right) <= 45f && self.HasBoltCatchButton) { self.IsBoltCatchButtonHeld = true; } } } FireSelectorModeType modeType = self.FireSelector_Modes[self.m_fireSelectorMode].ModeType; if ((int)modeType == 0) { return; } if (self.UsesStickyDetonation) { if ((int)self.Bolt.CurPos != 0 || !self.Chamber.IsFull || self.Chamber.IsSpent) { return; } if (this.hand.Input.TriggerPressed && self.m_hasTriggerReset) { self.m_hasStickTriggerDown = true; self.m_stickyChargeUp += Time.deltaTime * 0.25f * self.StickyChargeUpSpeed; self.m_stickyChargeUp = Mathf.Clamp(self.m_stickyChargeUp, 0f, 1f); if (self.m_stickyChargeUp > 0.05f && !self.m_chargeSound.isPlaying) { self.m_chargeSound.Play(); } } else { if (self.m_chargeSound.isPlaying) { self.m_chargeSound.Stop(); } self.m_stickyChargeUp = 0f; } if (self.m_hasStickTriggerDown && (this.hand.Input.TriggerUp || self.m_stickyChargeUp >= 1f)) { self.m_hasStickTriggerDown = false; self.DropHammer(); self.EndStickyCharge(); } } else if (self.m_triggerFloat >= self.TriggerFiringThreshold && (int)self.Bolt.CurPos == 0 && (self.m_hasTriggerReset || ((int)modeType == 3 && !self.UsesDualStageFullAuto) || ((int)modeType == 3 && self.UsesDualStageFullAuto && self.m_triggerFloat > self.TriggerDualStageThreshold) || ((int)modeType == 2 && self.m_CamBurst > 0))) { self.DropHammer(); self.m_hasTriggerReset = false; if (self.m_CamBurst > 0) { self.m_CamBurst--; } } } else { self.m_triggerFloat = 0f; } } else { orig.Invoke(self, hand); } } private void FVRFireArmMagazine_Release(orig_Release orig, FVRFireArmMagazine self, bool PhysicalRelease) { //IL_0018: 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_00a8: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_016b: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self.FireArm == (Object)(object)closedBoltWeapon) { self.State = (MagazineState)0; ((FVRPhysicalObject)self).SetParentage((Transform)null); if (self.UsesVizInterp) { self.m_vizLerpStartPos = ((Component)self.Viz).transform.position; self.m_vizLerp = 0f; self.m_isVizLerpInward = false; self.m_isVizLerping = true; } if ((Object)(object)self.FireArm.MagazineEjectPos != (Object)null) { ((Component)self).transform.position = self.FireArm.GetMagEjectPos(self.IsBeltBox).position; } else { ((Component)self).transform.position = self.FireArm.GetMagMountPos(self.IsBeltBox).position; } if (self.UsesVizInterp) { self.Viz.position = self.m_vizLerpStartPos; self.m_vizLerpReferenceTransform = self.FireArm.GetMagMountPos(self.IsBeltBox); } ((FVRPhysicalObject)self).RecoverRigidbody(); ((FVRPhysicalObject)self).RootRigidbody.isKinematic = false; if ((Object)(object)((FVRInteractiveObject)self.FireArm).m_hand != (Object)null && !PhysicalRelease) { FVRViveHand otherHand = ((FVRInteractiveObject)self.FireArm).m_hand.OtherHand; if ((Object)(object)otherHand.CurrentInteractable == (Object)null && otherHand.Input.IsGrabbing) { Vector3 position = ((Component)otherHand).transform.position; if (GM.Options.ControlOptions.UseInvertedHandgunMagPose) { position = otherHand.GetMagPose().position; } Vector3 val = position - self.FireArm.GetMagMountPos(self.IsBeltBox).position; if (Vector3.Distance(((Component)self).transform.position, position) < 0.2f && Vector3.Angle(((Component)self).transform.up, val) > 90f) { otherHand.ForceSetInteractable((FVRInteractiveObject)(object)self); ((FVRInteractiveObject)self).BeginInteraction(otherHand); } } else if ((int)GM.Options.ControlOptions.MagPalming == 0 && self.GetCanPalm() && otherHand.Input.IsGrabbing && (Object)(object)otherHand.CurrentInteractable != (Object)null && otherHand.CurrentInteractable is FVRFireArmMagazine && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetCanPalm() && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagParent() == (Object)null && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagChild() == (Object)null && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).MagazineType == self.MagazineType && Vector3.Distance(((Component)otherHand.CurrentInteractable).transform.position, self.FireArm.GetMagMountPos(self.IsBeltBox).position) < 0.2f) { ? val2 = self; FVRInteractiveObject currentInteractable = otherHand.CurrentInteractable; ((FVRFireArmMagazine)val2).SetMagParent((FVRFireArmMagazine)(object)((currentInteractable is FVRFireArmMagazine) ? currentInteractable : null)); } } self.FireArm = null; ((FVRInteractiveObject)self).SetAllCollidersToLayer(false, "Default"); } else { orig.Invoke(self, PhysicalRelease); } } } public class MountedGunControls : MonoBehaviour { public wwGatlingControlHandle controlHandle; public OpenBoltReceiver openBoltWeapon; private FVRPhysicalObject mount; private bool hooked; private FVRViveHand hand; public void Start() { Hook(); mount = ((Component)controlHandle.BaseFrame).gameObject.GetComponent<FVRPhysicalObject>(); } public void OnDestroy() { Unhook(); } public void Update() { if ((Object)(object)hand != (Object)(object)((FVRInteractiveObject)controlHandle).m_hand) { hand = ((FVRInteractiveObject)controlHandle).m_hand; } if ((Object)(object)hand != (Object)null && !hooked) { ((FVRInteractiveObject)openBoltWeapon).m_hand = hand; ((FVRInteractiveObject)openBoltWeapon).m_hasTriggeredUpSinceBegin = true; hooked = true; } else if ((Object)(object)hand == (Object)null && hooked) { ((FVRInteractiveObject)openBoltWeapon).m_hand = hand; ((FVRInteractiveObject)openBoltWeapon).m_hasTriggeredUpSinceBegin = false; hooked = false; } } private void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown OpenBoltReceiver.UpdateControls += new hook_UpdateControls(OpenBoltReceiver_UpdateControls); FVRFireArmMagazine.Release += new hook_Release(FVRFireArmMagazine_Release); } private void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown OpenBoltReceiver.UpdateControls -= new hook_UpdateControls(OpenBoltReceiver_UpdateControls); FVRFireArmMagazine.Release -= new hook_Release(FVRFireArmMagazine_Release); } private void OpenBoltReceiver_UpdateControls(orig_UpdateControls orig, OpenBoltReceiver self) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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) if ((Object)(object)self == (Object)(object)openBoltWeapon) { if (((FVRInteractiveObject)controlHandle).IsHeld) { if (self.HasTriggerButton && ((FVRInteractiveObject)self).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)self).IsAltHeld && (int)self.FireSelector_Modes[self.m_fireSelectorMode].ModeType != 0) { self.m_triggerFloat = ((FVRInteractiveObject)controlHandle).m_hand.Input.TriggerFloat; } else { self.m_triggerFloat = 0f; } bool flag = false; if (self.Bolt.HasLastRoundBoltHoldOpen && (Object)(object)((FVRFireArm)self).Magazine != (Object)null && !((FVRFireArm)self).Magazine.HasARound() && !((FVRFireArm)self).Magazine.IsBeltBox) { flag = true; } if (!self.m_hasTriggerCycled) { if (self.m_triggerFloat >= self.TriggerFiringThreshold) { self.m_hasTriggerCycled = true; if (!flag) { self.ReleaseSeer(); } } } else if (self.m_triggerFloat <= self.TriggerResetThreshold && self.m_hasTriggerCycled) { self.EngageSeer(); self.m_hasTriggerCycled = false; ((FVRFireArm)self).PlayAudioEvent((FirearmAudioEventType)16, 1f); } if (((FVRPhysicalObject)self).IsAltHeld) { return; } if (((FVRInteractiveObject)controlHandle).m_hand.IsInStreamlinedMode) { if (((FVRInteractiveObject)controlHandle).m_hand.Input.BYButtonDown && self.HasFireSelectorButton) { self.ToggleFireSelector(); } if (((FVRInteractiveObject)controlHandle).m_hand.Input.AXButtonDown && self.HasMagReleaseButton) { ((FVRFireArm)self).EjectMag(false); } } else if (((FVRInteractiveObject)controlHandle).m_hand.Input.TouchpadDown && ((Vector2)(ref ((FVRInteractiveObject)controlHandle).m_hand.Input.TouchpadAxes)).magnitude > 0.1f) { if (self.HasFireSelectorButton && Vector2.Angle(((FVRInteractiveObject)controlHandle).m_hand.Input.TouchpadAxes, Vector2.left) <= 45f) { self.ToggleFireSelector(); } else if (self.HasMagReleaseButton && Vector2.Angle(((FVRInteractiveObject)controlHandle).m_hand.Input.TouchpadAxes, Vector2.down) <= 45f) { ((FVRFireArm)self).EjectMag(false); } } } else { self.m_triggerFloat = 0f; } } else { orig.Invoke(self); } } private void FVRFireArmMagazine_Release(orig_Release orig, FVRFireArmMagazine self, bool PhysicalRelease) { //IL_0018: 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_00a8: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_016b: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self.FireArm == (Object)(object)openBoltWeapon) { self.State = (MagazineState)0; ((FVRPhysicalObject)self).SetParentage((Transform)null); if (self.UsesVizInterp) { self.m_vizLerpStartPos = ((Component)self.Viz).transform.position; self.m_vizLerp = 0f; self.m_isVizLerpInward = false; self.m_isVizLerping = true; } if ((Object)(object)self.FireArm.MagazineEjectPos != (Object)null) { ((Component)self).transform.position = self.FireArm.GetMagEjectPos(self.IsBeltBox).position; } else { ((Component)self).transform.position = self.FireArm.GetMagMountPos(self.IsBeltBox).position; } if (self.UsesVizInterp) { self.Viz.position = self.m_vizLerpStartPos; self.m_vizLerpReferenceTransform = self.FireArm.GetMagMountPos(self.IsBeltBox); } ((FVRPhysicalObject)self).RecoverRigidbody(); ((FVRPhysicalObject)self).RootRigidbody.isKinematic = false; if ((Object)(object)((FVRInteractiveObject)self.FireArm).m_hand != (Object)null && !PhysicalRelease) { FVRViveHand otherHand = ((FVRInteractiveObject)self.FireArm).m_hand.OtherHand; if ((Object)(object)otherHand.CurrentInteractable == (Object)null && otherHand.Input.IsGrabbing) { Vector3 position = ((Component)otherHand).transform.position; if (GM.Options.ControlOptions.UseInvertedHandgunMagPose) { position = otherHand.GetMagPose().position; } Vector3 val = position - self.FireArm.GetMagMountPos(self.IsBeltBox).position; if (Vector3.Distance(((Component)self).transform.position, position) < 0.2f && Vector3.Angle(((Component)self).transform.up, val) > 90f) { otherHand.ForceSetInteractable((FVRInteractiveObject)(object)self); ((FVRInteractiveObject)self).BeginInteraction(otherHand); } } else if ((int)GM.Options.ControlOptions.MagPalming == 0 && self.GetCanPalm() && otherHand.Input.IsGrabbing && (Object)(object)otherHand.CurrentInteractable != (Object)null && otherHand.CurrentInteractable is FVRFireArmMagazine && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetCanPalm() && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagParent() == (Object)null && (Object)(object)((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).GetMagChild() == (Object)null && ((FVRFireArmMagazine)/*isinst with value type is only supported in some contexts*/).MagazineType == self.MagazineType && Vector3.Distance(((Component)otherHand.CurrentInteractable).transform.position, self.FireArm.GetMagMountPos(self.IsBeltBox).position) < 0.2f) { ? val2 = self; FVRInteractiveObject currentInteractable = otherHand.CurrentInteractable; ((FVRFireArmMagazine)val2).SetMagParent((FVRFireArmMagazine)(object)((currentInteractable is FVRFireArmMagazine) ? currentInteractable : null)); } } self.FireArm = null; ((FVRInteractiveObject)self).SetAllCollidersToLayer(false, "Default"); } else { orig.Invoke(self, PhysicalRelease); } } }
plugins/MovableWeaponPart.dll
Decompiled 10 months agousing 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 Popcron; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MovableWeaponPart")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MovableWeaponPart")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4a5974ab-1c14-440c-a764-fd2e309d79b7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class BreakOpenTrigger : MonoBehaviour { public FVRPhysicalObject physicalObject; [Header("Break Parts")] public HingeJoint Hinge; public float HingeLimit = 45f; public float HingeEjectThreshhold = 30f; public Transform centerOfMassOverride; [Header("LatchGeo (leave at default if no visible latch)")] public float maxLatchRot = 45f; [Tooltip("If latch is below this angle the fore will latch. Latch rot dependend on how far up you press on touchpad (like break action shotgun)")] public float latchLatchingRot = 5f; public bool hasLatchObject; public Transform Latch; [Header("Objects that turn off or on dependend on break state")] public GameObject[] TurnOffObjectsOnOpen; public GameObject[] TurnOnObjectsOnOpen; public bool doesEjectMag; public float MagEjectSpeed = 5f; [Header("Audio")] public AudioEvent BreakOpenAudio; public AudioEvent BreakCloseAudio; private float m_latchRot; private Vector3 m_foreStartPos; private bool m_isLatched = true; private bool m_latchHeldOpen; private bool m_hasEjectedMag; public void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) m_foreStartPos = ((Component)Hinge).transform.localPosition; if ((Object)(object)centerOfMassOverride != (Object)null) { ((Component)Hinge).GetComponent<Rigidbody>().centerOfMass = centerOfMassOverride.localPosition; } SetBreakObjectsState(active: false); } public void Start() { Hook(); } public void OnDestroy() { Unhook(); } public void FixedUpdate() { UpdateBreakFore(); } public void Update() { FVRViveHand hand = ((FVRInteractiveObject)physicalObject).m_hand; if ((Object)(object)hand != (Object)null) { UpdateInputAndAnimate(hand); } else { m_latchHeldOpen = false; } } private void UpdateInputAndAnimate(FVRViveHand hand) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) m_latchHeldOpen = false; if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonPressed) { m_latchHeldOpen = true; m_latchRot = 1f * maxLatchRot; } else { m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * maxLatchRot * 3f); } } else if (hand.Input.TouchpadPressed && hand.Input.TouchpadAxes.y > 0.1f) { m_latchHeldOpen = true; m_latchRot = hand.Input.TouchpadAxes.y * maxLatchRot; } else { m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * maxLatchRot * 3f); } if (hasLatchObject) { Latch.localEulerAngles = new Vector3(0f, m_latchRot, 0f); } } private void UpdateBreakFore() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (m_isLatched && Mathf.Abs(m_latchRot) > 5f) { m_isLatched = false; SM.PlayGenericSound(BreakOpenAudio, ((Component)physicalObject).transform.position); JointLimits limits = Hinge.limits; ((JointLimits)(ref limits)).max = HingeLimit; Hinge.limits = limits; SetBreakObjectsState(active: true); } if (!m_isLatched) { if (!m_latchHeldOpen && ((Component)Hinge).transform.localEulerAngles.x <= 1f && Mathf.Abs(m_latchRot) < latchLatchingRot) { m_isLatched = true; SM.PlayGenericSound(BreakCloseAudio, ((Component)physicalObject).transform.position); JointLimits limits2 = Hinge.limits; ((JointLimits)(ref limits2)).max = 0f; Hinge.limits = limits2; SetBreakObjectsState(active: false); ((Component)Hinge).transform.localPosition = m_foreStartPos; m_hasEjectedMag = false; } if (doesEjectMag && Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x) >= HingeEjectThreshhold && Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x) <= HingeLimit) { TryEjectMag(); } } } private void TryEjectMag() { if (!m_hasEjectedMag) { EjectMag(); m_hasEjectedMag = true; } } public void EjectMag(bool PhysicalRelease = false) { //IL_00ac: 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) FVRPhysicalObject obj = physicalObject; FVRFireArm val = (FVRFireArm)(object)((obj is FVRFireArm) ? obj : null); if ((Object)(object)val.Magazine != (Object)null) { if (val.Magazine.UsesOverrideInOut) { val.PlayAudioEventHandling(val.Magazine.ProfileOverride.MagazineOut); } else { val.PlayAudioEvent((FirearmAudioEventType)21, 1f); } val.m_lastEjectedMag = val.Magazine; val.m_ejectDelay = 0.4f; if ((Object)(object)((FVRInteractiveObject)val).m_hand != (Object)null) { ((FVRInteractiveObject)val).m_hand.Buzz(((FVRInteractiveObject)val).m_hand.Buzzer.Buzz_BeginInteraction); } val.Magazine.Release(PhysicalRelease); ((FVRPhysicalObject)val.Magazine).RootRigidbody.velocity = -val.MagazineEjectPos.up * MagEjectSpeed; if ((Object)(object)((FVRInteractiveObject)val.Magazine).m_hand != (Object)null) { ((FVRInteractiveObject)val.Magazine).m_hand.Buzz(((FVRInteractiveObject)val).m_hand.Buzzer.Buzz_BeginInteraction); } val.Magazine = null; } } private void SetBreakObjectsState(bool active) { GameObject[] turnOnObjectsOnOpen = TurnOnObjectsOnOpen; foreach (GameObject val in turnOnObjectsOnOpen) { if ((Object)(object)val != (Object)null) { val.SetActive(active); } } turnOnObjectsOnOpen = TurnOffObjectsOnOpen; foreach (GameObject val2 in turnOnObjectsOnOpen) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(!active); } } } private void Unhook() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown FVRPhysicalObject val = physicalObject; if (!(val is ClosedBoltWeapon)) { if (!(val is OpenBoltReceiver)) { if (!(val is Handgun)) { if (val is TubeFedShotgun) { TubeFedShotgun.ReleaseHammer -= new hook_ReleaseHammer(TubeFedShotgun_ReleaseHammer); } } else { Handgun.ReleaseSeer += new hook_ReleaseSeer(Handgun_ReleaseSeer); } } else { OpenBoltReceiver.ReleaseSeer += new hook_ReleaseSeer(OpenBoltReceiver_ReleaseSeer); } } else { ClosedBoltWeapon.DropHammer += new hook_DropHammer(ClosedBoltWeapon_DropHammer); } } private void Hook() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown FVRPhysicalObject val = physicalObject; if (!(val is ClosedBoltWeapon)) { if (!(val is OpenBoltReceiver)) { if (!(val is Handgun)) { if (val is TubeFedShotgun) { TubeFedShotgun.ReleaseHammer += new hook_ReleaseHammer(TubeFedShotgun_ReleaseHammer); } } else { Handgun.ReleaseSeer += new hook_ReleaseSeer(Handgun_ReleaseSeer); } } else { OpenBoltReceiver.ReleaseSeer += new hook_ReleaseSeer(OpenBoltReceiver_ReleaseSeer); } } else { ClosedBoltWeapon.DropHammer += new hook_DropHammer(ClosedBoltWeapon_DropHammer); } } private void TubeFedShotgun_ReleaseHammer(orig_ReleaseHammer orig, TubeFedShotgun self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } private void Handgun_ReleaseSeer(orig_ReleaseSeer orig, Handgun self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } private void OpenBoltReceiver_ReleaseSeer(orig_ReleaseSeer orig, OpenBoltReceiver self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } private void ClosedBoltWeapon_DropHammer(orig_DropHammer orig, ClosedBoltWeapon self) { if (!((Object)(object)self == (Object)(object)physicalObject) || (m_isLatched && !m_latchHeldOpen)) { orig.Invoke(self); } } } public class HingeForegrip : FVRAlternateGrip { public Transform ObjectBase; public HingeJoint Hinge; private Vector3 localPosStart; private Rigidbody RB; private FVRPhysicalObject physObj; public override void Awake() { //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) ((FVRAlternateGrip)this).Awake(); localPosStart = ((Component)Hinge).transform.localPosition; RB = ((Component)Hinge).gameObject.GetComponent<Rigidbody>(); physObj = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent<FVRPhysicalObject>(); } public override void FVRUpdate() { //IL_0011: 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_0034: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f) { ((Component)Hinge).transform.localPosition = localPosStart; } } public override void FVRFixedUpdate() { ((FVRInteractiveObject)this).FVRFixedUpdate(); if (((FVRInteractiveObject)physObj).IsHeld && physObj.IsAltHeld) { RB.mass = 0.001f; } else { RB.mass = 0.1f; } } public override bool IsInteractable() { return true; } public override void UpdateInteraction(FVRViveHand hand) { //IL_000d: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0061: 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_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_008a: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) ((FVRAlternateGrip)this).UpdateInteraction(hand); Vector3 val = Vector3.ProjectOnPlane(((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position, ObjectBase.right); if (Vector3.Angle(val, -ObjectBase.up) > 90f) { val = ObjectBase.forward; } if (Vector3.Angle(val, ObjectBase.forward) > 90f) { val = -ObjectBase.up; } float num = Vector3.Angle(val, ObjectBase.forward); JointSpring spring = Hinge.spring; spring.spring = 10f; spring.damper = 0f; JointLimits limits = Hinge.limits; spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max); Hinge.spring = spring; ((Component)Hinge).transform.localPosition = localPosStart; } public override void EndInteraction(FVRViveHand hand) { //IL_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_0036: Unknown result type (might be due to invalid IL or missing references) JointSpring spring = Hinge.spring; spring.spring = 0.5f; spring.damper = 0.05f; spring.targetPosition = 45f; Hinge.spring = spring; ((FVRAlternateGrip)this).EndInteraction(hand); } } public class MovableWeaponPartMk2 : FVRInteractiveObject { public enum Mode { Translation, Rotation, Folding } public enum Axis { X, Y, Z } private enum State { Open, Mid, Closed } public Mode MovementMode; public Axis MovementAxis; public Transform StationaryRoot; public Transform ObjectToMove; public float LowerLimit; public float UpperLimit; public float LimitWiggleRoom = 0.02f; public AudioEvent CloseSound; public AudioEvent OpenSound; private State _curState; private State _lastState; private float _curPos; private Vector3 _origPos; private Quaternion _origRot; private Vector3 _startingHandPos; private Quaternion _startingHandRot; private Quaternion _lastHandRot; public bool DebugMode; public override void Start() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Start(); _origPos = ObjectToMove.localPosition; _origRot = ObjectToMove.localRotation; switch (MovementMode) { case Mode.Translation: switch (MovementAxis) { case Axis.X: _curPos = _origPos.x; break; case Axis.Y: _curPos = _origPos.y; break; case Axis.Z: _curPos = _origPos.z; break; } break; case Mode.Rotation: switch (MovementAxis) { case Axis.X: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.x; break; case Axis.Y: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.y; break; case Axis.Z: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.z; break; } break; case Mode.Folding: switch (MovementAxis) { case Axis.X: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.x; break; case Axis.Y: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.y; break; case Axis.Z: _curPos = ((Quaternion)(ref _origRot)).eulerAngles.z; break; } break; } if (MovementMode == Mode.Rotation || MovementMode == Mode.Folding) { if (UpperLimit >= 180f) { UpperLimit = 180f; } if (LowerLimit <= -180f) { LowerLimit = -180f; } } } public override void BeginInteraction(FVRViveHand hand) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((FVRInteractiveObject)this).BeginInteraction(hand); _startingHandPos = ((Component)hand).transform.position; _startingHandRot = ((Component)hand).transform.rotation; _lastHandRot = ((Component)hand).transform.rotation; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); switch (MovementMode) { case Mode.Translation: TranslationMode(hand); break; case Mode.Rotation: RotationMode(hand); break; case Mode.Folding: FoldingMode(hand); break; } _lastHandRot = ((Component)hand).transform.rotation; } public void TranslationMode(FVRViveHand hand) { //IL_002f: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_013f: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) switch (MovementAxis) { case Axis.X: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(LowerLimit, 0f, 0f), new Vector3(UpperLimit, 0f, 0f), StationaryRoot.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); _curPos = closestValidPoint.x; ObjectToMove.localPosition = new Vector3(_curPos, _origPos.y, _origPos.z); break; } case Axis.Y: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, LowerLimit, 0f), new Vector3(0f, UpperLimit, 0f), StationaryRoot.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); _curPos = closestValidPoint.y; ObjectToMove.localPosition = new Vector3(_origPos.x, _curPos, _origPos.z); break; } case Axis.Z: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, 0f, LowerLimit), new Vector3(0f, 0f, UpperLimit), StationaryRoot.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); _curPos = closestValidPoint.z; ObjectToMove.localPosition = new Vector3(_origPos.x, _origPos.y, _curPos); break; } } float lerp = Mathf.InverseLerp(LowerLimit, UpperLimit, _curPos); CheckSound(lerp); } public void RotationMode(FVRViveHand hand) { //IL_0006: 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_0011: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0141: 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_0149: 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_016d: 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_0180: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: 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_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) Quaternion val = ((Component)hand).transform.rotation * Quaternion.Inverse(_lastHandRot); float num = default(float); Vector3 val2 = default(Vector3); ((Quaternion)(ref val)).ToAngleAxis(ref num, ref val2); if (((Vector3)(ref val2)).magnitude == 0f || num == 0f) { return; } if (num >= 180f) { num -= 180f; } else if (num <= -180f) { num += 180f; } val2 = StationaryRoot.InverseTransformDirection(val2); float num2 = ((Vector3)(ref val2))[(int)MovementAxis]; if (DebugMode) { Gizmos.Line(((Component)ObjectToMove).transform.position, ((Component)ObjectToMove).transform.position + val2 * 0.1f * num, (Color?)Color.magenta, false); } float num3 = num2 * num; if (Mathf.Abs(num3) > 90f) { Debug.Log((object)("DeltaAngle: " + num3)); } if (num3 > 0f) { switch (MovementAxis) { case Axis.X: { Quaternion val3 = Quaternion.Euler(new Vector3(UpperLimit, 0f, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val3, num3); break; } case Axis.Y: { Quaternion val3 = Quaternion.Euler(new Vector3(0f, UpperLimit, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val3, num3); break; } case Axis.Z: { Quaternion val3 = Quaternion.Euler(new Vector3(0f, 0f, UpperLimit)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val3, num3); break; } } } else { switch (MovementAxis) { case Axis.X: { Quaternion val4 = Quaternion.Euler(new Vector3(LowerLimit, 0f, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val4, num3); break; } case Axis.Y: { Quaternion val4 = Quaternion.Euler(new Vector3(0f, LowerLimit, 0f)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val4, num3); break; } case Axis.Z: { Quaternion val4 = Quaternion.Euler(new Vector3(0f, 0f, LowerLimit)); ObjectToMove.localRotation = Quaternion.RotateTowards(ObjectToMove.localRotation, val4, num3); break; } } } if (DebugMode) { Gizmos.Line(((Component)hand).transform.position, ((Component)hand).transform.position + ((Component)hand).transform.forward * 0.1f, (Color?)Color.blue, false); Gizmos.Line(((Component)hand).transform.position, ((Component)hand).transform.position + ((Component)hand).transform.up * 0.1f, (Color?)Color.green, false); Gizmos.Line(((Component)hand).transform.position, ((Component)hand).transform.position + ((Component)hand).transform.right * 0.1f, (Color?)Color.red, false); } _curPos += num3; if (Mathf.Abs(_curPos - UpperLimit) <= LimitWiggleRoom) { _curPos = UpperLimit; switch (MovementAxis) { case Axis.X: Quaternion.Euler(UpperLimit, 0f, 0f); break; case Axis.Y: Quaternion.Euler(0f, UpperLimit, 0f); break; case Axis.Z: Quaternion.Euler(0f, 0f, UpperLimit); break; default: _ = Quaternion.identity; break; } } else if (Mathf.Abs(_curPos - LowerLimit) <= LimitWiggleRoom) { _curPos = LowerLimit; switch (MovementAxis) { case Axis.X: Quaternion.Euler(LowerLimit, 0f, 0f); break; case Axis.Y: Quaternion.Euler(0f, LowerLimit, 0f); break; case Axis.Z: Quaternion.Euler(0f, 0f, LowerLimit); break; default: _ = Quaternion.identity; break; } } float lerp = Mathf.InverseLerp(LowerLimit, UpperLimit, _curPos); CheckSound(lerp); } private void FoldingMode(FVRViveHand hand) { //IL_0001: 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_0011: 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_0019: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007a: 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_0085: 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_00ac: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00e9: 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_010d: 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_0113: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_016a: 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_0175: Unknown result type (might be due to invalid IL or missing references) //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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((FVRInteractiveObject)this).m_handPos - StationaryRoot.position; Vector3 val2 = default(Vector3); Vector3 val3; switch (MovementAxis) { case Axis.X: val2 = -((Component)StationaryRoot).transform.forward; val3 = Vector3.ProjectOnPlane(val, StationaryRoot.right); val = ((Vector3)(ref val3)).normalized; _curPos = Mathf.Atan2(Vector3.Dot(StationaryRoot.right, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Axis.Y: val2 = -((Component)StationaryRoot).transform.forward; val3 = Vector3.ProjectOnPlane(val, StationaryRoot.up); val = ((Vector3)(ref val3)).normalized; _curPos = Mathf.Atan2(Vector3.Dot(StationaryRoot.up, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Axis.Z: val2 = ((Component)StationaryRoot).transform.up; val3 = Vector3.ProjectOnPlane(val, StationaryRoot.forward); val = ((Vector3)(ref val3)).normalized; _curPos = Mathf.Atan2(Vector3.Dot(StationaryRoot.forward, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; } if (DebugMode) { Gizmos.Line(StationaryRoot.position, ((FVRInteractiveObject)this).m_handPos, (Color?)Color.magenta, false); Gizmos.Line(StationaryRoot.position, val2, (Color?)Color.green, false); Gizmos.Line(StationaryRoot.position, val, (Color?)Color.red, false); Gizmos.Line(StationaryRoot.position, Vector3.Cross(val2, val), (Color?)Color.blue, false); } if (Mathf.Abs(_curPos - LowerLimit) < 5f) { _curPos = LowerLimit; } if (Mathf.Abs(_curPos - UpperLimit) < 5f) { _curPos = UpperLimit; } if (_curPos >= LowerLimit && _curPos <= UpperLimit) { switch (MovementAxis) { case Axis.X: ObjectToMove.localEulerAngles = new Vector3(_curPos, 0f, 0f); break; case Axis.Y: ObjectToMove.localEulerAngles = new Vector3(0f, _curPos, 0f); break; case Axis.Z: ObjectToMove.localEulerAngles = new Vector3(0f, 0f, _curPos); break; } float lerp = Mathf.InverseLerp(LowerLimit, UpperLimit, _curPos); CheckSound(lerp); } } private void CheckSound(float lerp) { //IL_004d: 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) if (lerp < LimitWiggleRoom) { _curState = State.Open; } else if (lerp > 1f - LimitWiggleRoom) { _curState = State.Closed; } else { _curState = State.Mid; } if (_curState == State.Open && _lastState != 0) { SM.PlayGenericSound(OpenSound, StationaryRoot.position); } if (_curState == State.Closed && _lastState != State.Closed) { SM.PlayGenericSound(CloseSound, StationaryRoot.position); } _lastState = _curState; } public Vector3 ProjectOnPlaneThroughPoint(Vector3 vector, Vector3 point, Vector3 planeNormal) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return Vector3.ProjectOnPlane(vector, planeNormal) + Vector3.Dot(point, planeNormal) * planeNormal; } } public class MovableWeaponPart : FVRInteractiveObject { public enum Mode { Translation, Rotation, Tilt } public enum Direction { X, Y, Z } private enum State { Open, Mid, Closed } public Mode mode; public Direction direction; public Transform root; public Transform objectToMove; public float lowerLimit; public float upperLimit; public float limitWiggleRoom = 0.02f; public AudioSource audioSource; public AudioClip closeSound; public AudioClip openSound; private State state; private State last_state; private float pos; private Vector3 orig_pos; private Vector3 lastHandPlane; private bool debug; public override void Start() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Start(); orig_pos = objectToMove.localPosition; } public override void BeginInteraction(FVRViveHand hand) { //IL_002d: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0086: 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) ((FVRInteractiveObject)this).BeginInteraction(hand); switch (direction) { case Direction.X: lastHandPlane = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, root.right); break; case Direction.Y: lastHandPlane = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, root.forward); break; case Direction.Z: lastHandPlane = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.forward, -root.up); break; } } public override void UpdateInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).UpdateInteraction(hand); switch (mode) { case Mode.Translation: TranslationMode(hand); break; case Mode.Rotation: RotationMode(hand); break; case Mode.Tilt: TiltMode(hand); break; } } public void TranslationMode(FVRViveHand hand) { //IL_002f: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_013f: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) switch (direction) { case Direction.X: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(lowerLimit, 0f, 0f), new Vector3(upperLimit, 0f, 0f), root.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); pos = closestValidPoint.x; objectToMove.localPosition = new Vector3(pos, orig_pos.y, orig_pos.z); break; } case Direction.Y: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, lowerLimit, 0f), new Vector3(0f, upperLimit, 0f), root.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); pos = closestValidPoint.y; objectToMove.localPosition = new Vector3(orig_pos.x, pos, orig_pos.z); break; } case Direction.Z: { Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(new Vector3(0f, 0f, lowerLimit), new Vector3(0f, 0f, upperLimit), root.InverseTransformPoint(((FVRInteractiveObject)this).m_handPos)); pos = closestValidPoint.z; objectToMove.localPosition = new Vector3(orig_pos.x, orig_pos.y, pos); break; } } if ((Object)(object)audioSource != (Object)null) { float lerp = Mathf.InverseLerp(lowerLimit, upperLimit, pos); CheckSound(lerp); } } public void RotationMode(FVRViveHand hand) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_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_0113: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0174: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //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_0198: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) Vector3 val; switch (direction) { case Direction.X: { val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, -((Component)this).transform.right); Vector3 val2 = Vector3.ProjectOnPlane(lastHandPlane, -((Component)this).transform.right); pos = Mathf.Atan2(Vector3.Dot(-((Component)this).transform.right, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f; objectToMove.localEulerAngles = new Vector3(pos, 0f, 0f); break; } case Direction.Y: { val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.forward, ((Component)this).transform.up); Vector3 val2 = Vector3.ProjectOnPlane(lastHandPlane, -((Component)this).transform.up); pos = Mathf.Atan2(Vector3.Dot(-((Component)this).transform.up, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f; objectToMove.localEulerAngles = new Vector3(0f, pos, 0f); break; } case Direction.Z: { val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, -((Component)this).transform.forward); Vector3 val2 = Vector3.ProjectOnPlane(lastHandPlane, -((Component)this).transform.forward); pos = Mathf.Atan2(Vector3.Dot(-((Component)this).transform.forward, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f; objectToMove.localEulerAngles = new Vector3(0f, 0f, pos); break; } default: val = Vector3.ProjectOnPlane(((Component)base.m_hand).transform.up, -((Component)this).transform.right); break; } lastHandPlane = val; if ((Object)(object)audioSource != (Object)null) { float lerp = Mathf.InverseLerp(lowerLimit, upperLimit, pos); CheckSound(lerp); } } private void TiltMode(FVRViveHand hand) { //IL_0001: 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_0011: 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_0019: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007a: 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_0085: 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_00ac: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00e9: 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_010d: 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_0113: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_016a: 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_0175: Unknown result type (might be due to invalid IL or missing references) //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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((FVRInteractiveObject)this).m_handPos - root.position; Vector3 val2 = default(Vector3); Vector3 val3; switch (direction) { case Direction.X: val2 = -((Component)root).transform.forward; val3 = Vector3.ProjectOnPlane(val, root.right); val = ((Vector3)(ref val3)).normalized; pos = Mathf.Atan2(Vector3.Dot(root.right, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Direction.Y: val2 = -((Component)root).transform.forward; val3 = Vector3.ProjectOnPlane(val, root.up); val = ((Vector3)(ref val3)).normalized; pos = Mathf.Atan2(Vector3.Dot(root.up, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; case Direction.Z: val2 = ((Component)root).transform.up; val3 = Vector3.ProjectOnPlane(val, root.forward); val = ((Vector3)(ref val3)).normalized; pos = Mathf.Atan2(Vector3.Dot(root.forward, Vector3.Cross(val2, val)), Vector3.Dot(val2, val)) * 57.29578f; break; } if (debug) { Gizmos.Line(root.position, ((FVRInteractiveObject)this).m_handPos, (Color?)Color.magenta, false); Gizmos.Line(root.position, val2, (Color?)Color.green, false); Gizmos.Line(root.position, val, (Color?)Color.red, false); Gizmos.Line(root.position, Vector3.Cross(val2, val), (Color?)Color.blue, false); } if (Mathf.Abs(pos - lowerLimit) < 5f) { pos = lowerLimit; } if (Mathf.Abs(pos - upperLimit) < 5f) { pos = upperLimit; } if (pos >= lowerLimit && pos <= upperLimit) { switch (direction) { case Direction.X: objectToMove.localEulerAngles = new Vector3(pos, 0f, 0f); break; case Direction.Y: objectToMove.localEulerAngles = new Vector3(0f, pos, 0f); break; case Direction.Z: objectToMove.localEulerAngles = new Vector3(0f, 0f, pos); break; } if ((Object)(object)audioSource != (Object)null) { float lerp = Mathf.InverseLerp(lowerLimit, upperLimit, pos); CheckSound(lerp); } } } private void CheckSound(float lerp) { if (lerp < limitWiggleRoom) { state = State.Open; } else if (lerp > 1f - limitWiggleRoom) { state = State.Closed; } else { state = State.Mid; } if (state == State.Open && last_state != 0) { audioSource.PlayOneShot(openSound); } if (state == State.Closed && last_state != State.Closed) { audioSource.PlayOneShot(closeSound); } last_state = state; } }
plugins/MultipleHideOnAttach.dll
Decompiled 10 months agousing 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 OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MutlipleHideOnAttach")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MutlipleHideOnAttach")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("cb0554a6-a9d8-4a5a-ab65-71f7218e0fcc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class MultipleHideOnAttach_forAttachments : MonoBehaviour { [Header("Attachment to monitor for attachments:")] public FVRFireArmAttachment attachment; [Header("List of GameObjects to affect:")] public List<GameObject> objectToHideOrShow; [Header("Enable to show Objects instead:")] public bool showOnAttach; public void Awake() { ((Component)this).gameObject.SetActive(false); MultipleHideOnAttachForAttachments obj = ((Component)this).gameObject.AddComponent<MultipleHideOnAttachForAttachments>(); obj.Attachment = attachment; obj.ShowOnAttach = showOnAttach; obj.ObjectToHideOrShow = objectToHideOrShow; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class MultipleHideOnAttach : MonoBehaviour { [Header("Mount to monitor for attachments:")] public FVRFireArmAttachmentMount attachmentMount; [Header("List of GameObjects to affect:")] public List<GameObject> objectToHideOrShow; [Header("Enable to show Objects instead:")] public bool showOnAttach; public void Awake() { ((Component)this).gameObject.SetActive(false); MultipleHideOnAttach obj = ((Component)this).gameObject.AddComponent<MultipleHideOnAttach>(); obj.attachmentMount = attachmentMount; obj.ShowOnAttach = showOnAttach; obj.ObjectToHideOrShow = objectToHideOrShow; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/OpenBoltBurst.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("OpenBoltBurst")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OpenBoltBurst")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8dc20e67-19eb-48f3-8f94-277ee8d85800")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace H3VRUtils { [Obsolete("Use vanilla open bolt burst selector setting instead")] public class OpenBoltBurstFire : MonoBehaviour { public OpenBoltReceiver Receiver; [Tooltip("Selector setting position that will be burst. Remember, selectors go pos: 0, 1 ,2, not 1, 2, 3")] public int SelectorSetting; public int BurstAmt = 1; private int BurstSoFar; private bool wasLoaded; public void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2; } public void Update() { if ((Object)(object)((FVRInteractiveObject)Receiver).m_hand == (Object)null) { return; } if (Receiver.m_fireSelectorMode != SelectorSetting) { BurstSoFar = 0; return; } if (wasLoaded && !Receiver.Chamber.IsFull) { BurstSoFar++; } wasLoaded = Receiver.Chamber.IsFull; if (BurstSoFar >= BurstAmt) { lockUp(); if (((FVRInteractiveObject)Receiver).m_hand.Input.TriggerFloat < Receiver.TriggerFiringThreshold) { unLock(); } } if (((FVRInteractiveObject)Receiver).m_hand.Input.TriggerFloat < Receiver.TriggerFiringThreshold) { BurstSoFar = 0; } } public void lockUp() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)0; } public void unLock() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) BurstSoFar = 0; Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2; } } } namespace Cityrobo { public class FireModeAttachment : MonoBehaviour { public FVRFireArmAttachment attachment; public FireSelectorModeType[] FireSelectorModeTypes; public int[] burstAmounts; public bool addsSelectorPositions; public float[] selectorPositions; private bool attached; private FVRFireArm firearm; private FireSelectorMode[] originalHandgunFireModes; private FireSelectorMode[] originalClosedBoltFireModes; private FireSelectorMode[] originalOpenBoltFireModes; private bool handgunHadFireSelectorButton; public void Awake() { ((Component)this).gameObject.SetActive(false); FireModeAttachment obj = ((Component)this).gameObject.AddComponent<FireModeAttachment>(); obj.Attachment = attachment; obj.FireSelectorModeTypes = FireSelectorModeTypes; obj.BurstAmounts = burstAmounts; obj.ReplacesExistingFireSelectorModes = !addsSelectorPositions; obj.SelectorPositions = selectorPositions; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } }
plugins/OpenScripts.dll
Decompiled 10 months agousing 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 FistVR; using Microsoft.CodeAnalysis; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("OpenScripts")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OpenScripts")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5dcd3beb-162c-4492-ba08-fd5832e28e5e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Cityrobo { public class AttachmentMountPicatinnyRail : MonoBehaviour { public FVRFireArmAttachmentMount Mount; public int NumberOfPicatinnySlots; [Tooltip("Sound generated while moving attachment between slots.")] public AudioEvent SlotSound; [HideInInspector] public static Dictionary<FVRFireArmAttachment, AttachmentPicatinnyRailForwardStop> ExistingForwardStops = new Dictionary<FVRFireArmAttachment, AttachmentPicatinnyRailForwardStop>(); private static Dictionary<FVRFireArmAttachmentMount, AttachmentMountPicatinnyRail> _exisingAttachmentMountPicatinnyRail = new Dictionary<FVRFireArmAttachmentMount, AttachmentMountPicatinnyRail>(); private FVRFireArmAttachment _currentlyPatchedAttachment; private bool _isPatched; private float _slotLerpFactor; private static IntPtr _methodPointer; private int _lastPosIndex = -1; public void Start() { ((MonoBehaviour)this).StartCoroutine(ReplaceScript()); } private IEnumerator ReplaceScript() { yield return null; AttachmentMountPicatinnyRail component = ((Component)this).GetComponent<AttachmentMountPicatinnyRail>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } yield return null; ((Component)this).gameObject.SetActive(false); component = ((Component)this).gameObject.AddComponent<AttachmentMountPicatinnyRail>(); component.Mount = Mount; component.NumberOfPicatinnySlots = NumberOfPicatinnySlots; component.SlotSound = SlotSound; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class AttachmentPicatinnyRailForwardStop : MonoBehaviour { public FVRFireArmAttachment Attachment; public void Start() { ((Component)this).gameObject.SetActive(false); ((Component)this).gameObject.AddComponent<AttachmentPicatinnyRailForwardStop>().Attachment = Attachment; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } public void OnDestroy() { } } public class FirearmHeatingEffect_FirearmCore : MonoBehaviour { public FVRFireArm FireArm; public float CombinedHeatMultiplier = 1f; public List<FirearmHeatingEffect> FirearmHeatingEffects = new List<FirearmHeatingEffect>(); private int _lastListCount; private float _origBoltForwardSpeed; private float _origBoltRearwardSpeed; private float _origBoltSpringStiffness; private float _averageBoltForwardSpeedMultiplier; private float _averageBoltRearwardSpeedMultiplier; private float _averageBoltSpringStiffnessMultiplier; public void Awake() { FireArm = ((Component)this).GetComponent<FVRFireArm>(); FVRFireArm fireArm = FireArm; ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null); if (val == null) { OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null); if (val2 == null) { Handgun val3 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null); if (val3 != null) { _origBoltForwardSpeed = val3.Slide.Speed_Forward; _origBoltRearwardSpeed = val3.Slide.Speed_Rearward; _origBoltSpringStiffness = val3.Slide.SpringStiffness; } } else { _origBoltForwardSpeed = val2.Bolt.BoltSpeed_Forward; _origBoltRearwardSpeed = val2.Bolt.BoltSpeed_Rearward; _origBoltSpringStiffness = val2.Bolt.BoltSpringStiffness; } } else { _origBoltForwardSpeed = val.Bolt.Speed_Forward; _origBoltRearwardSpeed = val.Bolt.Speed_Rearward; _origBoltSpringStiffness = val.Bolt.SpringStiffness; } } public void OnDestroy() { } public void Update() { if (!((Object)(object)FireArm != (Object)null)) { return; } if (_lastListCount != FirearmHeatingEffects.Count) { CombinedHeatMultiplier = 1f; foreach (FirearmHeatingEffect firearmHeatingEffect in FirearmHeatingEffects) { CombinedHeatMultiplier *= firearmHeatingEffect.HeatMultiplier; } _lastListCount = FirearmHeatingEffects.Count; } _averageBoltForwardSpeedMultiplier = 0f; _averageBoltRearwardSpeedMultiplier = 0f; _averageBoltSpringStiffnessMultiplier = 0f; int num = 0; foreach (FirearmHeatingEffect firearmHeatingEffect2 in FirearmHeatingEffects) { if (firearmHeatingEffect2.DoesHeatAffectBoltSpeed) { _averageBoltForwardSpeedMultiplier += firearmHeatingEffect2.CurrentBoltForwardSpeedMultiplier; _averageBoltRearwardSpeedMultiplier += firearmHeatingEffect2.CurrentBoltRearwardSpeedMultiplier; _averageBoltSpringStiffnessMultiplier += firearmHeatingEffect2.CurrentBoltSpringMultiplier; num++; } } if (OpenScripts_BepInEx.FirearmHeatingEffect_CanChangeFirerate.Value && num != 0) { _averageBoltForwardSpeedMultiplier /= num; _averageBoltRearwardSpeedMultiplier /= num; _averageBoltSpringStiffnessMultiplier /= num; FVRFireArm fireArm = FireArm; ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null); if (val == null) { OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null); if (val2 == null) { Handgun val3 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null); if (val3 != null) { val3.Slide.Speed_Forward = _averageBoltForwardSpeedMultiplier * _origBoltForwardSpeed; val3.Slide.Speed_Rearward = _averageBoltRearwardSpeedMultiplier * _origBoltRearwardSpeed; val3.Slide.SpringStiffness = _averageBoltSpringStiffnessMultiplier * _origBoltSpringStiffness; } } else { val2.Bolt.BoltSpeed_Forward = _averageBoltForwardSpeedMultiplier * _origBoltForwardSpeed; val2.Bolt.BoltSpeed_Rearward = _averageBoltRearwardSpeedMultiplier * _origBoltRearwardSpeed; val2.Bolt.BoltSpringStiffness = _averageBoltSpringStiffnessMultiplier * _origBoltSpringStiffness; } } else { val.Bolt.Speed_Forward = _averageBoltForwardSpeedMultiplier * _origBoltForwardSpeed; val.Bolt.Speed_Rearward = _averageBoltRearwardSpeedMultiplier * _origBoltRearwardSpeed; val.Bolt.SpringStiffness = _averageBoltSpringStiffnessMultiplier * _origBoltSpringStiffness; } } else { _averageBoltForwardSpeedMultiplier = 1f; _averageBoltRearwardSpeedMultiplier = 1f; _averageBoltSpringStiffnessMultiplier = 1f; } } } public class FirearmHeatingEffect : MonoBehaviour { [Header("Firearm Heating Effect")] [Tooltip("Use this if you plan to use the script on a firearm.")] public FVRFireArm FireArm; [Tooltip("Use this if you plan to use the script on an attachment.")] public FVRFireArmAttachment Attachment; [Header("Heat Config")] [Tooltip("Heat added to the effect per shot fired. Heat caps out at 1.")] public float HeatPerShot = 0.01f; [Tooltip("Heat removed per second.")] public float CooldownRate = 0.01f; [Tooltip("This multiplier will affect the heat gain of all parts of the gun. It will act multiplicatively with other such multipliers.")] public float HeatMultiplier = 1f; [Tooltip("Adds a separate Multiplier for Round power. (None, Tiny, Pistol, Shotgun, Intermediate, FullPower, AntiMaterial, Ordnance, Exotic, Fire)")] public bool ChangesWithCartridgePower; [Tooltip("None, Tiny, Pistol, Shotgun, Intermediate, FullPower, AntiMaterial, Ordnance, Exotic, Fire")] public float[] RoundPowerMultipliers = new float[10] { 0f, 0.25f, 0.5f, 0.75f, 1f, 2f, 4f, 4f, 1f, 8f }; [Header("Emission modification config")] public MeshRenderer MeshRenderer; [Tooltip("Index of the material in the MeshRenderer's materials list.")] public int MaterialIndex; [Tooltip("Anton uses the squared value of the heat to determine the emission weight. If you wanna replicate that behavior, leave the value as is, but feel free to go crazy if you wanna mix things up.")] public float HeatExponent = 2f; public bool HeatAffectsEmissionWeight = true; public bool HeatAffectsEmissionScrollSpeed; [Tooltip("Maximum left/right emission scroll speed.")] public float MaxEmissionScrollSpeed_X; [Tooltip("Maximum up/down emission scroll speed.")] public float MaxEmissionScrollSpeed_Y; [Tooltip("Enables emission weight AnimationCurve system.")] public bool EmissionUsesAdvancedCurve; [Tooltip("Advanced emission weight control. Values from 0 to 1 only!")] public AnimationCurve EmissionCurve; [Tooltip("Advanced left/right emission scroll speed control. The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-Axis) represents the actual scroll speed and is uncapped. The max value set above is ignored.")] public AnimationCurve EmissionScrollSpeedCurve_X; [Tooltip("Advanced up/down emission scroll speed control. The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-Axis) represents the actual scroll speed and is uncapped. The max value set above is ignored.")] public AnimationCurve EmissionScrollSpeedCurve_Y; [Header("Detail weight config")] public bool HeatAffectsDetailWeight = true; [Tooltip("Same as the normal HeatExponent, but for the detail weight.")] public float DetailExponent = 2f; [Tooltip("Enables emission weight AnimationCurve system.")] public bool DetailUsesAdvancedCurve; [Tooltip("Advanced emission weight control. Values from 0 to 1 only!")] public AnimationCurve DetailCurve; [Header("Particle effects config")] public ParticleSystem ParticleSystem; public float MaxEmissionRate; [Tooltip("Same as the normal HeatExponent, but for the particle emission rate.")] public float ParticleHeatExponent = 2f; [Tooltip("Heat level at which particles start appearing.")] public float ParticleHeatThreshold; [Tooltip("If checked, the particle emission rate starts at 0 when hitting the threshold and hits the max when heat is 1, else it starts emitting using the threshold heat value as a reference, aka the heat level it gets enabled at.")] public bool ParticleEmissionRateStartsAtZero; [Tooltip("Enables particle rate AnimationCurve system.")] public bool ParticlesUsesAdvancedCurve; [Tooltip("Advanced particle rate control. Values from 0 to 1 only! The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-axis) acts like a multiplier of the max emission rate, clamped between 0 and 1.")] public AnimationCurve ParticlesCurve; [Header("Sound effects config")] public AudioClip SoundEffect; [Tooltip("Place a preconfigured AudioSource in here. (Configuring AudioSources at runtime is a pain! This lets you much easier choose the desired settings as well.)")] public AudioSource SoundEffectSource; [Tooltip("Same as the normal HeatExponent, but for the sound volume.")] public float SoundHeatExponent = 2f; public float MaxVolume = 0.4f; [Tooltip("Heat level at which audio starts.")] public float SoundHeatThreshold; [Tooltip("If checked, the sound volume starts at 0 when hitting the threshold and hits the max when heat is 1, else the volume is using the threshold heat value as a reference, aka the heat level it gets enabled at.")] public bool SoundVolumeStartsAtZero; [Tooltip("Enables sound volume AnimationCurve system.")] public bool SoundUsesAdvancedCurve; [Tooltip("Advanced sound volume control. Values from 0 to 1 only!. The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-axis) is the volume at that heat level.")] public AnimationCurve VolumeCurve; [Header("Accuracy Settings")] public bool DoesHeatAffectAccuracy; public float MaximumMOAMultiplier = 15f; [Tooltip("Same as the normal HeatExponent, but for the MOA multiplier.")] public float AccuracyHeatExponent = 2f; [Tooltip("Enables MOA multiplier AnimationCurve system.")] public bool AccuracyUsesAdvancedCurve; [Tooltip("Advanced MOA multiplier control. Values from 0 to 1 only!. The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-axis) acts like a multiplier of the max MOA multiplier, clamped between 0 and 1.")] public AnimationCurve AccuracyCurve; [Header("Bolt Speed Settings")] public bool DoesHeatAffectBoltSpeed; public float MaxBoltForwardSpeedMultiplier = 0.8f; public float MaxBoltRearwardSpeedMultiplier = 0.8f; public float MaxBoltSpringStiffnessesMultiplier = 0.8f; [Tooltip("Same as the normal HeatExponent, but for the bolt speed system.")] public float BoltSpeedHeatExponent = 2f; [Tooltip("Enables bolt speed AnimationCurve system.")] public bool BoltSpeedUsesAdvancedCurve; [Tooltip("Advanced bolt speed control. Values from 0 to 1 only!. The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-axis) acts as an advanced lerp for the above set maximum values.")] public AnimationCurve BoltForwardSpeedMultiplierCurve; [Tooltip("Advanced bolt speed control. Values from 0 to 1 only!. The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-axis) acts as an advanced lerp for the above set maximum values.")] public AnimationCurve BoltRearwardSpeedMultiplierCurve; [Tooltip("Advanced bolt speed control. Values from 0 to 1 only!. The X-axis is clamped between 0 and 1 and represents the heat level. The value (Y-axis) acts as an advanced lerp for the above set maximum values.")] public AnimationCurve BoltSpringStiffnessMultiplierCurve; [Header("Explosion System")] public MeshRenderer ExplodingPart; [Tooltip("Heat level at which part explodes. Don't use a value of 1. It is very unlikely the part will actually hit a perfect 1 heat.")] public float ExplodingHeatThreshhold = 0.95f; public bool MessesUpAccuracy = true; [Tooltip("Choose a high enough number for your accuracy class.")] public float FailureAccuracyMultiplier = 1000f; [Tooltip("Causes bolt rearwards speed to become a positive number, therefor the firearm won't cycle correctly")] public bool CausesStoppage = true; [Tooltip("Just some random high negative number to offset the averaging affect of the different FirearmHeatingEffect components and invert the bolt speed.")] public float StoppageSpeed = -1000f; public AudioEvent ExplosionSound; [Tooltip("DEBUG VALUE for in editor testing! Actual value determined by in game config. Can Explosion revert?")] public bool CanRecoverFromExplosion = true; [Tooltip("DEBUG VALUE for in editor testing! Actual value determined by in game config. Heat level at which explosion will be reverted.")] public float RevertHeatThreshold; [Header("Cookoff System")] [Tooltip("Cookoff is a random heat caused discharge, aka YOUR GUN GO BOOM without you pulling the trigger. Scary stuff.")] public bool DoesHeatCauseCookoff; [Tooltip("Chance of a cookoff to happen every second.")] public float MaxCookoffChancePerSecond = 0.5f; [Tooltip("Same as the normal HeatExponent, but for the bolt speed system.")] public float CookoffHeatExponent = 2f; [Tooltip("Heat level at which cookoff starts happening.")] public float CookoffHeatThreshold; [Tooltip("If checked, the cookoff chance starts at 0 when hitting the threshold and hits the max when heat is 1, else the chance is using the threshold heat value as a reference, aka the heat level it gets enabled at.")] public bool CookoffChanceStartsAtZero = true; [Header("Debug Messages")] public bool DebugEnabled; [Range(0f, 1f)] public float Heat; [HideInInspector] public float CurrentBoltForwardSpeedMultiplier; [HideInInspector] public float CurrentBoltRearwardSpeedMultiplier; [HideInInspector] public float CurrentBoltSpringMultiplier; private FirearmHeatingEffect_FirearmCore Core; private Material _copyMaterial; private Material _copyExplodedMaterial; private bool _isAttached; private bool _soundEnabled; private bool _canExplode = true; private bool _hasPartExploded; private bool _canChangeAccuracy = true; private bool _canCookOff = true; private float _origInternalMechanicalMOA; private const string c_EmissionWeightPropertyString = "_EmissionWeight"; private const string c_IncandescenceScrollSpeedPropertyString = "_IncandescenceMapVelocity"; private const string c_DetailWeightPropertyString = "_DetailWeight"; public void Awake() { Hook(); _canExplode = OpenScripts_BepInEx.FirearmHeatingEffect_CanExplode.Value; _canChangeAccuracy = OpenScripts_BepInEx.FirearmHeatingEffect_CanChangeAccuracy.Value; _canCookOff = OpenScripts_BepInEx.FirearmHeatingEffect_CanCookOff.Value; CanRecoverFromExplosion = OpenScripts_BepInEx.FirearmHeatingEffect_CanRecover.Value; RevertHeatThreshold = OpenScripts_BepInEx.FirearmHeatingEffect_RecoverThreshold.Value; if ((Object)(object)FireArm != (Object)null) { _origInternalMechanicalMOA = FireArm.m_internalMechanicalMOA; Core = ((Component)FireArm).GetComponent<FirearmHeatingEffect_FirearmCore>(); if ((Object)(object)Core == (Object)null) { Core = ((Component)FireArm).gameObject.AddComponent<FirearmHeatingEffect_FirearmCore>(); } Core.FirearmHeatingEffects.Add(this); } else if ((Object)(object)Attachment != (Object)null) { FVRFireArmAttachment attachment = Attachment; MuzzleDevice val = (MuzzleDevice)(object)((attachment is MuzzleDevice) ? attachment : null); if (val != null) { _origInternalMechanicalMOA = val.m_mechanicalAccuracy; } } if ((Object)(object)MeshRenderer != (Object)null) { _copyMaterial = ((Renderer)MeshRenderer).materials[MaterialIndex]; } if ((Object)(object)ParticleSystem != (Object)null) { ChangeParticleEmissionRate(0f); } if ((Object)(object)SoundEffectSource != (Object)null && (Object)(object)SoundEffect != (Object)null) { SoundEffectSource.loop = true; SoundEffectSource.clip = SoundEffect; SoundEffectSource.volume = 0f; SoundEffectSource.Stop(); } if ((Object)(object)ExplodingPart != (Object)null) { _copyExplodedMaterial = ((Renderer)ExplodingPart).materials[MaterialIndex]; ((Component)ExplodingPart).gameObject.SetActive(false); } else { _canExplode = false; } if (DoesHeatCauseCookoff) { ((MonoBehaviour)this).StartCoroutine(CookoffSystem()); } } public void OnDestroy() { Unhook(); if ((Object)(object)_copyMaterial != (Object)null) { Object.Destroy((Object)(object)_copyMaterial); } if ((Object)(object)_copyExplodedMaterial != (Object)null) { Object.Destroy((Object)(object)_copyExplodedMaterial); } } public void Update() { //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Attachment != (Object)null) { if (!_isAttached && (Object)(object)Attachment.curMount != (Object)null) { FVRPhysicalObject myObject = Attachment.curMount.GetRootMount().MyObject; FVRFireArm val = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); if (val != null) { FireArm = val; if (!(Attachment is MuzzleDevice)) { _origInternalMechanicalMOA = FireArm.m_internalMechanicalMOA; } AttachToCore(); _isAttached = true; goto IL_00cb; } } if (_isAttached && (Object)(object)Attachment.curMount == (Object)null) { DetachFromCore(); if (!(Attachment is MuzzleDevice)) { FireArm.m_internalMechanicalMOA = _origInternalMechanicalMOA; } FireArm = null; _isAttached = false; } } goto IL_00cb; IL_087b: Log(Heat); return; IL_076e: CurrentBoltRearwardSpeedMultiplier = StoppageSpeed; goto IL_087b; IL_00cb: if (Heat > 0f) { Heat -= Time.deltaTime * CooldownRate; } Heat = Mathf.Clamp(Heat, 0f, 1f); if ((Object)(object)MeshRenderer != (Object)null) { if (!EmissionUsesAdvancedCurve) { float num = Mathf.Pow(Heat, HeatExponent); if (!_hasPartExploded) { if (HeatAffectsEmissionWeight) { _copyMaterial.SetFloat("_EmissionWeight", num); } if (HeatAffectsEmissionScrollSpeed) { Vector4 zero = Vector4.zero; zero.x = Mathf.Lerp(0f, MaxEmissionScrollSpeed_X, num); zero.y = Mathf.Lerp(0f, MaxEmissionScrollSpeed_Y, num); _copyMaterial.SetVector("_IncandescenceMapVelocity", zero); } } else { if (HeatAffectsEmissionWeight) { _copyExplodedMaterial.SetFloat("_EmissionWeight", num); } if (HeatAffectsEmissionScrollSpeed) { Vector4 zero2 = Vector4.zero; zero2.x = Mathf.Lerp(0f, MaxEmissionScrollSpeed_X, num); zero2.y = Mathf.Lerp(0f, MaxEmissionScrollSpeed_Y, num); _copyExplodedMaterial.SetVector("_IncandescenceMapVelocity", zero2); } } } else if (!_hasPartExploded) { if (HeatAffectsEmissionWeight) { _copyMaterial.SetFloat("_EmissionWeight", EmissionCurve.Evaluate(Heat)); } if (HeatAffectsEmissionScrollSpeed) { Vector4 zero3 = Vector4.zero; zero3.x = EmissionScrollSpeedCurve_X.Evaluate(Heat); zero3.y = EmissionScrollSpeedCurve_Y.Evaluate(Heat); _copyMaterial.SetVector("_IncandescenceMapVelocity", zero3); } } else { if (HeatAffectsEmissionWeight) { _copyExplodedMaterial.SetFloat("_EmissionWeight", EmissionCurve.Evaluate(Heat)); } if (HeatAffectsEmissionScrollSpeed) { Vector4 zero4 = Vector4.zero; zero4.x = EmissionScrollSpeedCurve_X.Evaluate(Heat); zero4.y = EmissionScrollSpeedCurve_Y.Evaluate(Heat); _copyExplodedMaterial.SetVector("_IncandescenceMapVelocity", zero4); } } Log(((Renderer)MeshRenderer).materials[MaterialIndex].GetFloat("_EmissionWeight")); if (HeatAffectsDetailWeight) { if (!DetailUsesAdvancedCurve) { _copyMaterial.SetFloat("_DetailWeight", Mathf.Pow(Heat, DetailExponent)); } else { _copyMaterial.SetFloat("_DetailWeight", DetailCurve.Evaluate(Heat)); } } } if ((Object)(object)ParticleSystem != (Object)null) { if (!ParticlesUsesAdvancedCurve) { if (Heat > ParticleHeatThreshold) { float heat = ((!ParticleEmissionRateStartsAtZero) ? Heat : Mathf.InverseLerp(ParticleHeatThreshold, 1f, Heat)); ChangeParticleEmissionRate(heat); } else { ChangeParticleEmissionRate(0f); } } else { ChangeParticleEmissionRate(ParticlesCurve.Evaluate(Heat) * MaxEmissionRate); } } if ((Object)(object)SoundEffect != (Object)null) { if (!SoundUsesAdvancedCurve) { if (Heat > SoundHeatThreshold) { if (!_soundEnabled) { SoundEffectSource.Play(); _soundEnabled = true; } float num2 = ((!SoundVolumeStartsAtZero) ? Heat : Mathf.InverseLerp(SoundHeatThreshold, 1f, Heat)); SoundEffectSource.volume = Mathf.Lerp(0f, MaxVolume, Mathf.Pow(num2, SoundHeatExponent)); } else if (_soundEnabled) { SoundEffectSource.Stop(); _soundEnabled = false; } } else { float num3 = VolumeCurve.Evaluate(Heat); if (num3 > 0f) { if (!_soundEnabled) { SoundEffectSource.Play(); _soundEnabled = true; } SoundEffectSource.volume = num3; } else if (_soundEnabled) { SoundEffectSource.Stop(); _soundEnabled = false; } } } if (_canChangeAccuracy && DoesHeatAffectAccuracy && (Object)(object)FireArm != (Object)null && !_hasPartExploded) { ChangeAccuracy(); } if (DoesHeatAffectBoltSpeed && !_hasPartExploded) { if (!BoltSpeedUsesAdvancedCurve) { float num4 = Mathf.Pow(Heat, BoltSpeedHeatExponent); CurrentBoltForwardSpeedMultiplier = Mathf.Lerp(1f, MaxBoltForwardSpeedMultiplier, num4); CurrentBoltRearwardSpeedMultiplier = Mathf.Lerp(1f, MaxBoltRearwardSpeedMultiplier, num4); CurrentBoltSpringMultiplier = Mathf.Lerp(1f, MaxBoltSpringStiffnessesMultiplier, num4); } else { CurrentBoltForwardSpeedMultiplier = Mathf.Lerp(1f, MaxBoltForwardSpeedMultiplier, BoltForwardSpeedMultiplierCurve.Evaluate(Heat)); CurrentBoltRearwardSpeedMultiplier = Mathf.Lerp(1f, MaxBoltRearwardSpeedMultiplier, BoltRearwardSpeedMultiplierCurve.Evaluate(Heat)); CurrentBoltSpringMultiplier = Mathf.Lerp(1f, MaxBoltSpringStiffnessesMultiplier, BoltSpringStiffnessMultiplierCurve.Evaluate(Heat)); } } if (!_hasPartExploded && _canExplode && Heat > ExplodingHeatThreshhold) { _hasPartExploded = true; SM.PlayCoreSound((FVRPooledAudioType)5, ExplosionSound, ((Component)this).transform.position); if ((Object)(object)((Component)MeshRenderer).gameObject == (Object)(object)((Component)this).gameObject) { ((Renderer)MeshRenderer).enabled = false; } else { ((Component)MeshRenderer).gameObject.SetActive(false); } ((Component)ExplodingPart).gameObject.SetActive(true); if ((Object)(object)Attachment == (Object)null) { FireArm.m_internalMechanicalMOA = FailureAccuracyMultiplier * _origInternalMechanicalMOA; } else { if ((Object)(object)Attachment != (Object)null) { FVRFireArmAttachment attachment = Attachment; MuzzleDevice val2 = (MuzzleDevice)(object)((attachment is MuzzleDevice) ? attachment : null); if (val2 != null) { val2.m_mechanicalAccuracy = FailureAccuracyMultiplier * _origInternalMechanicalMOA; goto IL_076e; } } if ((Object)(object)Attachment != (Object)null && !(Attachment is MuzzleDevice)) { FireArm.m_internalMechanicalMOA = FailureAccuracyMultiplier * _origInternalMechanicalMOA; } } goto IL_076e; } if (_hasPartExploded && CanRecoverFromExplosion && Heat <= RevertHeatThreshold) { _hasPartExploded = false; if ((Object)(object)((Component)MeshRenderer).gameObject == (Object)(object)((Component)this).gameObject) { ((Renderer)MeshRenderer).enabled = true; } else { ((Component)MeshRenderer).gameObject.SetActive(true); } ((Component)ExplodingPart).gameObject.SetActive(false); if ((Object)(object)Attachment == (Object)null) { FireArm.m_internalMechanicalMOA = _origInternalMechanicalMOA; } else { if ((Object)(object)Attachment != (Object)null) { FVRFireArmAttachment attachment2 = Attachment; MuzzleDevice val3 = (MuzzleDevice)(object)((attachment2 is MuzzleDevice) ? attachment2 : null); if (val3 != null) { val3.m_mechanicalAccuracy = _origInternalMechanicalMOA; goto IL_0870; } } if ((Object)(object)Attachment != (Object)null && !(Attachment is MuzzleDevice)) { FireArm.m_internalMechanicalMOA = _origInternalMechanicalMOA; } } goto IL_0870; } goto IL_087b; IL_0870: CurrentBoltRearwardSpeedMultiplier = 1f; goto IL_087b; } private void ChangeAccuracy() { float num = (AccuracyUsesAdvancedCurve ? AccuracyCurve.Evaluate(Heat) : Mathf.Pow(Heat, AccuracyHeatExponent)); if ((Object)(object)Attachment == (Object)null) { FireArm.m_internalMechanicalMOA = Mathf.Lerp(1f, MaximumMOAMultiplier, num) * _origInternalMechanicalMOA; return; } if ((Object)(object)Attachment != (Object)null) { FVRFireArmAttachment attachment = Attachment; MuzzleDevice val = (MuzzleDevice)(object)((attachment is MuzzleDevice) ? attachment : null); if (val != null) { val.m_mechanicalAccuracy = Mathf.Lerp(1f, MaximumMOAMultiplier, num) * _origInternalMechanicalMOA; return; } } if ((Object)(object)Attachment != (Object)null && !(Attachment is MuzzleDevice)) { FireArm.m_internalMechanicalMOA = Mathf.Lerp(1f, MaximumMOAMultiplier, num) * _origInternalMechanicalMOA; } } private void ChangeParticleEmissionRate(float heat) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_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_004b: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Lerp(0f, MaxEmissionRate, Mathf.Pow(heat, ParticleHeatExponent)); EmissionModule emission = ParticleSystem.emission; MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime; ((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0; ((MinMaxCurve)(ref rateOverTime)).constantMax = num; ((MinMaxCurve)(ref rateOverTime)).constantMin = num; ((EmissionModule)(ref emission)).rateOverTime = rateOverTime; } private void AttachToCore() { Core = ((Component)FireArm).GetComponent<FirearmHeatingEffect_FirearmCore>(); if ((Object)(object)Core == (Object)null) { Core = ((Component)FireArm).gameObject.AddComponent<FirearmHeatingEffect_FirearmCore>(); } Core.FirearmHeatingEffects.Add(this); } private void DetachFromCore() { Core.FirearmHeatingEffects.Remove(this); Core = null; } private void Unhook() { //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); OpenScripts_BepInEx.FirearmHeatingEffect_CanExplode.SettingChanged -= SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanRecover.SettingChanged -= SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_RecoverThreshold.SettingChanged -= SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanChangeFirerate.SettingChanged -= SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanChangeAccuracy.SettingChanged -= SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanCookOff.SettingChanged -= SettingsChanged; } private void Hook() { //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); OpenScripts_BepInEx.FirearmHeatingEffect_CanExplode.SettingChanged += SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanRecover.SettingChanged += SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_RecoverThreshold.SettingChanged += SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanChangeFirerate.SettingChanged += SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanChangeAccuracy.SettingChanged += SettingsChanged; OpenScripts_BepInEx.FirearmHeatingEffect_CanCookOff.SettingChanged += SettingsChanged; } private void OnShotFired(FVRFireArm firearm) { //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_003d: 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) if ((Object)(object)FireArm != (Object)null && (Object)(object)firearm == (Object)(object)FireArm) { float num = 1f; if (ChangesWithCartridgePower) { OTagFirearmRoundPower roundPower = AM.GetRoundPower(FireArm.RoundType); num = RoundPowerMultipliers[roundPower]; } if ((Object)(object)Core != (Object)null) { Heat += HeatPerShot * Core.CombinedHeatMultiplier * num; } else { Heat += HeatPerShot * HeatMultiplier * num; } } } private void SettingsChanged(object sender, EventArgs e) { if ((Object)(object)ExplodingPart != (Object)null) { _canExplode = OpenScripts_BepInEx.FirearmHeatingEffect_CanExplode.Value; } else { _canExplode = false; } CanRecoverFromExplosion = OpenScripts_BepInEx.FirearmHeatingEffect_CanRecover.Value; RevertHeatThreshold = OpenScripts_BepInEx.FirearmHeatingEffect_RecoverThreshold.Value; _canChangeAccuracy = OpenScripts_BepInEx.FirearmHeatingEffect_CanChangeAccuracy.Value; _canCookOff = OpenScripts_BepInEx.FirearmHeatingEffect_CanCookOff.Value; } private IEnumerator CookoffSystem() { while (DoesHeatCauseCookoff) { float num = Random.Range(0f, 1f); if (_canCookOff && Heat > CookoffHeatThreshold) { float num2 = ((!CookoffChanceStartsAtZero) ? Heat : Mathf.InverseLerp(CookoffHeatThreshold, 1f, Heat)); float num3 = Mathf.Lerp(0f, MaxCookoffChancePerSecond, num2); if (num < num3 && (Object)(object)FireArm != (Object)null) { FVRFireArm fireArm = FireArm; ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null); if (val == null) { Handgun val2 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null); if (val2 != null) { val2.DropHammer(false); } } else { val.DropHammer(); } } } yield return (object)new WaitForSeconds(1f); } } private void Log(object message) { if (DebugEnabled) { Debug.Log((object)(((Object)((Component)this).gameObject).name + " " + message)); } } } public class MuzzleEffectController : MonoBehaviour { public FVRFireArm FireArm; public MuzzleEffect[] MuzzleEffects; public bool SupressorChangesSize; public MuzzleEffectSize[] SuppressedMuzzleEffectSizes; private List<MuzzlePSystem> m_muzzleSystems; private bool _wasSuppressed; public void Awake() { ((Component)this).gameObject.SetActive(false); MuzzleEffectController obj = ((Component)this).gameObject.AddComponent<MuzzleEffectController>(); obj.FireArm = FireArm; obj.MuzzleEffects = MuzzleEffects; obj.SupressorChangesSize = SupressorChangesSize; obj.SuppressedMuzzleEffectSizes = SuppressedMuzzleEffectSizes; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class RevolverFireNChambersBack : MonoBehaviour { public Revolver revolver; public int NChambersBack = 3; public Transform SecondMuzzle; public float FiringDelay = 0.1f; private List<MuzzlePSystem> m_muzzleSystems = new List<MuzzlePSystem>(); public void Awake() { ((Component)this).gameObject.SetActive(false); RevolverFireNChambersBack obj = ((Component)this).gameObject.AddComponent<RevolverFireNChambersBack>(); obj.ModifiedRevolver = revolver; obj.NChambersBack = NChambersBack; obj.SecondMuzzle = SecondMuzzle; obj.FiringDelay = FiringDelay; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class HandGunSpin : MonoBehaviour { public Handgun handgun; public Transform PoseSpinHolder; private float xSpinVel; private float xSpinRot; private bool m_isSpinning; public void Awake() { ((Component)this).gameObject.SetActive(false); HandgunSpin obj = ((Component)this).gameObject.AddComponent<HandgunSpin>(); obj.Handgun = handgun; obj.PoseSpinHolder = PoseSpinHolder; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } }
plugins/OpenScriptsBepInEx.dll
Decompiled 10 months agousing System.Collections.Generic; 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.Configuration; using Sodalite.ModPanel; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("OpenScriptsBepInEx")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OpenScriptsBepInEx")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3aba2d0f-b136-4a9e-8519-e9ae7af1224f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; [BepInPlugin("h3vr.cityrobo.OpenScripts", "OpenScripts BepInEx Loader Plugin", "1.6.0")] public class OpenScripts_BepInEx : BaseUnityPlugin { public static string PluginPath; public static OpenScripts_BepInEx Instance; public static List<string> LoadedPluginPaths = new List<string>(); public static ConfigEntry<bool> FirearmHeatingEffect_CanExplode; public static ConfigEntry<bool> FirearmHeatingEffect_CanRecover; public static ConfigEntry<float> FirearmHeatingEffect_RecoverThreshold; public static ConfigEntry<bool> FirearmHeatingEffect_CanChangeFirerate; public static ConfigEntry<bool> FirearmHeatingEffect_CanChangeAccuracy; public static ConfigEntry<bool> FirearmHeatingEffect_CanCookOff; public static ConfigEntry<int> ScopeResolution; public void Awake() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Instance = this; FirearmHeatingEffect_CanExplode = ((BaseUnityPlugin)this).Config.Bind<bool>("Firearm Heating Effect", "Part can explode", true, "If true, and the part is setup to do so, the parts with heating effects can explode."); FirearmHeatingEffect_CanRecover = ((BaseUnityPlugin)this).Config.Bind<bool>("Firearm Heating Effect", "Part can recover", false, "If true, parts can recover from being exploded."); FirearmHeatingEffect_RecoverThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Firearm Heating Effect", "Recover heat threshold", 0f, new ConfigDescription("Defines the heat value, at which the part will recover from being exploded", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 1f, 0.05f), new object[0])); FirearmHeatingEffect_CanChangeFirerate = ((BaseUnityPlugin)this).Config.Bind<bool>("Firearm Heating Effect", "Gun can change firerate", true, "If true, enables firearm firerate changes based on heat."); FirearmHeatingEffect_CanChangeAccuracy = ((BaseUnityPlugin)this).Config.Bind<bool>("Firearm Heating Effect", "Gun can change accuracy", true, "If true, enables firearm accuracy changes based on heat."); FirearmHeatingEffect_CanCookOff = ((BaseUnityPlugin)this).Config.Bind<bool>("Firearm Heating Effect", "Gun can cook off", true, "If true, enables firearm cookoff chance based on heat."); ScopeResolution = ((BaseUnityPlugin)this).Config.Bind<int>("Scope Shader Zoom", "Scope Resolution", 1028, "Makes all custom scopes the same resolution. Useful for when you notice performance issues with custom scopes."); PluginPath = ((BaseUnityPlugin)this).Info.Location; Path.GetFileName(PluginPath); FileInfo[] files = new DirectoryInfo(Path.GetDirectoryName(PluginPath)).GetFiles("*.dll"); foreach (FileInfo fileInfo in files) { if (!(fileInfo.FullName == PluginPath)) { Assembly.LoadFrom(fileInfo.FullName); LoadedPluginPaths.Add(fileInfo.FullName); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Fully loaded all OpenScripts DLLs!"); } }
plugins/PreattachedAttachment.dll
Decompiled 10 months agousing 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 OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PreattachedAttachment")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PreattachedAttachment")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c2dd5b33-d3ba-4bb1-a1ba-fc5ab4fa33e8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class PreattachedForeignAttachments : MonoBehaviour { public FVRFireArmAttachmentMount mount; public string[] primaryItemIDs; [Tooltip("If your item fails to spawn, it will spawn the backup ID.")] public string[] backupIDs; [Tooltip("Position and Rotation to spawn the Attachment at.")] public Transform[] attachmentPoints; private List<FVRFireArmAttachment> attachments; public void Awake() { ((Component)this).gameObject.SetActive(false); PreattachedForeignAttachments obj = ((Component)this).gameObject.AddComponent<PreattachedForeignAttachments>(); obj.ForeignAttachmentSets = ConvertToSets(); obj.AttachmentMount = mount; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } private ForeignAttachmentSet[] ConvertToSets() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown ForeignAttachmentSet[] array = (ForeignAttachmentSet[])(object)new ForeignAttachmentSet[attachments.Count]; for (int i = 0; i < attachments.Count; i++) { array[i] = new ForeignAttachmentSet(primaryItemIDs[i], backupIDs[i], attachmentPoints[i]); } return array; } } public class PreattachedAttachments : MonoBehaviour { public FVRFireArmAttachment[] attachments; public FVRFireArmAttachmentMount mount; public void Awake() { ((Component)this).gameObject.SetActive(false); PreattachedAttachments obj = ((Component)this).gameObject.AddComponent<PreattachedAttachments>(); obj.Attachments = attachments; obj.AttachmentMount = mount; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class PreattachedAttachment : MonoBehaviour { public FVRFireArmAttachment attachment; public FVRFireArmAttachmentMount mount; public void Awake() { ((Component)this).gameObject.SetActive(false); PreattachedAttachment obj = ((Component)this).gameObject.AddComponent<PreattachedAttachment>(); obj.Attachment = attachment; obj.AttachmentMount = mount; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/QBArmorPiece.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("QBArmorPiece")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("QBArmorPiece")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("620618db-0065-44f5-8c6f-c7a45a643910")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class QBArmorPiece_Headgear : QBArmorPiece_Backpack { public override void Awake() { ((FVRPhysicalObject)this).Awake(); ((FVRPhysicalObject)this).DoesQuickbeltSlotFollowHead = false; } public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { base.SetQuickBeltSlot(slot); if ((Object)(object)slot != (Object)null) { ((FVRPhysicalObject)this).SetParentage(GM.CurrentPlayerBody.FilteredHead); } else { ((FVRPhysicalObject)this).SetParentage((Transform)null); } } } public class QBArmorPiece_Backpack : PlayerBackPack { [Header("QBArmorPiece_Backpack Config")] public string layerName = "Default"; public string attachmentLayerName = "Default"; public string layerOutsideQBSlot = "Default"; public GameObject disabledInQB; public GameObject enabledInQB; private int attachmentCountOnQBSlotEnter; public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { if (((FVRPhysicalObject)this).AttachmentsList.Count > 0) { for (int i = 0; i < ((FVRPhysicalObject)this).AttachmentsList.Count; i++) { if ((Object)(object)((FVRPhysicalObject)this).AttachmentsList[i] != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)this).AttachmentsList[i]).SetAllCollidersToLayer(false, attachmentLayerName); } } attachmentCountOnQBSlotEnter = ((FVRPhysicalObject)this).AttachmentsList.Count; } } else if (((FVRPhysicalObject)this).AttachmentsList.Count > 0) { for (int j = 0; j < ((FVRPhysicalObject)this).AttachmentsList.Count; j++) { if ((Object)(object)((FVRPhysicalObject)this).AttachmentsList[j] != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)this).AttachmentsList[j]).SetAllCollidersToLayer(false, layerOutsideQBSlot); } } attachmentCountOnQBSlotEnter = ((FVRPhysicalObject)this).AttachmentsList.Count; } if ((Object)(object)((FVRPhysicalObject)this).m_quickbeltSlot != (Object)null && (Object)(object)slot != (Object)(object)((FVRPhysicalObject)this).m_quickbeltSlot) { ((FVRPhysicalObject)this).m_quickbeltSlot.HeldObject = null; ((FVRPhysicalObject)this).m_quickbeltSlot.CurObject = null; ((FVRPhysicalObject)this).m_quickbeltSlot.IsKeepingTrackWithHead = false; } if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerName); slot.HeldObject = (FVRInteractiveObject)(object)this; slot.CurObject = (FVRPhysicalObject)(object)this; slot.IsKeepingTrackWithHead = ((FVRPhysicalObject)this).DoesQuickbeltSlotFollowHead; if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(false); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(true); } } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerOutsideQBSlot); if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(true); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(false); } } ((FVRPhysicalObject)this).m_quickbeltSlot = slot; } public override void FVRUpdate() { ((PlayerBackPack)this).FVRUpdate(); if ((Object)(object)((FVRPhysicalObject)this).m_quickbeltSlot != (Object)null && ((FVRPhysicalObject)this).AttachmentsList.Count > attachmentCountOnQBSlotEnter) { if ((Object)(object)((FVRPhysicalObject)this).AttachmentsList[attachmentCountOnQBSlotEnter] != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)this).AttachmentsList[attachmentCountOnQBSlotEnter]).SetAllCollidersToLayer(false, attachmentLayerName); } attachmentCountOnQBSlotEnter = ((FVRPhysicalObject)this).AttachmentsList.Count; } } } public class QBArmorPiece : FVRPhysicalObject { [Header("QBArmorPiece Config")] public string layerName = "Default"; public string attachmentLayerName = "Default"; public string layerOutsideQBSlot = "Default"; public GameObject disabledInQB; public GameObject enabledInQB; private int attachmentCountOnQBSlotEnter; public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { if (base.AttachmentsList.Count > 0) { for (int i = 0; i < base.AttachmentsList.Count; i++) { if ((Object)(object)base.AttachmentsList[i] != (Object)null) { ((FVRInteractiveObject)base.AttachmentsList[i]).SetAllCollidersToLayer(false, attachmentLayerName); } } attachmentCountOnQBSlotEnter = base.AttachmentsList.Count; } } else if (base.AttachmentsList.Count > 0) { for (int j = 0; j < base.AttachmentsList.Count; j++) { if ((Object)(object)base.AttachmentsList[j] != (Object)null) { ((FVRInteractiveObject)base.AttachmentsList[j]).SetAllCollidersToLayer(false, layerOutsideQBSlot); } } attachmentCountOnQBSlotEnter = base.AttachmentsList.Count; } if ((Object)(object)base.m_quickbeltSlot != (Object)null && (Object)(object)slot != (Object)(object)base.m_quickbeltSlot) { base.m_quickbeltSlot.HeldObject = null; base.m_quickbeltSlot.CurObject = null; base.m_quickbeltSlot.IsKeepingTrackWithHead = false; } if ((Object)(object)slot != (Object)null && !((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerName); slot.HeldObject = (FVRInteractiveObject)(object)this; slot.CurObject = (FVRPhysicalObject)(object)this; slot.IsKeepingTrackWithHead = base.DoesQuickbeltSlotFollowHead; if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(false); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(true); } } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, layerOutsideQBSlot); if ((Object)(object)disabledInQB != (Object)null) { disabledInQB.SetActive(true); } if ((Object)(object)enabledInQB != (Object)null) { enabledInQB.SetActive(false); } } base.m_quickbeltSlot = slot; } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)base.m_quickbeltSlot != (Object)null && base.AttachmentsList.Count > attachmentCountOnQBSlotEnter) { if ((Object)(object)base.AttachmentsList[attachmentCountOnQBSlotEnter] != (Object)null) { ((FVRInteractiveObject)base.AttachmentsList[attachmentCountOnQBSlotEnter]).SetAllCollidersToLayer(false, attachmentLayerName); } attachmentCountOnQBSlotEnter = base.AttachmentsList.Count; } } }
plugins/RangeFinder.dll
Decompiled 10 months agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using FistVR; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RangeFinder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RangeFinder")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("592ea957-f03c-4b31-82ce-b6334911a924")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] public class RangeFinder_Raycast : MonoBehaviour { public enum ChosenScreen { Up, Left, Down, Right } public Transform direction; public LayerMask layerMask; public Text[] text_objects; public ChosenScreen chosenScreen; private void Start() { direction = ((Component)this).gameObject.transform; chosenScreen = ChosenScreen.Up; } public void ChangeActiveScreen() { for (int i = 0; i < 4; i++) { if (i == (int)chosenScreen) { ((Component)text_objects[i]).gameObject.SetActive(true); } else { ((Component)text_objects[i]).gameObject.SetActive(false); } } } private void FixedUpdate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0023: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.TransformDirection(Vector3.forward), ref val, float.PositiveInfinity, LayerMask.op_Implicit(layerMask))) { float distance = ((RaycastHit)(ref val)).distance; if (distance < 10f) { text_objects[(int)chosenScreen].text = string.Format("{0:F3} {1}", distance, "m"); } else if (distance < 100f) { text_objects[(int)chosenScreen].text = string.Format("{0:F2} {1}", distance, "m"); } else if (distance < 1000f) { text_objects[(int)chosenScreen].text = string.Format("{0:F1} {1}", distance, "m"); } else { text_objects[(int)chosenScreen].text = string.Format("{0:F0} {1}", distance, "m"); } } else { Debug.DrawRay(((Component)this).transform.position, ((Component)this).transform.TransformDirection(Vector3.forward) * 1000f, Color.white); text_objects[(int)chosenScreen].text = "inf"; } } } namespace Cityrobo; internal class RangeFinder_Attachment : MonoBehaviour { public FVRFireArmAttachmentInterface attachmentInterface; public RangeFinder_Raycast raycast; public void Update() { //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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) FVRViveHand hand = ((FVRInteractiveObject)attachmentInterface).m_hand; if ((Object)(object)hand != (Object)null) { if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { RotateScreenLeft(); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { RotateScreenRight(); } } } public void RotateScreenLeft() { switch (raycast.chosenScreen) { case RangeFinder_Raycast.ChosenScreen.Up: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Left; raycast.ChangeActiveScreen(); break; case RangeFinder_Raycast.ChosenScreen.Left: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Down; raycast.ChangeActiveScreen(); break; case RangeFinder_Raycast.ChosenScreen.Down: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Right; raycast.ChangeActiveScreen(); break; case RangeFinder_Raycast.ChosenScreen.Right: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Up; raycast.ChangeActiveScreen(); break; default: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Up; raycast.ChangeActiveScreen(); break; } } public void RotateScreenRight() { switch (raycast.chosenScreen) { case RangeFinder_Raycast.ChosenScreen.Up: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Right; raycast.ChangeActiveScreen(); break; case RangeFinder_Raycast.ChosenScreen.Left: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Up; raycast.ChangeActiveScreen(); break; case RangeFinder_Raycast.ChosenScreen.Down: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Left; raycast.ChangeActiveScreen(); break; case RangeFinder_Raycast.ChosenScreen.Right: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Down; raycast.ChangeActiveScreen(); break; default: raycast.chosenScreen = RangeFinder_Raycast.ChosenScreen.Up; raycast.ChangeActiveScreen(); break; } } } internal class RangeFinder_HandHeld : MonoBehaviour { public FVRFireArmAttachment attachment; public GameObject laserSystem; public AudioSource audioSource; public AudioClip audioClip; private bool isOn; private bool lockControls; public void Start() { attachment = ((Component)this).gameObject.GetComponent<FVRFireArmAttachment>(); } public void Update() { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) FVRViveHand hand = ((FVRInteractiveObject)attachment).m_hand; if ((Object)(object)hand != (Object)null && (Object)(object)attachment.curMount == (Object)null) { if (hand.Input.TriggerDown && !lockControls) { ((MonoBehaviour)this).StartCoroutine("MeasureOnce"); } else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f && !lockControls) { ToggleMeasure(); } else if (hand.Input.TouchpadUp && lockControls) { lockControls = false; } } else if ((Object)(object)attachment.curMount != (Object)null && (Object)(object)((FVRInteractiveObject)attachment.AttachmentInterface).m_hand != (Object)null) { if (((FVRInteractiveObject)attachment.AttachmentInterface).m_hand.Input.TouchpadDown && Vector2.Angle(((FVRInteractiveObject)attachment.AttachmentInterface).m_hand.Input.TouchpadAxes, Vector2.up) < 45f) { ToggleMeasure(); } else if (((FVRInteractiveObject)attachment.AttachmentInterface).m_hand.Input.TouchpadDown && Vector2.Angle(((FVRInteractiveObject)attachment.AttachmentInterface).m_hand.Input.TouchpadAxes, Vector2.down) < 45f) { lockControls = true; } } } public IEnumerator MeasureOnce() { if (!isOn) { ToggleMeasure(); } yield return 0; ToggleMeasure(); } public void ToggleMeasure() { if (!isOn) { laserSystem.SetActive(true); audioSource.PlayOneShot(audioClip); isOn = true; } else { laserSystem.SetActive(false); isOn = false; } } }
plugins/RifleGrenadeAdapter.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RifleGrenadeAdapter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RifleGrenadeAdapter")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a88b3506-6ea0-4787-820c-71794be18715")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class ItemLauncherAttachment : MuzzleDevice { [Header("ItemLauncher Config")] public ItemLauncherQBSlot ItemHolder; public Transform ItemLaunchPoint; public float SpeedMultiplier = 1f; public FVRFireArmRecoilProfile OverrideRecoilProfile; public FVRFireArmRecoilProfile OverrideRecoilProfileStocked; public AudioEvent GrenadeShot; private Vector3 _origMuzzlePos; private Quaternion _origMuzzleRot; private FVRFireArm _fireArm; private FVRFireArmRecoilProfile _origRecoilProfile; private FVRFireArmRecoilProfile _origRecoilProfileStocked; private bool _recoilProfileSet; public override void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).Awake(); _origMuzzlePos = base.Muzzle.localPosition; _origMuzzleRot = base.Muzzle.localRotation; } public override void FVRUpdate() { //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_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_0042: 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_0157: 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) ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)((FVRQuickBeltSlot)ItemHolder).HeldObject != (Object)null) { base.Muzzle.position = Vector3.down * 3f + ((Component)this).transform.TransformPoint(_origMuzzlePos); base.Muzzle.rotation = Quaternion.LookRotation(Vector3.down, Vector3.forward); if (!_recoilProfileSet && (Object)(object)_fireArm != (Object)null && (Object)(object)OverrideRecoilProfile != (Object)null) { _origRecoilProfile = _fireArm.RecoilProfile; _origRecoilProfileStocked = _fireArm.RecoilProfileStocked; if ((Object)(object)OverrideRecoilProfileStocked != (Object)null) { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfileStocked; } else { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfile; } _recoilProfileSet = true; } } else { if (_recoilProfileSet && (Object)(object)_fireArm != (Object)null) { _fireArm.RecoilProfile = _origRecoilProfile; _fireArm.RecoilProfileStocked = _origRecoilProfileStocked; _recoilProfileSet = false; } base.Muzzle.localPosition = _origMuzzlePos; base.Muzzle.localRotation = _origMuzzleRot; } } public override void AttachToMount(FVRFireArmAttachmentMount m, bool playSound) { ((FVRFireArmAttachment)this).AttachToMount(m, playSound); ref FVRFireArm fireArm = ref _fireArm; FVRPhysicalObject myObject = m.GetRootMount().MyObject; fireArm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); } public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).OnShot(f, tailClass); if ((Object)(object)((FVRQuickBeltSlot)ItemHolder).HeldObject != (Object)null) { FireItem(); } } private void FireItem() { //IL_001b: 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) float num = CalculateLaunchSpeed(); if (ItemHolder.LaunchHeldObject(num * SpeedMultiplier, ItemLaunchPoint.position)) { SM.PlayCoreSound((FVRPooledAudioType)1, GrenadeShot, ((Component)ItemHolder).transform.position); } } private float CalculateLaunchSpeed() { FVRFireArmChamber curentChamber = GetCurentChamber(); if ((Object)(object)curentChamber == (Object)null) { return 5f; } BallisticProjectile component = curentChamber.GetRound().BallisticProjectilePrefab.GetComponent<BallisticProjectile>(); float num = 0.5f * component.Mass * Mathf.Pow(component.MuzzleVelocityBase, 2f); float mass = ((FVRQuickBeltSlot)ItemHolder).CurObject.RootRigidbody.mass; return Mathf.Sqrt(num / (0.5f * mass)); } private FVRFireArmChamber GetCurentChamber() { FVRFireArm fireArm = _fireArm; Handgun val = (Handgun)(object)((fireArm is Handgun) ? fireArm : null); if (val == null) { ClosedBoltWeapon val2 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null); if (val2 == null) { OpenBoltReceiver val3 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null); if (val3 == null) { TubeFedShotgun val4 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null); if (val4 == null) { BoltActionRifle val5 = (BoltActionRifle)(object)((fireArm is BoltActionRifle) ? fireArm : null); if (val5 == null) { BreakActionWeapon val6 = (BreakActionWeapon)(object)((fireArm is BreakActionWeapon) ? fireArm : null); if (val6 == null) { Revolver val7 = (Revolver)(object)((fireArm is Revolver) ? fireArm : null); if (val7 == null) { SingleActionRevolver val8 = (SingleActionRevolver)(object)((fireArm is SingleActionRevolver) ? fireArm : null); if (val8 == null) { RevolvingShotgun val9 = (RevolvingShotgun)(object)((fireArm is RevolvingShotgun) ? fireArm : null); if (val9 == null) { Flaregun val10 = (Flaregun)(object)((fireArm is Flaregun) ? fireArm : null); if (val10 == null) { RollingBlock val11 = (RollingBlock)(object)((fireArm is RollingBlock) ? fireArm : null); if (val11 == null) { Derringer val12 = (Derringer)(object)((fireArm is Derringer) ? fireArm : null); if (val12 == null) { LAPD2019 val13 = (LAPD2019)(object)((fireArm is LAPD2019) ? fireArm : null); if (val13 == null) { BAP val14 = (BAP)(object)((fireArm is BAP) ? fireArm : null); if (val14 == null) { HCB val15 = (HCB)(object)((fireArm is HCB) ? fireArm : null); if (val15 == null) { M72 val16 = (M72)(object)((fireArm is M72) ? fireArm : null); if (val16 == null) { MF2_RL val17 = (MF2_RL)(object)((fireArm is MF2_RL) ? fireArm : null); if (val17 == null) { RGM40 val18 = (RGM40)(object)((fireArm is RGM40) ? fireArm : null); if (val18 == null) { RPG7 val19 = (RPG7)(object)((fireArm is RPG7) ? fireArm : null); if (val19 == null) { SimpleLauncher val20 = (SimpleLauncher)(object)((fireArm is SimpleLauncher) ? fireArm : null); if (val20 == null) { SimpleLauncher2 val21 = (SimpleLauncher2)(object)((fireArm is SimpleLauncher2) ? fireArm : null); if (val21 == null) { RemoteMissileLauncher val22 = (RemoteMissileLauncher)(object)((fireArm is RemoteMissileLauncher) ? fireArm : null); if (val22 == null) { PotatoGun val23 = (PotatoGun)(object)((fireArm is PotatoGun) ? fireArm : null); if (val23 == null) { GrappleGun val24 = (GrappleGun)(object)((fireArm is GrappleGun) ? fireArm : null); if (val24 != null) { return val24.Chambers[val24.m_curChamber]; } if (_fireArm.FChambers.Count > 0) { return _fireArm.FChambers[0]; } return null; } return val23.Chamber; } return val22.Chamber; } return val21.Chamber; } return val20.Chamber; } return val19.Chamber; } return val18.Chamber; } return val17.Chamber; } return val16.Chamber; } return val15.Chamber; } return val14.Chamber; } return val13.Chambers[val13.CurChamber]; } return val12.Barrels[val12.m_curBarrel].Chamber; } return val11.Chamber; } return val10.Chamber; } return val9.Chambers[val9.CurChamber]; } return val8.Cylinder.Chambers[val8.CurChamber]; } return val7.Chambers[val7.CurChamber]; } return val6.Barrels[val6.m_curBarrel].Chamber; } return val5.Chamber; } return val4.Chamber; } return val3.Chamber; } return val2.Chamber; } return val.Chamber; } } public class RifleGrenadeAdapter : MuzzleDevice { [Header("Rifle Grenade Adapter Config")] public FVRFireArmChamber GrenadeChamber; public Transform GrenadeMuzzle; public float VelocityMultiplier = 1f; public float RangeOverride = -1f; public FVRFireArmRecoilProfile OverrideRecoilProfile; public FVRFireArmRecoilProfile OverrideRecoilProfileStocked; public AudioEvent GrenadeShot; [Tooltip("Normally, only caseless rounds will be removed from the chamber when fired. Enabling this will also remove fired cased rounds from the chamber automatically.")] public bool DoesClearCasedRounds; private Vector3 _origMuzzlePos; private Quaternion _origMuzzleRot; private FVRFireArm _fireArm; private FVRFireArmRecoilProfile _origRecoilProfile; private FVRFireArmRecoilProfile _origRecoilProfileStocked; private bool _recoilProfileSet; public override void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).Awake(); _origMuzzlePos = base.Muzzle.localPosition; _origMuzzleRot = base.Muzzle.localRotation; } public override void FVRUpdate() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_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_004c: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if (GrenadeChamber.IsFull) { base.Muzzle.position = Vector3.down * 3f + ((Component)this).transform.TransformPoint(_origMuzzlePos); base.Muzzle.rotation = Quaternion.LookRotation(Vector3.down, Vector3.forward); if (!_recoilProfileSet && (Object)(object)_fireArm != (Object)null && (Object)(object)OverrideRecoilProfile != (Object)null) { _origRecoilProfile = _fireArm.RecoilProfile; _origRecoilProfileStocked = _fireArm.RecoilProfileStocked; if ((Object)(object)OverrideRecoilProfileStocked != (Object)null) { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfileStocked; } else { _fireArm.RecoilProfile = OverrideRecoilProfile; _fireArm.RecoilProfileStocked = OverrideRecoilProfile; } _recoilProfileSet = true; } if (GrenadeChamber.IsSpent && (GrenadeChamber.GetRound().IsCaseless || DoesClearCasedRounds)) { GrenadeChamber.Unload(); } } else { if (_recoilProfileSet && (Object)(object)_fireArm != (Object)null) { _fireArm.RecoilProfile = _origRecoilProfile; _fireArm.RecoilProfileStocked = _origRecoilProfileStocked; _recoilProfileSet = false; } base.Muzzle.localPosition = _origMuzzlePos; base.Muzzle.localRotation = _origMuzzleRot; } } public override void AttachToMount(FVRFireArmAttachmentMount m, bool playSound) { ((FVRFireArmAttachment)this).AttachToMount(m, playSound); ref FVRFireArm fireArm = ref _fireArm; FVRPhysicalObject myObject = m.GetRootMount().MyObject; fireArm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); } public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((MuzzleDevice)this).OnShot(f, tailClass); FireGrenade(); } private void FireGrenade() { //IL_0023: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_010e: 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_011e: 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_0160: Unknown result type (might be due to invalid IL or missing references) if (!GrenadeChamber.Fire() || (Object)(object)_fireArm == (Object)null) { return; } float num = _fireArm.GetCombinedFixedDrop(base.MechanicalAccuracy) * 0.0166667f; Vector2 val = _fireArm.GetCombinedFixedDrift(base.MechanicalAccuracy) * 0.0166667f; for (int i = 0; i < GrenadeChamber.GetRound().NumProjectiles; i++) { float num2 = GrenadeChamber.GetRound().ProjectileSpread + base.m_mechanicalAccuracy; if ((Object)(object)GrenadeChamber.GetRound().BallisticProjectilePrefab != (Object)null) { Vector3 val2 = GrenadeMuzzle.forward * 0.005f; GameObject val3 = Object.Instantiate<GameObject>(GrenadeChamber.GetRound().BallisticProjectilePrefab, GrenadeMuzzle.position - val2, GrenadeMuzzle.rotation); Vector2 val4 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num2; val3.transform.Rotate(new Vector3(val4.x + val.y + num, val4.y + val.x, 0f)); BallisticProjectile component = val3.GetComponent<BallisticProjectile>(); component.Fire(component.MuzzleVelocityBase * GrenadeChamber.ChamberVelocityMultiplier * VelocityMultiplier, val3.transform.forward, _fireArm, true); if (RangeOverride > 0f) { component.ForceSetMaxDist(RangeOverride); } } } SM.PlayCoreSound((FVRPooledAudioType)1, GrenadeShot, GrenadeMuzzle.position); } } public class ItemLauncherQBSlot : FVRQuickBeltSlot { [Header("ItemLauncherQBSlot Config")] [Tooltip("Should the Launcher duplicate spawn-locked item?")] public bool AllowSpawnLock = true; [Tooltip("Should the Launcher duplicate harnessed item?")] public bool AllowHarnessing = true; [Tooltip("Should the Launcher automatically fire a cartridge placed in the slot or just launch it?")] public bool FireAmmunition = true; [Tooltip("Should the Launcher automatically pull the pin or cap of a grenade?")] public bool AutoArmGrenades = true; [Tooltip("Should the Launcher automatically align the object in the slot so it points forward?")] public bool AutoAlignZAxis = true; private bool _isAlinged; public void Start() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { RegisterQuickbeltSlot(); } } public void OnDestroy() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { DeRegisterQuickbeltSlot(); } } public void RegisterQuickbeltSlot() { if (!GM.CurrentPlayerBody.QuickbeltSlots.Contains((FVRQuickBeltSlot)(object)this)) { GM.CurrentPlayerBody.QuickbeltSlots.Add((FVRQuickBeltSlot)(object)this); } } public void DeRegisterQuickbeltSlot() { if (GM.CurrentPlayerBody.QuickbeltSlots.Contains((FVRQuickBeltSlot)(object)this)) { GM.CurrentPlayerBody.QuickbeltSlots.Remove((FVRQuickBeltSlot)(object)this); } } private void LateUpdate() { if (!AllowHarnessing && (Object)(object)base.CurObject != (Object)null && base.CurObject.m_isHardnessed) { base.CurObject.m_isHardnessed = false; } if (!AllowSpawnLock && (Object)(object)base.CurObject != (Object)null && base.CurObject.m_isSpawnLock) { base.CurObject.m_isSpawnLock = false; } if (!_isAlinged && (Object)(object)base.CurObject != (Object)null && AutoAlignZAxis) { AlignHeldObject(); } if (_isAlinged && (Object)(object)base.CurObject == (Object)null) { _isAlinged = false; } } public bool LaunchHeldObject(float speed, Vector3 point) { //IL_006f: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.CurObject == (Object)null) { return false; } FVRPhysicalObject val; if (base.CurObject.m_isSpawnLock || base.CurObject.m_isHardnessed) { val = DuplicateFromSpawnLock(base.CurObject).GetComponent<FVRPhysicalObject>(); } else { val = base.CurObject; base.CurObject.SetQuickBeltSlot((FVRQuickBeltSlot)null); } val.RootRigidbody.collisionDetectionMode = (CollisionDetectionMode)2; ((Component)val).transform.SetParent((Transform)null); ((Component)val).transform.position = point; ((Component)val).transform.rotation = ((Component)this).transform.rotation; val.RootRigidbody.velocity = ((Component)this).transform.forward * speed; PinnedGrenade val2 = (PinnedGrenade)(object)((val is PinnedGrenade) ? val : null); if (val2 == null) { FVRCappedGrenade val3 = (FVRCappedGrenade)(object)((val is FVRCappedGrenade) ? val : null); if (val3 == null) { FVRFireArmRound val4 = (FVRFireArmRound)(object)((val is FVRFireArmRound) ? val : null); if (val4 != null && FireAmmunition) { FireRound(val4); } } else if (AutoArmGrenades) { PrimeGrenade(val3); } } else if (AutoArmGrenades) { PrimeGrenade(val2); } return true; } private void PrimeGrenade(PinnedGrenade grenade) { grenade.ReleaseLever(); } private void PrimeGrenade(FVRCappedGrenade grenade) { grenade.m_IsFuseActive = true; } private void FireRound(FVRFireArmRound round) { round.Splode(1f, false, true); } private GameObject DuplicateFromSpawnLock(FVRPhysicalObject physicalObject) { //IL_0011: 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) GameObject obj = Object.Instantiate<GameObject>(((AnvilAsset)physicalObject.ObjectWrapper).GetGameObject(), ((FVRInteractiveObject)physicalObject).Transform.position, ((FVRInteractiveObject)physicalObject).Transform.rotation); FVRPhysicalObject component = obj.GetComponent<FVRPhysicalObject>(); component.SetQuickBeltSlot((FVRQuickBeltSlot)null); if (physicalObject.MP.IsMeleeWeapon && component.MP.IsThrownDisposable) { component.MP.IsCountingDownToDispose = true; if (component.MP.m_isThrownAutoAim) { component.MP.SetReadyToAim(true); component.MP.SetPose(physicalObject.MP.PoseIndex); } } return obj; } private void AlignHeldObject() { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.identity; if ((Object)(object)((FVRInteractiveObject)base.CurObject).QBPoseOverride != (Object)null) { val = ((FVRInteractiveObject)base.CurObject).QBPoseOverride.localRotation; } else if ((Object)(object)((FVRInteractiveObject)base.CurObject).PoseOverride != (Object)null) { val = ((FVRInteractiveObject)base.CurObject).PoseOverride.localRotation; } base.PoseOverride.localRotation = Quaternion.Inverse(val); _isAlinged = true; } }
plugins/Rigidbody_JiggleBones.dll
Decompiled 10 months agousing 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Rigidbody_JiggleBones")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Rigidbody_JiggleBones")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("78535432-0882-4ce6-a28e-9bac96e35f69")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [Obsolete("Use JiggleBonesMK2 instead!")] public class JiggleBones : MonoBehaviour { public Rigidbody rootObject; public Transform rootBone; public float spring_strength; public float spring_dampening; public float angleLimit; public float collider_Radius; public float collider_Height; public void Start() { Transform val = rootBone; ((Joint)((Component)rootBone).gameObject.AddComponent<FixedJoint>()).connectedBody = rootObject; while ((Object)(object)val != (Object)null) { if (val.childCount == 0) { val = null; break; } Transform child = val.GetChild(0); ((Component)child).gameObject.AddComponent<Rigidbody>().useGravity = false; ConfigurableJoint joint = ((Component)child).gameObject.AddComponent<ConfigurableJoint>(); configureJoint(joint, ((Component)val).gameObject.GetComponent<Rigidbody>()); CapsuleCollider obj = ((Component)child).gameObject.AddComponent<CapsuleCollider>(); obj.direction = 1; obj.radius = collider_Radius; obj.height = collider_Height; val = child; } Transform[] componentsInChildren = ((Component)rootBone).GetComponentsInChildren<Transform>(); foreach (Transform val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)(object)((Component)rootBone).transform) { val2.SetParent((Transform)null); } } } public void configureJoint(ConfigurableJoint joint, Rigidbody parent) { //IL_0017: 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_0070: 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_0083: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) ((Joint)joint).connectedBody = parent; ((Joint)joint).axis = new Vector3(0f, 1f, 0f); joint.xMotion = (ConfigurableJointMotion)0; joint.yMotion = (ConfigurableJointMotion)0; joint.zMotion = (ConfigurableJointMotion)0; joint.angularXMotion = (ConfigurableJointMotion)2; joint.angularYMotion = (ConfigurableJointMotion)1; joint.angularZMotion = (ConfigurableJointMotion)1; JointDrive val = default(JointDrive); ((JointDrive)(ref val)).positionSpring = spring_strength; ((JointDrive)(ref val)).positionDamper = spring_dampening; JointDrive angularYZDrive = joint.angularYZDrive; ((JointDrive)(ref val)).maximumForce = ((JointDrive)(ref angularYZDrive)).maximumForce; joint.angularXDrive = val; joint.angularYZDrive = val; SoftJointLimit val2 = default(SoftJointLimit); ((SoftJointLimit)(ref val2)).limit = angleLimit; SoftJointLimit angularYLimit = joint.angularYLimit; ((SoftJointLimit)(ref val2)).bounciness = ((SoftJointLimit)(ref angularYLimit)).bounciness; angularYLimit = joint.angularYLimit; ((SoftJointLimit)(ref val2)).contactDistance = ((SoftJointLimit)(ref angularYLimit)).contactDistance; joint.angularYLimit = val2; joint.angularZLimit = val2; } } namespace UnityEngine { public static class UnityEngineEx { public static T GetComponentInDirectChildren<T>(this Component parent) where T : Component { return parent.GetComponentInDirectChildren<T>(includeInactive: false); } public static T GetComponentInDirectChildren<T>(this Component parent, bool includeInactive) where T : Component { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown foreach (Transform item in parent.transform) { Transform val = item; if (includeInactive || ((Component)val).gameObject.activeInHierarchy) { T component = ((Component)val).GetComponent<T>(); if ((Object)(object)component != (Object)null) { return component; } } } return default(T); } public static T[] GetComponentsInDirectChildren<T>(this Component parent) where T : Component { return parent.GetComponentsInDirectChildren<T>(includeInactive: false); } public static T[] GetComponentsInDirectChildren<T>(this Component parent, bool includeInactive) where T : Component { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown List<T> list = new List<T>(); foreach (Transform item in parent.transform) { Transform val = item; if (includeInactive || ((Component)val).gameObject.activeInHierarchy) { list.AddRange(((Component)val).GetComponents<T>()); } } return list.ToArray(); } public static T GetComponentInSiblings<T>(this Component sibling) where T : Component { return sibling.GetComponentInSiblings<T>(includeInactive: false); } public static T GetComponentInSiblings<T>(this Component sibling, bool includeInactive) where T : Component { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Transform parent = sibling.transform.parent; if ((Object)(object)parent == (Object)null) { return default(T); } foreach (Transform item in parent) { Transform val = item; if ((includeInactive || ((Component)val).gameObject.activeInHierarchy) && (Object)(object)val != (Object)(object)sibling) { T component = ((Component)val).GetComponent<T>(); if ((Object)(object)component != (Object)null) { return component; } } } return default(T); } public static T[] GetComponentsInSiblings<T>(this Component sibling) where T : Component { return sibling.GetComponentsInSiblings<T>(includeInactive: false); } public static T[] GetComponentsInSiblings<T>(this Component sibling, bool includeInactive) where T : Component { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown Transform parent = sibling.transform.parent; if ((Object)(object)parent == (Object)null) { return null; } List<T> list = new List<T>(); foreach (Transform item in parent) { Transform val = item; if ((includeInactive || ((Component)val).gameObject.activeInHierarchy) && (Object)(object)val != (Object)(object)sibling) { list.AddRange(((Component)val).GetComponents<T>()); } } return list.ToArray(); } public static T GetComponentInDirectParent<T>(this Component child) where T : Component { Transform parent = child.transform.parent; if ((Object)(object)parent == (Object)null) { return default(T); } return ((Component)parent).GetComponent<T>(); } public static T[] GetComponentsInDirectParent<T>(this Component child) where T : Component { Transform parent = child.transform.parent; if ((Object)(object)parent == (Object)null) { return null; } return ((Component)parent).GetComponents<T>(); } } } namespace Rigidbody_JiggleBones { public class JiggleBonesMK2 : MonoBehaviour { public enum Axis { X, Y, Z } public FVRPhysicalObject mainObject; public Transform rootBone; public Rigidbody referenceRigidbody; [Tooltip("Script will ignore these bones and their children when creating joints.")] public List<Transform> boneBlackList; public bool usesSprings = true; public Axis jointAxis = Axis.Y; public float spring_strength; public float spring_dampening; public float twistLimitX; public float angleLimitY; public float angleLimitZ; public List<Collider> addedColliders; public List<Rigidbody> addedRBs; public List<Joint> addedJoints; public List<Joint> rootJoints; public List<Vector3> rootJointsPos; public List<Quaternion> rootJointsRot; public bool useConfigurableJoints = true; public bool hasEndBones = true; [Tooltip("You will want to use this setting for pretty much anything gravity enabled that is only attached on one end. Having all RBs act on gravity gave weird results in testing.")] public bool onlyLastRigidbodyUsesGravity = true; public bool addBasicColliders = true; public float collider_Radius; public Axis colliderAxis = Axis.Y; private bool mainRBWasNull; private bool IsDebug => false; public void Start() { ((Component)referenceRigidbody).gameObject.SetActive(false); FixParenting(); } public void Update() { if (!mainRBWasNull && (Object)(object)mainObject.RootRigidbody == (Object)null) { SetJiggleboneRootRB(FindNewRigidbody(((Component)mainObject).transform.parent)); mainRBWasNull = true; } else if (mainRBWasNull && (Object)(object)mainObject.RootRigidbody != (Object)null) { SetJiggleboneRootRB(mainObject.RootRigidbody); mainRBWasNull = false; } } public void configureJoint(ConfigurableJoint joint, Rigidbody parent) { //IL_0042: 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_007a: 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_00da: 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_0102: 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_0118: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //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_0160: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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_0239: Unknown result type (might be due to invalid IL or missing references) ((Joint)joint).enablePreprocessing = false; joint.projectionMode = (JointProjectionMode)1; ((Joint)joint).connectedBody = parent; switch (jointAxis) { case Axis.X: ((Joint)joint).axis = new Vector3(1f, 0f, 0f); break; case Axis.Y: ((Joint)joint).axis = new Vector3(0f, 1f, 0f); break; case Axis.Z: ((Joint)joint).axis = new Vector3(0f, 0f, 1f); break; } ((Joint)joint).anchor = Vector3.zero; joint.xMotion = (ConfigurableJointMotion)0; joint.yMotion = (ConfigurableJointMotion)0; joint.zMotion = (ConfigurableJointMotion)0; if (usesSprings) { joint.angularXMotion = (ConfigurableJointMotion)1; joint.angularYMotion = (ConfigurableJointMotion)1; joint.angularZMotion = (ConfigurableJointMotion)1; } else { joint.angularXMotion = (ConfigurableJointMotion)2; joint.angularYMotion = (ConfigurableJointMotion)2; joint.angularZMotion = (ConfigurableJointMotion)2; } JointDrive val = default(JointDrive); ((JointDrive)(ref val)).positionSpring = spring_strength; ((JointDrive)(ref val)).positionDamper = spring_dampening; JointDrive angularYZDrive = joint.angularYZDrive; ((JointDrive)(ref val)).maximumForce = ((JointDrive)(ref angularYZDrive)).maximumForce; joint.angularXDrive = val; joint.angularYZDrive = val; SoftJointLimit highAngularXLimit = default(SoftJointLimit); ((SoftJointLimit)(ref highAngularXLimit)).limit = twistLimitX; SoftJointLimit val2 = joint.highAngularXLimit; ((SoftJointLimit)(ref highAngularXLimit)).bounciness = ((SoftJointLimit)(ref val2)).bounciness; val2 = joint.highAngularXLimit; ((SoftJointLimit)(ref highAngularXLimit)).contactDistance = ((SoftJointLimit)(ref val2)).contactDistance; joint.highAngularXLimit = highAngularXLimit; SoftJointLimit lowAngularXLimit = default(SoftJointLimit); ((SoftJointLimit)(ref lowAngularXLimit)).limit = 0f - twistLimitX; val2 = joint.lowAngularXLimit; ((SoftJointLimit)(ref lowAngularXLimit)).bounciness = ((SoftJointLimit)(ref val2)).bounciness; val2 = joint.lowAngularXLimit; ((SoftJointLimit)(ref lowAngularXLimit)).contactDistance = ((SoftJointLimit)(ref val2)).contactDistance; joint.lowAngularXLimit = lowAngularXLimit; SoftJointLimit angularYLimit = default(SoftJointLimit); ((SoftJointLimit)(ref angularYLimit)).limit = angleLimitY; val2 = joint.angularYLimit; ((SoftJointLimit)(ref angularYLimit)).bounciness = ((SoftJointLimit)(ref val2)).bounciness; val2 = joint.angularYLimit; ((SoftJointLimit)(ref angularYLimit)).contactDistance = ((SoftJointLimit)(ref val2)).contactDistance; joint.angularYLimit = angularYLimit; SoftJointLimit angularZLimit = default(SoftJointLimit); ((SoftJointLimit)(ref angularZLimit)).limit = angleLimitZ; val2 = joint.angularZLimit; ((SoftJointLimit)(ref angularZLimit)).bounciness = ((SoftJointLimit)(ref val2)).bounciness; val2 = joint.angularZLimit; ((SoftJointLimit)(ref angularZLimit)).contactDistance = ((SoftJointLimit)(ref val2)).contactDistance; joint.angularZLimit = angularZLimit; } public void configureJoint(CharacterJoint joint, Rigidbody parent) { //IL_003b: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) ((Joint)joint).enablePreprocessing = false; ((Joint)joint).connectedBody = parent; switch (jointAxis) { case Axis.X: ((Joint)joint).axis = new Vector3(1f, 0f, 0f); break; case Axis.Y: ((Joint)joint).axis = new Vector3(0f, 1f, 0f); break; case Axis.Z: ((Joint)joint).axis = new Vector3(0f, 0f, 1f); break; } ((Joint)joint).anchor = Vector3.zero; SoftJointLimitSpring val = default(SoftJointLimitSpring); ((SoftJointLimitSpring)(ref val)).spring = spring_strength; ((SoftJointLimitSpring)(ref val)).damper = spring_dampening; joint.twistLimitSpring = val; joint.swingLimitSpring = val; SoftJointLimit lowTwistLimit = default(SoftJointLimit); ((SoftJointLimit)(ref lowTwistLimit)).limit = 0.1f; SoftJointLimit val2 = joint.lowTwistLimit; ((SoftJointLimit)(ref lowTwistLimit)).bounciness = ((SoftJointLimit)(ref val2)).bounciness; val2 = joint.lowTwistLimit; ((SoftJointLimit)(ref lowTwistLimit)).contactDistance = ((SoftJointLimit)(ref val2)).contactDistance; joint.lowTwistLimit = lowTwistLimit; SoftJointLimit highTwistLimit = default(SoftJointLimit); ((SoftJointLimit)(ref highTwistLimit)).limit = -0.1f; val2 = joint.highTwistLimit; ((SoftJointLimit)(ref highTwistLimit)).bounciness = ((SoftJointLimit)(ref val2)).bounciness; val2 = joint.highTwistLimit; ((SoftJointLimit)(ref highTwistLimit)).contactDistance = ((SoftJointLimit)(ref val2)).contactDistance; joint.highTwistLimit = highTwistLimit; SoftJointLimit val3 = default(SoftJointLimit); ((SoftJointLimit)(ref val3)).limit = 0.1f; val2 = joint.swing1Limit; ((SoftJointLimit)(ref val3)).bounciness = ((SoftJointLimit)(ref val2)).bounciness; val2 = joint.swing1Limit; ((SoftJointLimit)(ref val3)).contactDistance = ((SoftJointLimit)(ref val2)).contactDistance; joint.swing1Limit = val3; joint.swing2Limit = val3; } private bool CreateJointsOnChildren(Transform parent, Rigidbody connectedRB) { //IL_00e7: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_013d: 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_0151: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) Transform[] componentsInDirectChildren = ((Component)(object)parent).GetComponentsInDirectChildren<Transform>(); if (componentsInDirectChildren.Length == 0) { return false; } Transform[] array = componentsInDirectChildren; foreach (Transform val in array) { if (boneBlackList.Contains(val) || (Object)(object)((Component)val).GetComponent<Collider>() != (Object)null || (val.childCount <= 0 && hasEndBones)) { continue; } Rigidbody val2 = ((Component)val).gameObject.AddComponent<Rigidbody>(); CopyRigidBody(val2); if (onlyLastRigidbodyUsesGravity) { val2.useGravity = false; } addedRBs.Add(val2); if (useConfigurableJoints) { ConfigurableJoint val3 = ((Component)val).gameObject.AddComponent<ConfigurableJoint>(); configureJoint(val3, connectedRB); addedJoints.Add((Joint)(object)val3); } else { CharacterJoint val4 = ((Component)val).gameObject.AddComponent<CharacterJoint>(); configureJoint(val4, connectedRB); addedJoints.Add((Joint)(object)val4); } Transform[] componentsInDirectChildren2 = ((Component)(object)val).GetComponentsInDirectChildren<Transform>(); if (componentsInDirectChildren2.Length == 1) { val2.centerOfMass = componentsInDirectChildren2[0].localPosition; } if (addBasicColliders) { for (int j = 0; j < componentsInDirectChildren2.Length; j++) { GameObject val5 = new GameObject(((Object)val).name + "_Collider_" + j); val5.transform.SetParent(val); val5.transform.position = Vector3.Lerp(val.position, componentsInDirectChildren2[j].position, 0.5f); val5.transform.localRotation = Quaternion.identity; CapsuleCollider val6 = val5.gameObject.AddComponent<CapsuleCollider>(); val6.direction = (int)colliderAxis; val6.radius = collider_Radius; val6.height = Vector3.Distance(val.position, componentsInDirectChildren2[j].position); addedColliders.Add((Collider)(object)val6); } } if (onlyLastRigidbodyUsesGravity) { bool flag = true; Transform[] array2 = componentsInDirectChildren2; for (int k = 0; k < array2.Length; k++) { if ((Object)(object)((Component)array2[k]).GetComponent<Collider>() == (Object)null) { flag = false; } } if (flag && referenceRigidbody.useGravity) { val2.useGravity = true; } } CreateJointsOnChildren(val, val2); } return true; } private Rigidbody FindNewRigidbody(Transform parent) { if ((Object)(object)parent == (Object)null) { Debug.LogError((object)"Couldn't find new Rigidbody to connect jiggle bones to!"); return null; } Rigidbody component = ((Component)parent).GetComponent<Rigidbody>(); if ((Object)(object)component == (Object)null) { return FindNewRigidbody(parent.parent); } return component; } private void SetJiggleboneRootRB(Rigidbody RB) { DebugMessage(((Object)((Component)RB).gameObject).name); DebugMessage(rootJoints.Count.ToString()); ResetRootJointsTransform(); foreach (Joint rootJoint in rootJoints) { rootJoint.connectedBody = RB; } } private void SetRootJoints() { //IL_0038: 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) rootJoints = new List<Joint>(((Component)(object)rootBone).GetComponentsInDirectChildren<Joint>()); foreach (Joint rootJoint in rootJoints) { rootJointsPos.Add(((Component)rootJoint).transform.localPosition); rootJointsRot.Add(((Component)rootJoint).transform.localRotation); } } private void ResetRootJointsTransform() { //IL_001c: 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) for (int i = 0; i < rootJoints.Count; i++) { ((Component)rootJoints[i]).transform.localPosition = rootJointsPos[i]; ((Component)rootJoints[i]).transform.localRotation = rootJointsRot[i]; } } private void FixParenting() { foreach (Rigidbody addedRB in addedRBs) { ((Component)addedRB).transform.SetParent(rootBone); } } [ContextMenu("Create JiggleBones")] public void CreateJiggleBones() { ClearJiggleBones(); if (!CreateJointsOnChildren(rootBone, ((Component)mainObject).GetComponent<Rigidbody>())) { Debug.LogError((object)"No Children for JiggleBones found!"); } SetRootJoints(); } [ContextMenu("Clear JiggleBones")] public void ClearJiggleBones() { if (addedColliders == null) { addedColliders = new List<Collider>(); } foreach (Collider addedCollider in addedColliders) { Object.DestroyImmediate((Object)(object)((Component)addedCollider).gameObject); } addedColliders.Clear(); if (addedJoints == null) { addedJoints = new List<Joint>(); } foreach (Joint addedJoint in addedJoints) { Object.DestroyImmediate((Object)(object)addedJoint); } addedJoints.Clear(); if (rootJoints == null) { rootJoints = new List<Joint>(); } foreach (Joint rootJoint in rootJoints) { Object.DestroyImmediate((Object)(object)rootJoint); } rootJoints.Clear(); if (addedRBs == null) { addedRBs = new List<Rigidbody>(); } foreach (Rigidbody addedRB in addedRBs) { Object.DestroyImmediate((Object)(object)addedRB); } addedRBs.Clear(); rootJoints.Clear(); rootJointsPos.Clear(); rootJointsRot.Clear(); } private void DebugMessage(string message) { if (IsDebug) { Debug.Log((object)message); } } private void CopyRigidBody(Rigidbody RB) { //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_007e: Unknown result type (might be due to invalid IL or missing references) RB.mass = referenceRigidbody.mass; RB.drag = referenceRigidbody.drag; RB.angularDrag = referenceRigidbody.angularDrag; RB.useGravity = referenceRigidbody.useGravity; RB.isKinematic = referenceRigidbody.isKinematic; RB.interpolation = referenceRigidbody.interpolation; RB.collisionDetectionMode = referenceRigidbody.collisionDetectionMode; RB.constraints = referenceRigidbody.constraints; } } public static class StaticExtras { public static T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component val = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } return (T)(object)((val is T) ? val : null); } public static T GetCopyOf<T>(this Component target, T reference) where T : Component { Type type = ((object)target).GetType(); if ((object)type != ((object)reference).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite) { try { propertyInfo.SetValue(target, propertyInfo.GetValue(reference, null), null); } catch { } } } FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(target, fieldInfo.GetValue(reference)); } return (T)(object)((target is T) ? target : null); } public static T GetCopyOf<T>(this Object target, T reference) where T : Object { Type type = ((object)target).GetType(); if ((object)type != ((object)reference).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite) { try { propertyInfo.SetValue(target, propertyInfo.GetValue(reference, null), null); } catch { } } } FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(target, fieldInfo.GetValue(reference)); } return (T)(object)((target is T) ? target : null); } } }
plugins/RSC_MagazineFollower.dll
Decompiled 10 months agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RSC_MagazineFollower")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RSC_MagazineFollower")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("78a38910-4f5c-417d-9d32-1f5bf820ba60")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class RSC_MagazineFollower_TubeFedShotgun : FVRInteractiveObject { public enum Axis { x, y, z } [Header("RSC-MagazineFollower Config")] public TubeFedShotgun fireArm; public GameObject magazineReloadTrigger; public Transform follower; public Axis rotationalAxis; public float rotSpeed = 100f; [Tooltip("first entry is Angle when open to load magazine, all following are for the ammount loaded in the magazine, starting with full mag. Last pos is follower with empty mag.")] public float[] rotationalAngles; private bool open = true; private bool lockedSafety; private bool origSafetyPos; private float lastRot; public override void Start() { ((FVRInteractiveObject)this).Start(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!open) { open = true; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)17, 1f); } else { open = false; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)18, 1f); } if (open) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } else if (!open) { magazineReloadTrigger.SetActive(false); if ((Object)(object)((FVRFireArm)fireArm).Magazine == (Object)null) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[rotationalAngles.Length - 1])); } } } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); if (open && !lockedSafety) { origSafetyPos = fireArm.m_isSafetyEngaged; fireArm.m_isSafetyEngaged = true; lockedSafety = true; } else if (open && lockedSafety) { fireArm.m_isSafetyEngaged = true; } else if (!open && lockedSafety) { fireArm.m_isSafetyEngaged = origSafetyPos; lockedSafety = false; } FVRFireArmMagazine magazine = ((FVRFireArm)fireArm).Magazine; if (!open && (Object)(object)((FVRFireArm)fireArm).Magazine != (Object)null) { int numRounds = magazine.m_numRounds; int num = magazine.m_capacity - numRounds + 1; if (lastRot != rotationalAngles[num]) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[num])); } } } private IEnumerator SetFollowerRot(float rot) { bool rotDone = false; lastRot = rot; Quaternion targetRotation = (Quaternion)(rotationalAxis switch { Axis.x => Quaternion.Euler(rot, 0f, 0f), Axis.y => Quaternion.Euler(0f, rot, 0f), Axis.z => Quaternion.Euler(0f, 0f, rot), _ => Quaternion.Euler(0f, 0f, 0f), }); while (!rotDone) { follower.localRotation = Quaternion.RotateTowards(follower.localRotation, targetRotation, rotSpeed * Time.deltaTime); rotDone = follower.localRotation == targetRotation; yield return null; } if (open) { magazineReloadTrigger.SetActive(true); } } } public class RSC_MagazineFollower_BoltAction : FVRInteractiveObject { public enum Axis { x, y, z } [Header("RSC-MagazineFollower Config")] public BoltActionRifle fireArm; public GameObject magazineWell; public GameObject magazineGrabTrigger; public Transform follower; [Tooltip("Index number the safety position is at (starts at 0!).")] public int safetyIndex; public Axis rotationalAxis; public float rotSpeed = 100f; [Tooltip("first entry is Angle when open to load magazine, all following are for the ammount loaded in the magazine, starting with full mag. Last pos is follower with empty mag.")] public float[] rotationalAngles; private bool open = true; private bool lockedSafety; private int origSafetyPos; private float lastRot; public override void Start() { ((FVRInteractiveObject)this).Start(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!open) { open = true; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)17, 1f); } else { open = false; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)18, 1f); } if (open) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } else if (!open) { magazineWell.SetActive(false); magazineGrabTrigger.SetActive(false); if ((Object)(object)((FVRFireArm)fireArm).Magazine == (Object)null) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[rotationalAngles.Length - 1])); } } } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); if (open && !lockedSafety) { origSafetyPos = fireArm.m_fireSelectorMode; fireArm.m_fireSelectorMode = safetyIndex; lockedSafety = true; } else if (open && lockedSafety) { fireArm.m_fireSelectorMode = safetyIndex; } else if (!open && lockedSafety) { fireArm.m_fireSelectorMode = origSafetyPos; lockedSafety = false; } FVRFireArmMagazine magazine = ((FVRFireArm)fireArm).Magazine; if (!open && (Object)(object)((FVRFireArm)fireArm).Magazine != (Object)null) { int numRounds = magazine.m_numRounds; int num = magazine.m_capacity - numRounds + 1; if (lastRot != rotationalAngles[num]) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[num])); } } } private IEnumerator SetFollowerRot(float rot) { bool rotDone = false; lastRot = rot; Quaternion targetRotation = (Quaternion)(rotationalAxis switch { Axis.x => Quaternion.Euler(rot, 0f, 0f), Axis.y => Quaternion.Euler(0f, rot, 0f), Axis.z => Quaternion.Euler(0f, 0f, rot), _ => Quaternion.Euler(0f, 0f, 0f), }); while (!rotDone) { follower.localRotation = Quaternion.RotateTowards(follower.localRotation, targetRotation, rotSpeed * Time.deltaTime); rotDone = follower.localRotation == targetRotation; yield return null; } if (open) { magazineWell.SetActive(true); magazineGrabTrigger.SetActive(true); } } } public class RSC_MagazineFollower : FVRInteractiveObject { public enum Axis { x, y, z } [Header("RSC-MagazineFollower Config")] public ClosedBoltWeapon fireArm; public GameObject magazineWell; public GameObject magazineGrabTrigger; public Transform follower; [Tooltip("Index number the safety position is at (starts at 0!).")] public int safetyIndex; public Axis rotationalAxis; public float rotSpeed = 100f; [Tooltip("first entry is Angle when open to load magazine, all following are for the ammount loaded in the magazine, starting with full mag. Last pos is follower with empty mag.")] public float[] rotationalAngles; private bool open = true; private bool lockedSafety; private int origSafetyPos; private float lastRot; public override void Start() { ((FVRInteractiveObject)this).Start(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!open) { open = true; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)17, 1f); } else { open = false; ((FVRFireArm)fireArm).PlayAudioEvent((FirearmAudioEventType)18, 1f); } if (open) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[0])); } else if (!open) { magazineWell.SetActive(false); magazineGrabTrigger.SetActive(false); if ((Object)(object)((FVRFireArm)fireArm).Magazine == (Object)null) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[rotationalAngles.Length - 1])); } } } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); if (open && !lockedSafety) { origSafetyPos = fireArm.m_fireSelectorMode; fireArm.m_fireSelectorMode = safetyIndex; lockedSafety = true; } else if (open && lockedSafety) { fireArm.m_fireSelectorMode = safetyIndex; } else if (!open && lockedSafety) { fireArm.m_fireSelectorMode = origSafetyPos; lockedSafety = false; } FVRFireArmMagazine magazine = ((FVRFireArm)fireArm).Magazine; if (!open && (Object)(object)((FVRFireArm)fireArm).Magazine != (Object)null) { int numRounds = magazine.m_numRounds; int num = magazine.m_capacity - numRounds + 1; if (lastRot != rotationalAngles[num]) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(SetFollowerRot(rotationalAngles[num])); } } } private IEnumerator SetFollowerRot(float rot) { bool rotDone = false; lastRot = rot; Quaternion targetRotation = (Quaternion)(rotationalAxis switch { Axis.x => Quaternion.Euler(rot, 0f, 0f), Axis.y => Quaternion.Euler(0f, rot, 0f), Axis.z => Quaternion.Euler(0f, 0f, rot), _ => Quaternion.Euler(0f, 0f, 0f), }); while (!rotDone) { follower.localRotation = Quaternion.RotateTowards(follower.localRotation, targetRotation, rotSpeed * Time.deltaTime); rotDone = follower.localRotation == targetRotation; yield return null; } if (open) { magazineWell.SetActive(true); magazineGrabTrigger.SetActive(true); } } }
plugins/ScopeShaderZoom.dll
Decompiled 10 months agousing 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 UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ScopeShaderZoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScopeShaderZoom")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c2023308-edb3-426a-9618-1d88f98ae8a8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo { public class ScopeShaderLinearZoom : MonoBehaviour { public enum Axis { X, Y, Z } [Header("Linear Zoom Scope Config")] [Tooltip("This can be an Attachment interface or an InteractiveObject for integrated scopes.")] public FVRInteractiveObject ScopeInterface; public MeshRenderer ScopeLens; public Camera ScopeCamera; [Header("Zoom Settings")] public float MinZoom = 1f; public float MaxZoom = 6f; [Tooltip("Between 0f and 1f. 0f is MinZoom while 1f is MaxZoom.")] public float ZoomLerp; [Tooltip("If true, Reticle will scale with increasing zoom level.")] public bool ZoomIncreasesReticleMagnification; [Header("Text Screen Settings")] public GameObject CanvasRoot; public Text ZoomText; public Text ZeroText; public Text ElevationText; public Text WindageText; [Tooltip("The existence of this text enables the reticle change functionality.")] public Text ReticleText; public GameObject TextFrame; public string ZoomPrefix = "Zoom: "; public string ZeroPrefix = "Zero Distance: "; public string ElevationPrefix = "Elevation: "; public string WindagePrefix = "Windage: "; [Header("Zeroing System Settings")] public int ZeroDistanceIndex; public List<float> ZeroDistances = new List<float> { 100f, 150f, 200f, 250f, 300f, 350f, 400f, 450f, 500f, 600f, 700f, 800f, 900f, 1000f }; public float ElevationIncreasePerClick = 0.25f; public float WindageIncreasePerClick = 0.25f; [Header("Reticle Change System Settings")] public string ReticlePrefix = "Reticle: "; [Tooltip("All reticle textures. Default reticle is first entry.")] public List<Texture2D> Reticles; [Tooltip("Colors of all reticles. Default reticle name is first entry.")] [ColorUsage(true, true, float.MaxValue, float.MaxValue, 0f, 0f)] public List<Color> ReticleColors; [Tooltip("Names of all reticles. Default reticle name is first entry.")] public string[] ReticleNames; public int CurrentReticle; [Header("Rotating Scope Bit Monitoring Settings")] [Tooltip("Will Monitor this part and adjust the Zoom Lerp accordingly.")] public Transform RotatingBit; [SearchableEnum] public Axis axis; public float MinRotation; public float MaxRotation; [Header("Integrated Scope Settings")] public bool IsIntegrated; public FVRFireArm FireArm; [Header("Optimization Setting. Set to false when done testing for vanilla scope like behavior of showing a black picture when not attached to gun.")] public bool ActiveWithoutMount = true; private bool _hasZoomText; private RenderTexture _renderTexture; private FVRFireArmAttachment _attachment; private float _elevationStep; private float _windageStep; private int _currentMenu; private bool _initialZero; private float _baseReticleSize; private float _zoomFactor; private float _lastZoomLerp; public void Start() { if ((Object)(object)CanvasRoot != (Object)null) { _hasZoomText = true; } else { _hasZoomText = false; } _zoomFactor = Mathf.Lerp(MinZoom, MaxZoom, ZoomLerp); _renderTexture = ScopeCamera.targetTexture; _renderTexture = Object.Instantiate<RenderTexture>(_renderTexture); ScopeCamera.targetTexture = _renderTexture; ((Renderer)ScopeLens).material.mainTexture = (Texture)(object)_renderTexture; if (ZoomIncreasesReticleMagnification) { _baseReticleSize = ((Renderer)ScopeLens).material.GetFloat("_ReticleScale"); } SetZoom(); FVRInteractiveObject scopeInterface = ScopeInterface; FVRFireArmAttachmentInterface val = (FVRFireArmAttachmentInterface)(object)((scopeInterface is FVRFireArmAttachmentInterface) ? scopeInterface : null); if (!IsIntegrated && (Object)(object)val != (Object)null) { _attachment = val.Attachment; } else if (!IsIntegrated) { _attachment = ((Component)this).gameObject.GetComponent<FVRFireArmAttachment>(); } if (!IsIntegrated && (Object)(object)_attachment == (Object)null) { Debug.LogWarning((object)"Attachment not found. Scope zeroing disabled!"); } UpdateMenu(); ScopeEnabled(ActiveWithoutMount); if (IsIntegrated) { Zero(); } if ((Object)(object)ZoomText == (Object)null) { _currentMenu++; if ((Object)(object)ZeroText == (Object)null) { _currentMenu++; if ((Object)(object)ElevationText == (Object)null) { _currentMenu++; if ((Object)(object)WindageText == (Object)null) { _currentMenu = 0; _hasZoomText = false; } } } } if ((Object)(object)ReticleText != (Object)null) { if (CurrentReticle >= Reticles.Count) { CurrentReticle = Reticles.Count - 1; } ChangeReticle(); } _lastZoomLerp = ZoomLerp; } public void OnDestroy() { Object.Destroy((Object)(object)_renderTexture); } public void Update() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0216: 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) FVRViveHand hand = ScopeInterface.m_hand; if (_hasZoomText && (Object)(object)hand != (Object)null) { if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { NextMenu(); } else if (_currentMenu == 0 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { PreviousZero(); } else if (_currentMenu == 0 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { NextZero(); } else if (_currentMenu == 1 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { DecreaseElevationAdjustment(); } else if (_currentMenu == 1 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { IncreaseElevationAdjustment(); } else if (_currentMenu == 2 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { DecreaseWindageAdjustment(); } else if (_currentMenu == 2 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { IncreaseWindageAdjustment(); } else if (_currentMenu == 3 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { PreviousReticle(); } else if (_currentMenu == 3 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { NextReticle(); } CanvasRoot.gameObject.SetActive(true); } else if (_hasZoomText) { CanvasRoot.gameObject.SetActive(false); } if (!ActiveWithoutMount) { if ((Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount != (Object)null) { ScopeEnabled(state: true); } else if ((Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount == (Object)null) { ScopeEnabled(state: false); } else { ScopeEnabled(state: true); } } if (!_initialZero && (Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount != (Object)null) { Zero(); _initialZero = true; } else if (_initialZero && (Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount == (Object)null) { Zero(); _initialZero = false; } else if (!_initialZero && IsIntegrated) { Zero(); _initialZero = true; } SetZoomLerp(); SetZoom(); } public void SetZoomLerp() { //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) Vector3 localEulerAngles = RotatingBit.localEulerAngles; float num = ((Vector3)(ref localEulerAngles))[(int)axis]; ZoomLerp = Mathf.InverseLerp(MinRotation, MaxRotation, num); } public void SetZoom() { _zoomFactor = Mathf.Lerp(MinZoom, MaxZoom, ZoomLerp); float fieldOfView = 53.6f * Mathf.Pow(_zoomFactor, -0.9364f) - 0.3666f; ScopeCamera.fieldOfView = fieldOfView; if (ZoomIncreasesReticleMagnification) { ((Renderer)ScopeLens).material.SetFloat("_ReticleScale", _baseReticleSize * _zoomFactor / MinZoom); } } public void NextZero() { if (ZeroDistanceIndex < ZeroDistances.Count - 1) { ZeroDistanceIndex++; Zero(); UpdateMenu(); } } public void PreviousZero() { if (ZeroDistanceIndex > 0) { ZeroDistanceIndex--; Zero(); UpdateMenu(); } } public void IncreaseElevationAdjustment() { _elevationStep += ElevationIncreasePerClick; Zero(); UpdateMenu(); } public void DecreaseElevationAdjustment() { _elevationStep -= ElevationIncreasePerClick; Zero(); UpdateMenu(); } public void IncreaseWindageAdjustment() { _windageStep += WindageIncreasePerClick; Zero(); UpdateMenu(); } public void DecreaseWindageAdjustment() { _windageStep -= WindageIncreasePerClick; Zero(); UpdateMenu(); } public void NextReticle() { CurrentReticle++; if (CurrentReticle >= Reticles.Count) { CurrentReticle = 0; } ChangeReticle(); UpdateMenu(); } public void PreviousReticle() { CurrentReticle--; if (CurrentReticle <= 0) { CurrentReticle = Reticles.Count - 1; } ChangeReticle(); UpdateMenu(); } public void NextMenu() { if ((Object)(object)ZoomText == (Object)null && (Object)(object)ZeroText == (Object)null && (Object)(object)ElevationText == (Object)null && (Object)(object)WindageText == (Object)null) { return; } _currentMenu++; if (_currentMenu >= 4) { _currentMenu = 0; } switch (_currentMenu) { case 0: if ((Object)(object)ZeroText == (Object)null) { NextMenu(); return; } break; case 1: if ((Object)(object)ElevationText == (Object)null) { NextMenu(); return; } break; case 2: if ((Object)(object)WindageText == (Object)null) { NextMenu(); return; } break; case 3: if ((Object)(object)ReticleText == (Object)null) { NextMenu(); return; } break; } UpdateMenu(); } public void UpdateMenu() { //IL_005e: 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_00ca: 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_012a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TextFrame != (Object)null) { switch (_currentMenu) { case 0: if (!((Object)(object)ZoomText == (Object)null)) { TextFrame.transform.position = ((Component)ZoomText).transform.position; } break; case 1: if (!((Object)(object)ZeroText == (Object)null)) { TextFrame.transform.position = ((Component)ZeroText).transform.position; } break; case 2: if (!((Object)(object)ElevationText == (Object)null)) { TextFrame.transform.position = ((Component)ElevationText).transform.position; } break; case 3: if (!((Object)(object)WindageText == (Object)null)) { TextFrame.transform.position = ((Component)WindageText).transform.position; } break; case 4: if (!((Object)(object)ReticleText == (Object)null)) { TextFrame.transform.position = ((Component)ReticleText).transform.position; } break; } } if ((Object)(object)ZoomText != (Object)null) { ZoomText.text = ZoomPrefix + _zoomFactor + "x"; } if ((Object)(object)ZeroText != (Object)null) { ZeroText.text = ZeroPrefix + ZeroDistances[ZeroDistanceIndex] + "m"; } if ((Object)(object)ElevationText != (Object)null) { ElevationText.text = ElevationPrefix + _elevationStep + " MOA"; } if ((Object)(object)WindageText != (Object)null) { WindageText.text = WindagePrefix + _windageStep + " MOA"; } if ((Object)(object)ReticleText != (Object)null) { ReticleText.text = ReticlePrefix + ReticleNames[CurrentReticle]; } } public void Zero() { //IL_024e: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0152: 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_015c: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (IsIntegrated || ((Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount != (Object)null && (Object)(object)_attachment.curMount.Parent != (Object)null && _attachment.curMount.Parent is FVRFireArm)) { if (!IsIntegrated) { ref FVRFireArm fireArm = ref FireArm; FVRPhysicalObject parent = _attachment.curMount.Parent; fireArm = (FVRFireArm)(object)((parent is FVRFireArm) ? parent : null); } if (IsIntegrated && (Object)(object)FireArm == (Object)null) { Debug.LogError((object)"ScopeShaderZoom: FireArm not set on integrated Scope! Can't zero sight!"); } FireArmRoundType roundType = FireArm.RoundType; float num = ZeroDistances[ZeroDistanceIndex]; float num2 = 0f; if (AM.SRoundDisplayDataDic.ContainsKey(roundType)) { num2 = AM.SRoundDisplayDataDic[roundType].BulletDropCurve.Evaluate(num * 0.001f); } Vector3 val = FireArm.MuzzlePos.position + FireArm.GetMuzzle().forward * num + FireArm.GetMuzzle().up * num2; Vector3 val2 = Vector3.ProjectOnPlane(val - ((Component)this).transform.forward, ((Component)this).transform.right); Vector3 val3 = Quaternion.AngleAxis(_elevationStep / 60f, ((Component)this).transform.right) * val2; _ = Quaternion.AngleAxis(_windageStep / 60f, ((Component)this).transform.up) * val3; Vector3 val4 = Vector3.ProjectOnPlane(val, ((Component)this).transform.right) + Vector3.Dot(((Component)this).transform.position, ((Component)this).transform.right) * ((Component)this).transform.right; ((Component)ScopeCamera).transform.LookAt(val4, ((Component)this).transform.up); Transform transform = ((Component)ScopeCamera).transform; transform.localEulerAngles += new Vector3((0f - _elevationStep) / 60f, _windageStep / 60f, 0f); } else { ((Component)ScopeCamera).transform.localRotation = Quaternion.identity; } } public void ScopeEnabled(bool state) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (state) { ((Component)ScopeCamera).gameObject.SetActive(true); return; } ((Component)ScopeCamera).gameObject.SetActive(false); RenderTexture.active = _renderTexture; GL.Clear(false, true, Color.black); RenderTexture.active = null; } private void ChangeReticle() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) ((Renderer)ScopeLens).material.SetColor("_ReticleColor", ReticleColors[CurrentReticle]); ((Renderer)ScopeLens).material.SetTexture("_ReticleTex", (Texture)(object)Reticles[CurrentReticle]); } } public class ScopeShaderZoom : MonoBehaviour { public enum Axis { x, y, z } public FVRInteractiveObject AttachmentInterface; public MeshRenderer scopeLens; public Camera camera; public int currentZoomIndex; public List<float> ZoomFactor; public bool doesZoomAffectReticle; [Header("If you want a Screen above the scope that shows the current Settings, use these:")] public GameObject canvas; public Text text; public Text zeroText; public Text elevationText; public Text windageText; [Tooltip("The existence of this text enables the reticle change functionality")] public Text reticleText; public GameObject textFrame; public string zoomPrefix = "Zoom: "; public string zeroPrefix = "Zero Distance: "; public string elevationPrefix = "Elevation: "; public string windagePrefix = "Windage: "; public string reticlePrefix = "Reticle: "; public int ZeroDistanceIndex; public List<float> ZeroDistances = new List<float> { 100f, 150f, 200f, 250f, 300f, 350f, 400f, 450f, 500f, 600f, 700f, 800f, 900f, 1000f }; public float elevationIncreasePerClick = 0.5f; public float windageIncreasePerClick = 0.5f; [Header("Optimization Setting. Set to false when done testing for vanilla scope like behavior of showing a black picture when not attached to gun.")] public bool activeWithoutMount = true; [Header("Rotating Scope Bit")] public bool hasRotatingBit; public Transform rotatingBit; [SearchableEnum] public Axis axis; [Tooltip("Needs to be same length as zoom levels or it will break!")] public float[] rotationAngles; [Header("Integrated Scope Settings")] public bool isIntegrated; public FVRFireArm firearm; [Header("Reticle Change Settings")] [Tooltip("All reticle textures. Default reticle is first entry.")] public List<Texture2D> reticles; [Tooltip("Colors of all reticles. Default reticle name is first entry.")] public List<Color> reticleColors; [ColorUsage(true, true, float.MaxValue, float.MaxValue, 0f, 0f)] [Tooltip("Names of all reticles. Default reticle name is first entry.")] public string[] reticleName; public int currentReticle; [Tooltip("This enables the very specialized reticle change system.")] public bool doesEachZoomFactorHaveOwnReticle; [Tooltip("Starts with default reticle, than all default reticle variants for the following zoom levels. Next entries are additional reticles and their according zoom levels, all ordered by zoom level and grouped by reticle type.")] public List<Texture2D> additionalReticlesPerZoomLevel; private List<float> _correspondingCameraFOV; private bool _hasZoomText; private RenderTexture _renderTexture; private FVRFireArmAttachment _attachment; private float _elevationStep; private float _windageStep; private int _currentMenu; private bool _initialZero; private float _baseReticleSize; public void Start() { _correspondingCameraFOV = new List<float>(); if ((Object)(object)canvas != (Object)null) { _hasZoomText = true; } else { _hasZoomText = false; } for (int i = 0; i < ZoomFactor.Count; i++) { float item = 53.6f * Mathf.Pow(ZoomFactor[i], -0.9364f) - 0.3666f; _correspondingCameraFOV.Add(item); } _renderTexture = camera.targetTexture; _renderTexture = Object.Instantiate<RenderTexture>(_renderTexture); ((Texture)_renderTexture).width = OpenScripts_BepInEx.ScopeResolution.Value; ((Texture)_renderTexture).height = OpenScripts_BepInEx.ScopeResolution.Value; camera.targetTexture = _renderTexture; ((Renderer)scopeLens).material.mainTexture = (Texture)(object)_renderTexture; if (doesZoomAffectReticle) { _baseReticleSize = ((Renderer)scopeLens).material.GetFloat("_ReticleScale"); } SetZoom(); FVRInteractiveObject attachmentInterface = AttachmentInterface; FVRFireArmAttachmentInterface val = (FVRFireArmAttachmentInterface)(object)((attachmentInterface is FVRFireArmAttachmentInterface) ? attachmentInterface : null); if (!isIntegrated && (Object)(object)val != (Object)null) { _attachment = val.Attachment; } else if (!isIntegrated) { _attachment = ((Component)this).gameObject.GetComponent<FVRFireArmAttachment>(); } if (!isIntegrated && (Object)(object)_attachment == (Object)null) { Debug.LogWarning((object)"Attachment not found. Scope zeroing disabled!"); } UpdateMenu(); ScopeEnabled(activeWithoutMount); if (isIntegrated) { Zero(); } if ((Object)(object)text == (Object)null) { _currentMenu++; if ((Object)(object)zeroText == (Object)null) { _currentMenu++; if ((Object)(object)elevationText == (Object)null) { _currentMenu++; if ((Object)(object)windageText == (Object)null) { _currentMenu = 0; _hasZoomText = false; } } } } if ((Object)(object)reticleText != (Object)null || doesEachZoomFactorHaveOwnReticle) { if (currentReticle >= reticles.Count && reticles.Count != 0) { currentReticle = reticles.Count - 1; } ChangeReticle(); } } public void OnDestroy() { Object.Destroy((Object)(object)_renderTexture); } public void Update() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) FVRViveHand hand = AttachmentInterface.m_hand; if (_hasZoomText && (Object)(object)hand != (Object)null) { if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { NextMenu(); } else if (_currentMenu == 0 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { PreviousZoom(); } else if (_currentMenu == 0 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { NextZoom(); } else if (_currentMenu == 1 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { PreviousZero(); } else if (_currentMenu == 1 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { NextZero(); } else if (_currentMenu == 2 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { DecreaseElevationAdjustment(); } else if (_currentMenu == 2 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { IncreaseElevationAdjustment(); } else if (_currentMenu == 3 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { DecreaseWindageAdjustment(); } else if (_currentMenu == 3 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { IncreaseWindageAdjustment(); } else if (_currentMenu == 4 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { PreviousReticle(); } else if (_currentMenu == 4 && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { NextReticle(); } canvas.gameObject.SetActive(true); } else if (_hasZoomText) { canvas.gameObject.SetActive(false); } if (!activeWithoutMount) { if ((Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount != (Object)null) { ScopeEnabled(state: true); } else if ((Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount == (Object)null) { ScopeEnabled(state: false); } else { ScopeEnabled(state: true); } } if (!_initialZero && (Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount != (Object)null) { Zero(); _initialZero = true; } else if (_initialZero && (Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount == (Object)null) { Zero(); _initialZero = false; } else if (!_initialZero && isIntegrated) { Zero(); _initialZero = true; } } public void NextZoom() { if (currentZoomIndex < ZoomFactor.Count - 1) { currentZoomIndex++; SetZoom(); if (doesEachZoomFactorHaveOwnReticle) { ChangeReticle(); } UpdateMenu(); } } public void PreviousZoom() { if (currentZoomIndex > 0) { currentZoomIndex--; SetZoom(); if (doesEachZoomFactorHaveOwnReticle) { ChangeReticle(); } UpdateMenu(); } } public void SetZoom() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00e9: 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) //IL_0102: Unknown result type (might be due to invalid IL or missing references) camera.fieldOfView = _correspondingCameraFOV[currentZoomIndex]; if (doesZoomAffectReticle) { ((Renderer)scopeLens).material.SetFloat("_ReticleScale", _baseReticleSize * ZoomFactor[currentZoomIndex] / ZoomFactor[0]); } if (hasRotatingBit) { Vector3 localEulerAngles = rotatingBit.localEulerAngles; switch (axis) { case Axis.x: rotatingBit.localEulerAngles = new Vector3(rotationAngles[currentZoomIndex], localEulerAngles.y, localEulerAngles.z); break; case Axis.y: rotatingBit.localEulerAngles = new Vector3(localEulerAngles.x, rotationAngles[currentZoomIndex], localEulerAngles.z); break; case Axis.z: rotatingBit.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles.y, rotationAngles[currentZoomIndex]); break; } } } public void NextZero() { if (ZeroDistanceIndex < ZeroDistances.Count - 1) { ZeroDistanceIndex++; Zero(); UpdateMenu(); } } public void PreviousZero() { if (ZeroDistanceIndex > 0) { ZeroDistanceIndex--; Zero(); UpdateMenu(); } } public void IncreaseElevationAdjustment() { _elevationStep += elevationIncreasePerClick; Zero(); UpdateMenu(); } public void DecreaseElevationAdjustment() { _elevationStep -= elevationIncreasePerClick; Zero(); UpdateMenu(); } public void IncreaseWindageAdjustment() { _windageStep += windageIncreasePerClick; Zero(); UpdateMenu(); } public void DecreaseWindageAdjustment() { _windageStep -= windageIncreasePerClick; Zero(); UpdateMenu(); } public void NextReticle() { currentReticle++; if (currentReticle >= reticles.Count) { currentReticle = 0; } ChangeReticle(); UpdateMenu(); } public void PreviousReticle() { currentReticle--; if (currentReticle <= 0) { currentReticle = reticles.Count - 1; } ChangeReticle(); UpdateMenu(); } public void NextMenu() { if ((Object)(object)text == (Object)null && (Object)(object)zeroText == (Object)null && (Object)(object)elevationText == (Object)null && (Object)(object)windageText == (Object)null) { return; } _currentMenu++; if (_currentMenu >= 5) { _currentMenu = 0; } switch (_currentMenu) { case 0: if ((Object)(object)text == (Object)null) { NextMenu(); return; } break; case 1: if ((Object)(object)zeroText == (Object)null) { NextMenu(); return; } break; case 2: if ((Object)(object)elevationText == (Object)null) { NextMenu(); return; } break; case 3: if ((Object)(object)windageText == (Object)null) { NextMenu(); return; } break; case 4: if ((Object)(object)reticleText == (Object)null) { NextMenu(); return; } break; } UpdateMenu(); } public void UpdateMenu() { //IL_005e: 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_00ca: 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_012a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textFrame != (Object)null) { switch (_currentMenu) { case 0: if (!((Object)(object)text == (Object)null)) { textFrame.transform.position = ((Component)text).transform.position; } break; case 1: if (!((Object)(object)zeroText == (Object)null)) { textFrame.transform.position = ((Component)zeroText).transform.position; } break; case 2: if (!((Object)(object)elevationText == (Object)null)) { textFrame.transform.position = ((Component)elevationText).transform.position; } break; case 3: if (!((Object)(object)windageText == (Object)null)) { textFrame.transform.position = ((Component)windageText).transform.position; } break; case 4: if (!((Object)(object)reticleText == (Object)null)) { textFrame.transform.position = ((Component)reticleText).transform.position; } break; } } if ((Object)(object)text != (Object)null) { text.text = zoomPrefix + ZoomFactor[currentZoomIndex] + "x"; } if ((Object)(object)zeroText != (Object)null) { zeroText.text = zeroPrefix + ZeroDistances[ZeroDistanceIndex] + "m"; } if ((Object)(object)elevationText != (Object)null) { elevationText.text = elevationPrefix + _elevationStep + " MOA"; } if ((Object)(object)windageText != (Object)null) { windageText.text = windagePrefix + _windageStep + " MOA"; } if ((Object)(object)reticleText != (Object)null) { reticleText.text = reticlePrefix + reticleName[currentReticle]; } } public void Zero() { //IL_024e: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0152: 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_015c: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (isIntegrated || ((Object)(object)_attachment != (Object)null && (Object)(object)_attachment.curMount != (Object)null && (Object)(object)_attachment.curMount.Parent != (Object)null && _attachment.curMount.Parent is FVRFireArm)) { if (!isIntegrated) { ref FVRFireArm reference = ref firearm; FVRPhysicalObject parent = _attachment.curMount.Parent; reference = (FVRFireArm)(object)((parent is FVRFireArm) ? parent : null); } if (isIntegrated && (Object)(object)firearm == (Object)null) { Debug.LogError((object)"ScopeShaderZoom: FireArm not set on integrated Scope! Can't zero sight!"); } FireArmRoundType roundType = firearm.RoundType; float num = ZeroDistances[ZeroDistanceIndex]; float num2 = 0f; if (AM.SRoundDisplayDataDic.ContainsKey(roundType)) { num2 = AM.SRoundDisplayDataDic[roundType].BulletDropCurve.Evaluate(num * 0.001f); } Vector3 val = firearm.MuzzlePos.position + firearm.GetMuzzle().forward * num + firearm.GetMuzzle().up * num2; Vector3 val2 = Vector3.ProjectOnPlane(val - ((Component)this).transform.forward, ((Component)this).transform.right); Vector3 val3 = Quaternion.AngleAxis(_elevationStep / 60f, ((Component)this).transform.right) * val2; _ = Quaternion.AngleAxis(_windageStep / 60f, ((Component)this).transform.up) * val3; Vector3 val4 = Vector3.ProjectOnPlane(val, ((Component)this).transform.right) + Vector3.Dot(((Component)this).transform.position, ((Component)this).transform.right) * ((Component)this).transform.right; ((Component)camera).transform.LookAt(val4, ((Component)this).transform.up); Transform transform = ((Component)camera).transform; transform.localEulerAngles += new Vector3((0f - _elevationStep) / 60f, _windageStep / 60f, 0f); } else { ((Component)camera).transform.localRotation = Quaternion.identity; } } public void ScopeEnabled(bool state) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (state) { ((Component)camera).gameObject.SetActive(true); return; } ((Component)camera).gameObject.SetActive(false); RenderTexture.active = _renderTexture; GL.Clear(false, true, Color.black); RenderTexture.active = null; } private void ChangeReticle() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!doesEachZoomFactorHaveOwnReticle) { ((Renderer)scopeLens).material.SetColor("_ReticleColor", reticleColors[currentReticle]); ((Renderer)scopeLens).material.SetTexture("_ReticleTex", (Texture)(object)reticles[currentReticle]); } else { ((Renderer)scopeLens).material.SetColor("_ReticleColor", reticleColors[currentReticle]); ((Renderer)scopeLens).material.SetTexture("_ReticleTex", (Texture)(object)additionalReticlesPerZoomLevel[currentZoomIndex + currentReticle * ZoomFactor.Count]); } } } } namespace Cityrobo.AndrewFTW { [Obsolete("ScopeZoomRotate is deprecated, please use ScopeShaderZoom instead.")] public class ScopeZoomRotate : MonoBehaviour { public enum Axis { x, y, z } public FVRInteractiveObject AttachmentInterface; public MeshRenderer scopeLens; public Camera camera; public List<float> ZoomFactor; public int currentZoomIndex; [Header("Rotation deatails")] public List<float> Rotation; public Axis axis; 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 bool hasZoomText; private RenderTexture renderTexture; public void Start() { CorrespondingCameraFOV = new List<float>(); if ((Object)(object)text != (Object)null && (Object)(object)canvas != (Object)null) { hasZoomText = true; } else { hasZoomText = false; } for (int i = 0; i < ZoomFactor.Count; i++) { float item = 53.6f * Mathf.Pow(ZoomFactor[i], -0.9364f) - 0.3666f; CorrespondingCameraFOV.Add(item); } renderTexture = camera.targetTexture; renderTexture = Object.Instantiate<RenderTexture>(renderTexture); camera.targetTexture = renderTexture; ((Renderer)scopeLens).material.mainTexture = (Texture)(object)renderTexture; SetZoom(); } public void OnDestroy() { Object.Destroy((Object)(object)renderTexture); } 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) { currentZoomIndex++; SetZoom(); } } public void PreviousZoom() { if (currentZoomIndex != 0) { currentZoomIndex--; SetZoom(); } } public void SetZoom() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Vector3 localEulerAngles = default(Vector3); switch (axis) { case Axis.x: ((Vector3)(ref localEulerAngles))..ctor(Rotation[currentZoomIndex], 0f, 0f); break; case Axis.y: ((Vector3)(ref localEulerAngles))..ctor(0f, Rotation[currentZoomIndex], 0f); break; case Axis.z: ((Vector3)(ref localEulerAngles))..ctor(0f, 0f, Rotation[currentZoomIndex]); break; default: localEulerAngles = default(Vector3); break; } ObjectToRotate.transform.localEulerAngles = localEulerAngles; camera.fieldOfView = CorrespondingCameraFOV[currentZoomIndex]; } public void ChangeElevation() { } } }
plugins/ShotClock.dll
Decompiled 10 months agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using FistVR; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ShotClock")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShotClock")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("482774e1-636f-4058-9a5a-f581c4c8b4a2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace ShotTimer; public class ClockMenu : TimerMenu { [Header("Time")] [SerializeField] private Text _timeText; [SerializeField] private string _timeFormat = "hh:mm:sstt"; [SerializeField] private TimerMenu next; private void RenderTime() { _timeText.text = DateTime.Now.ToString(_timeFormat); } public override void Render() { RenderTime(); } public override bool UpdateInputs(Inputs inputs, out TimerMenu menu) { switch (inputs) { case Inputs.MenuUp: menu = next; return true; case Inputs.Start: base.Timer.Nut(); menu = null; return true; default: menu = null; return false; } } public override void Activate(TimerMenu next) { ((Component)next).gameObject.SetActive(true); ((MonoBehaviour)this).StopAllCoroutines(); ((Component)this).gameObject.SetActive(false); } public IEnumerator Run() { do { Render(); yield return null; } while (((Behaviour)this).enabled); } private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("Run"); } } [Flags] public enum Inputs { MenuUp = 1, MenuDown = 2, SetUp = 4, SetDown = 8, Start = 0x10 } public static class ExtInputs { public static Inputs Encode(this Inputs @this, bool v) { if (!v) { return (Inputs)0; } return @this; } public static bool Decode(this Inputs @this, Inputs flag) { return (@this & flag) == flag; } } public class OverflowArray<T> { private readonly T[] _buffer; private int _cursor; public readonly int Capacity; public int Count { get; private set; } public T this[int index] { get { if (index >= Count) { throw new IndexOutOfRangeException(); } return _buffer[index % Capacity]; } private set { _buffer[index % Capacity] = value; } } public OverflowArray(int size) { _buffer = new T[size]; Capacity = size; } public void Add(T value) { this[_cursor++] = value; if (Count < Capacity) { int count = Count + 1; Count = count; } } public void Clear() { _cursor = 0; Count = 0; } private bool TryGet(Func<int, int> index, out T value) { if (Count > 0) { value = this[index(Count)]; return true; } value = default(T); return false; } public bool TryGetFirst(out T value) { return TryGet((int _) => 0, out value); } public bool TryGetLast(out T value) { return TryGet((int c) => c - 1, out value); } } [Serializable] public class PaddingSettings { public char Character; public int Size; public PaddingSettings() : this('_', 2) { } public PaddingSettings(char character, int size) { Character = character; Size = size; } public void Apply(StringBuilder builder, int used) { builder.Append(Character, Size - used); } public void Apply(StringBuilder builder, float n) { Apply(builder, (int)Mathf.Log10(n)); } public string Render(int used) { return new string(Character, Size - used); } public string Render(float n) { return Render((int)Mathf.Log10(n)); } } public class ReviewDirectMenu : TimerMenu { [Header("Last Shot")] [SerializeField] private Text _lastShotText; [SerializeField] private string _lastShotFormat = "{0}{1:F2}"; [SerializeField] private PaddingSettings _lastShotPadding = new PaddingSettings(); [Header("Details")] [SerializeField] private Text _detailsText; [SerializeField] private string _detailsFormat = "SPL {0}{1:F2}\n1st {2}{3:F2}\nDELAY UNKN"; private string delaynone = "SPL {0}{1:F2}\n1st {2}{3:F2}\nDELAY NONE"; private string delayipsc = "SPL {0}{1:F2}\n1st {2}{3:F2}\nDELAY IPSC"; private string delayidpa = "SPL {0}{1:F2}\n1st {2}{3:F2}\nDELAY IDPA"; private string delayissc = "SPL {0}{1:F2}\n1st {2}{3:F2}\nDELAY ISSC"; private string delayonefive = "SPL {0}{1:F2}\n1st {2}{3:F2}\nDELAY 1-5"; private string delayfiveten = "SPL {0}{1:F2}\n1st {2}{3:F2}\nDELAY 5-10"; [SerializeField] private PaddingSettings _splitPadding = new PaddingSettings(); [SerializeField] private PaddingSettings _firstShotPadding = new PaddingSettings(); [Header("Shot Count")] [SerializeField] private Text _shotCountText; [SerializeField] private string _shotCountFormatting = "SHOT # {0}{1}"; [SerializeField] private PaddingSettings _shotCountPadding = new PaddingSettings(); [Header("Time")] [SerializeField] private Text _timeText; [SerializeField] private string _timeFormat = "hh:mm:sstt"; [SerializeField] private TimerMenu next; [SerializeField] public AudioClip[] _Delayvoice; private void RenderTime() { _timeText.text = DateTime.Now.ToString(_timeFormat); } public override void Render() { switch (base.Timer.currentmode) { case ShotTimer.delaymode.none: _detailsFormat = delaynone; break; case ShotTimer.delaymode.ipsc: _detailsFormat = delayipsc; break; case ShotTimer.delaymode.idpa: _detailsFormat = delayidpa; break; case ShotTimer.delaymode.issc: _detailsFormat = delayissc; break; case ShotTimer.delaymode.onefive: _detailsFormat = delayonefive; break; case ShotTimer.delaymode.fiveten: _detailsFormat = delayfiveten; break; } OverflowArray<ShotLine> shots = base.Timer.Shots; int count = shots.Count; if (count > 0) { ShotLine shotLine = shots[0]; ShotLine shotLine2 = shots[count - 1]; _lastShotText.text = string.Format(_lastShotFormat, _lastShotPadding.Render(shotLine2.Time), shotLine2.Time); float split = shotLine2.Split; if (split != 0f) { _detailsText.text = string.Format(_detailsFormat, _splitPadding.Render(split), split, _firstShotPadding.Render(shotLine.Time), shotLine.Time); } else { _detailsText.text = string.Format(_detailsFormat, "", "", _firstShotPadding.Render(shotLine.Time), shotLine.Time); } _shotCountText.text = string.Format(_shotCountFormatting, _shotCountPadding.Render(shotLine2.Time), count); } else { _shotCountText.text = string.Format(_shotCountFormatting, _shotCountPadding.Render(0), count); _lastShotText.text = ""; _detailsText.text = ""; } RenderTime(); } public override bool UpdateInputs(Inputs inputs, out TimerMenu menu) { switch (inputs) { case Inputs.MenuUp: menu = next; return true; case Inputs.SetDown: base.Timer.NextDelayMode(); break; case Inputs.SetUp: base.Timer.PreviousDelayMode(); break; case Inputs.Start: ((MonoBehaviour)base.Timer).StartCoroutine("Run"); menu = null; ((ShotReviewMenu)next)._cursor = 0; return true; } menu = null; return false; } public override void Activate(TimerMenu next) { ((Component)next).gameObject.SetActive(true); ((MonoBehaviour)this).StopAllCoroutines(); ((Component)this).gameObject.SetActive(false); } public IEnumerator Run() { do { Render(); yield return null; } while (((Behaviour)this).enabled); } private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("Run"); } } public struct ShotLine { public readonly float Time; public readonly float Split; public ShotLine(float time, float split) { Time = time; Split = split; } } public class ShotLineFactory { private float shotcount; private float start_time; private ShotLine prev = new ShotLine(0f, 0f); public ShotLine Create(OverflowArray<ShotLine> shot_database) { float time = Time.time; shotcount = shot_database.Count; ShotLine shotLine = new ShotLine(0f, 0f); return prev = ((shot_database.Count == 0) ? new ShotLine(time - start_time, time - start_time) : new ShotLine(time - start_time, time - start_time - prev.Time)); } public void Reset() { start_time = Time.time; } } public class ShotReviewMenu : TimerMenu { public int _cursor; [SerializeField] private Text _text; [SerializeField] private int _lineCount = 4; [SerializeField] private string _lineFormatting = "{0}{1:F2} # {2}{3} SPL "; [SerializeField] private string _splitFormatting = "{0}{1:F2}"; [SerializeField] private PaddingSettings _timePadding = new PaddingSettings(); [SerializeField] private PaddingSettings _shotNumberPadding = new PaddingSettings(); [SerializeField] private PaddingSettings _splitPadding = new PaddingSettings(); [SerializeField] private TimerMenu next; public override void Render() { StringBuilder stringBuilder = new StringBuilder(); int count = base.Timer.Shots.Count; int capacity = base.Timer.Shots.Capacity; int cursor = _cursor; int num = cursor + _lineCount; for (int i = cursor; i < num; i++) { int num2 = i % capacity; float num3 = num2; if (num2 >= count) { break; } ShotLine shotLine = base.Timer.Shots[i]; float time = shotLine.Time; stringBuilder.AppendFormat(_lineFormatting, _timePadding.Render(time), time, _shotNumberPadding.Render(num3 + 1f), num3 + 1f); float split = shotLine.Split; stringBuilder.AppendFormat(_splitFormatting, _splitPadding.Render(split), split); stringBuilder.AppendLine(); } _text.text = stringBuilder.ToString(); } public override bool UpdateInputs(Inputs inputs, out TimerMenu menu) { switch (inputs) { case Inputs.SetUp: ScrollString(-1); break; case Inputs.SetDown: ScrollString(1); break; case Inputs.MenuUp: menu = next; return true; case Inputs.MenuDown: _cursor = 0; break; } menu = null; return false; } private void ScrollString(int amount) { _cursor += amount; if (_cursor < 0) { _cursor = 0; } } public override void Activate(TimerMenu next) { ((Component)next).gameObject.SetActive(true); ((MonoBehaviour)this).StopAllCoroutines(); ((Component)this).gameObject.SetActive(false); } public IEnumerator Run() { do { Render(); yield return null; } while (((Behaviour)this).enabled); } private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("Run"); } } public class ShotTimer : FVRPhysicalObject { public enum delaymode { none, ipsc, idpa, issc, onefive, fiveten } private ShotLineFactory _factory; public OverflowArray<ShotLine> Shots; private Random random = new Random(); [Header("Gameplay")] private float _timeout; [Header("Display")] [SerializeField] private TimerMenu _menu; [Header("Audio")] [SerializeField] public AudioSource _speaker; [Header("Audio/Status")] [SerializeField] private AudioClip[] _shooterReadys; [SerializeField] private AudioClip[] _beeps; [SerializeField] private AudioClip[] _delays; [SerializeField] private AudioClip[] nut; public delaymode currentmode; private int _currentShooterReady; private int _currentBeep; private int _currentNut; private float _minDelay; private float _maxDelay; public override void Awake() { ((FVRPhysicalObject)this).Awake(); currentmode = delaymode.none; _factory = new ShotLineFactory(); Shots = new OverflowArray<ShotLine>(999); Shots.Clear(); _factory.Reset(); } public void NextDelayMode() { switch (currentmode) { case delaymode.fiveten: _speaker.Stop(); currentmode = delaymode.none; _speaker.PlayOneShot(_delays[0]); break; case delaymode.none: _speaker.Stop(); currentmode = delaymode.ipsc; _speaker.PlayOneShot(_delays[1]); break; case delaymode.ipsc: _speaker.Stop(); currentmode = delaymode.idpa; _speaker.PlayOneShot(_delays[2]); break; case delaymode.idpa: _speaker.Stop(); currentmode = delaymode.issc; _speaker.PlayOneShot(_delays[3]); break; case delaymode.issc: _speaker.Stop(); currentmode = delaymode.onefive; _speaker.PlayOneShot(_delays[4]); break; case delaymode.onefive: _speaker.Stop(); currentmode = delaymode.fiveten; _speaker.PlayOneShot(_delays[5]); break; default: currentmode = delaymode.none; break; } } public void PreviousDelayMode() { switch (currentmode) { case delaymode.none: _speaker.Stop(); currentmode = delaymode.fiveten; _speaker.PlayOneShot(_delays[5]); break; case delaymode.fiveten: _speaker.Stop(); currentmode = delaymode.onefive; _speaker.PlayOneShot(_delays[4]); break; case delaymode.onefive: _speaker.Stop(); currentmode = delaymode.issc; _speaker.PlayOneShot(_delays[3]); break; case delaymode.issc: _speaker.Stop(); currentmode = delaymode.idpa; _speaker.PlayOneShot(_delays[2]); break; case delaymode.idpa: _speaker.Stop(); currentmode = delaymode.ipsc; _speaker.PlayOneShot(_delays[1]); break; case delaymode.ipsc: _speaker.Stop(); currentmode = delaymode.none; _speaker.PlayOneShot(_delays[0]); break; default: currentmode = delaymode.none; break; } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0015: 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_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_0053: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00c6: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); HandInput input = hand.Input; Inputs inputs = Inputs.MenuUp.Encode(Vector2.Angle(input.TouchpadAxes, Vector2.up) <= 45f && ((Vector2)(ref input.TouchpadAxes)).magnitude > 0.4f && input.TouchpadDown) | Inputs.MenuDown.Encode(Vector2.Angle(input.TouchpadAxes, -Vector2.up) <= 45f && ((Vector2)(ref input.TouchpadAxes)).magnitude > 0.4f && input.TouchpadDown) | Inputs.SetUp.Encode(Vector2.Angle(input.TouchpadAxes, -Vector2.right) <= 45f && ((Vector2)(ref input.TouchpadAxes)).magnitude > 0.4f && input.TouchpadDown) | Inputs.SetDown.Encode(Vector2.Angle(input.TouchpadAxes, Vector2.right) <= 45f && ((Vector2)(ref input.TouchpadAxes)).magnitude > 0.4f && input.TouchpadDown) | Inputs.Start.Encode(input.TriggerDown); if (_menu.UpdateInputs(inputs, out var next) && !((Object)(object)next == (Object)null)) { _menu.Activate(next); _menu = next; } } public void Nut() { _speaker.Stop(); _currentNut = random.Next(nut.Length - 1); _speaker.PlayOneShot(nut[_currentNut]); } private IEnumerator Run() { Shots.Clear(); _currentShooterReady = random.Next(_shooterReadys.Length - 1); _currentBeep = random.Next(_beeps.Length - 1); if (_shooterReadys.Length != 0) { _speaker.Stop(); AudioClip val = _shooterReadys[_currentShooterReady]; _speaker.PlayOneShot(val); yield return (object)new WaitForSeconds(val.length); yield return (object)new WaitForSeconds(currentmode switch { delaymode.none => 1f, delaymode.ipsc => Random.Range(1, 4), delaymode.idpa => Random.Range(1, 4), delaymode.issc => Random.Range(2, 6), delaymode.onefive => Random.Range(1, 5), delaymode.fiveten => Random.Range(5, 10), _ => 1f, }); } if (_beeps.Length != 0) { AudioClip val2 = _beeps[_currentBeep]; _speaker.PlayOneShot(val2); yield return (object)new WaitForSeconds(val2.length); } _factory.Reset(); } private void OnFire(FVRFireArm firearm) { Shots.Add(_factory.Create(Shots)); } private void OnEnable() { //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(OnFire); } 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(OnFire); } } public class SingleTimeOnlyMenu : TimerMenu { [SerializeField] private Text _display; [SerializeField] private string _format = "{0}{1:F2}"; [SerializeField] private PaddingSettings _padding = new PaddingSettings(); [SerializeField] private TimerMenu next; public override void Render() { if (base.Timer.Shots.TryGetLast(out var value)) { float time = value.Time; _display.text = string.Format(_format, _padding.Render(time), time); } else { _display.text = ""; } } public override bool UpdateInputs(Inputs inputs, out TimerMenu menu) { switch (inputs) { case Inputs.MenuUp: menu = next; return true; case Inputs.SetDown: base.Timer.NextDelayMode(); break; case Inputs.SetUp: base.Timer.PreviousDelayMode(); break; case Inputs.Start: ((MonoBehaviour)base.Timer).StartCoroutine("Run"); menu = null; ((ShotReviewMenu)next)._cursor = 0; return true; } menu = null; return false; } public override void Activate(TimerMenu next) { ((Component)next).gameObject.SetActive(true); ((MonoBehaviour)this).StopAllCoroutines(); ((Component)this).gameObject.SetActive(false); } public IEnumerator Run() { do { Render(); yield return null; } while (((Behaviour)this).enabled); } private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("Run"); } } public abstract class TimerMenu : MonoBehaviour { [SerializeField] private ShotTimer _timer; protected ShotTimer Timer => _timer; public abstract void Render(); public abstract bool UpdateInputs(Inputs inputs, out TimerMenu next); public abstract void Activate(TimerMenu next); }
plugins/SmartPistol.dll
Decompiled 10 months agousing 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 FistVR; using On.FistVR; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("SmartPistol")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SmartPistol")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("226f3f1c-5206-45f5-8866-cb3c02dbc20a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class SmartAttachment : MonoBehaviour { public FVRFireArmAttachment Attachment; [Header("Weapon Config")] public float EngageRange = 15f; [Range(1f, 179f)] public float EngageAngle = 45f; public float PrecisionAngle = 5f; public LayerMask LatchingMask; public LayerMask BlockingMask; public bool DoesRandomRotationOfBarrelForCinematicBulletTrails = true; public float RandomAngleMagnitude = 5f; [Tooltip("Use this if you want the last target to stay locked on for a certain period. Good for shooting around corners!")] public float LastTargetTimeout = 1f; [Tooltip("Makes Bullets slower so that they can arc better than with max speed. Compensates with mass so damage should be about the same.")] public float BulletVelocityModifier = 0.1f; [Header("Projectile Config")] [Tooltip("Puts smart projectile component on every projectile leaving the muzzle.")] public bool ActivatesBullets = true; public float TurningSpeed = 180f; public bool HasLimitedTurnAngle; public float TurnAngleLimit = 45f; [Tooltip("Doesn't work with AngleLimit cause the constant correction causes flown angles to add up quickly in target approach.")] public bool UsesInheritInaccuracy = true; public float AccuracyCircleRadius = 0.15f; public bool ScalesWithDistance = true; public float InaccuracyScaleOverDistanceFactor = 1.25f; public float BulletSwaySpeed = 0.5f; private bool _isAttached; private FVRFireArm _fireArm; private SmartWeapon _smartWeapon; public void Update() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (!_isAttached && (Object)(object)Attachment.curMount != (Object)null && Attachment.curMount.GetRootMount().MyObject is FVRFireArm) { ref FVRFireArm fireArm = ref _fireArm; FVRPhysicalObject myObject = Attachment.curMount.GetRootMount().MyObject; fireArm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); _smartWeapon = ((Component)_fireArm).GetComponent<SmartWeapon>(); if ((Object)(object)_smartWeapon == (Object)null) { ((Component)_fireArm).gameObject.SetActive(false); _smartWeapon = ((Component)_fireArm).gameObject.AddComponent<SmartWeapon>(); _smartWeapon.FireArm = _fireArm; _smartWeapon.EngageRange = EngageRange; _smartWeapon.EngageAngle = EngageAngle; _smartWeapon.PrecisionAngle = PrecisionAngle; _smartWeapon.LatchingMask = LatchingMask; _smartWeapon.BlockingMask = BlockingMask; _smartWeapon.DoesRandomRotationOfBarrelForCinematicBulletTrails = DoesRandomRotationOfBarrelForCinematicBulletTrails; _smartWeapon.RandomAngleMagnitude = RandomAngleMagnitude; _smartWeapon.LastTargetTimeout = LastTargetTimeout; _smartWeapon.WasManuallyAdded = ActivatesBullets; _smartWeapon.BulletVelocityModifier = BulletVelocityModifier; SmartProjectile.SmartProjectileData smartProjectileData = new SmartProjectile.SmartProjectileData(); smartProjectileData.TurningSpeed = TurningSpeed; smartProjectileData.HasLimitedTurnAngle = HasLimitedTurnAngle; smartProjectileData.TurnAngleLimit = TurnAngleLimit; smartProjectileData.UsesInheritInaccuracy = UsesInheritInaccuracy; smartProjectileData.AccuracyCircleRadius = AccuracyCircleRadius; smartProjectileData.ScalesWithDistance = ScalesWithDistance; smartProjectileData.InaccuracyScaleOverDistanceFactor = InaccuracyScaleOverDistanceFactor; smartProjectileData.BulletSwaySpeed = BulletSwaySpeed; _smartWeapon.ProjectileData = smartProjectileData; _isAttached = true; ((Component)_fireArm).gameObject.SetActive(true); } } else if (_isAttached && (Object)(object)Attachment.curMount == (Object)null && (Object)(object)_fireArm != (Object)null) { _isAttached = false; Object.Destroy((Object)(object)_smartWeapon); _fireArm = null; } } } public class TopAttackSystem : MonoBehaviour { public FVRFireArm FireArm; public LayerMask LM_OverlapCapsuleTargetMask; public LayerMask LM_RaycastTargetMask; public float MaxRange = 2000f; public float ObjectTargetingFOV = 1f; private Vector3? _targetPoint; private Rigidbody _targetRB; public TopAttackProjectile.EAttackMode AttackMode; public float MinRangeTopAttackMode = 150f; public float MinRangeFrontalAttackMode = 65f; [Header("Mode Text Config")] public Text ModeTextField; public string TopAttackModeText = "Top"; public string FrontalAttackModeText = "Frontal"; [Header("Rangefinder Text Config")] public Text RangeTextField; public string OutOfRangeText = "INF"; [Header("Target Text Config")] public Text TargetTextField; public string NoTargetText = "No Target"; public string PositionTargetText = "Target Position: {0:F0}X {1:F0}Y {2:F0}Z"; public string RigidbodyTargetText = "Target Object: {0}"; private string[] _modeTexts; private const string _removeFromName = "(Clone)"; private float _overlapCapsuleRadius; private RaycastHit _raycastHit; private Collider[] _targetArray = (Collider[])(object)new Collider[32]; private LayerMask LM_BlockMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Environment" })); public void Awake() { Hook(); _modeTexts = new string[2] { TopAttackModeText, FrontalAttackModeText }; _overlapCapsuleRadius = Mathf.Tan(ObjectTargetingFOV * ((float)Math.PI / 180f)) * MaxRange; } public void OnDestroy() { Unhook(); } public void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00c6: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_0263: 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_01ea: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapCapsuleNonAlloc(((Component)this).transform.position, ((Component)this).transform.position + MaxRange * ((Component)this).transform.forward, _overlapCapsuleRadius, _targetArray, LayerMask.op_Implicit(LM_OverlapCapsuleTargetMask), (QueryTriggerInteraction)2); float num2 = MaxRange + 100f; Collider val = null; for (int i = 0; i < num; i++) { Vector3 val2 = ((Component)_targetArray[i]).transform.position - ((Component)this).transform.position; if (!(Vector3.Angle(val2, ((Component)this).transform.forward) > ObjectTargetingFOV) && ((Vector3)(ref val2)).magnitude < num2 && !Physics.Linecast(((Component)this).transform.position, ((Component)_targetArray[i]).transform.position, LayerMask.op_Implicit(LM_BlockMask))) { num2 = Vector3.Distance(((Component)_targetArray[i]).transform.position, ((Component)this).transform.position); val = _targetArray[i]; } } if ((Object)(object)val != (Object)null) { _targetRB = val.attachedRigidbody; } else { _targetRB = null; } if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref _raycastHit, MaxRange, LayerMask.op_Implicit(LM_RaycastTargetMask), (QueryTriggerInteraction)2)) { RangeTextField.text = $"{((RaycastHit)(ref _raycastHit)).distance:F0}m"; if (AttackMode == TopAttackProjectile.EAttackMode.Top && ((RaycastHit)(ref _raycastHit)).distance > MinRangeTopAttackMode) { _targetPoint = ((RaycastHit)(ref _raycastHit)).point; } else if (AttackMode == TopAttackProjectile.EAttackMode.Direct && ((RaycastHit)(ref _raycastHit)).distance > MinRangeFrontalAttackMode) { _targetPoint = ((RaycastHit)(ref _raycastHit)).point; } if ((Object)(object)_targetRB != (Object)null) { string arg = ((Object)_targetRB).name.Replace("(Clone)", ""); TargetTextField.text = string.Format(RigidbodyTargetText, arg); } else { TargetTextField.text = string.Format(PositionTargetText, ((RaycastHit)(ref _raycastHit)).point.x, ((RaycastHit)(ref _raycastHit)).point.y, ((RaycastHit)(ref _raycastHit)).point.z); } } else { RangeTextField.text = OutOfRangeText; TargetTextField.text = NoTargetText; _targetPoint = null; _targetRB = null; } } public void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown FVRFireArm.Fire -= new hook_Fire(FVRFireArm_Fire); FVRPhysicalObject.UpdateInteraction -= new hook_UpdateInteraction(FVRPhysicalObject_UpdateInteraction); } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown FVRFireArm.Fire += new hook_Fire(FVRFireArm_Fire); FVRPhysicalObject.UpdateInteraction += new hook_UpdateInteraction(FVRPhysicalObject_UpdateInteraction); } private void FVRPhysicalObject_UpdateInteraction(orig_UpdateInteraction orig, FVRPhysicalObject self, FVRViveHand hand) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, hand); if ((Object)(object)self == (Object)(object)FireArm && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f) { ChangeMode(); } } private void ChangeMode() { switch (AttackMode) { case TopAttackProjectile.EAttackMode.Top: AttackMode = TopAttackProjectile.EAttackMode.Direct; break; case TopAttackProjectile.EAttackMode.Direct: AttackMode = TopAttackProjectile.EAttackMode.Top; break; } if ((Object)(object)ModeTextField != (Object)null) { ModeTextField.text = _modeTexts[(int)AttackMode]; } } private void FVRFireArm_Fire(orig_Fire orig, FVRFireArm self, FVRFireArmChamber chamber, Transform muzzle, bool doBuzz, float velMult, float rangeOverride) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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) //IL_00f9: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_015c: 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_0165: 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) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_0252: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)(object)FireArm) { if (doBuzz && (Object)(object)((FVRInteractiveObject)self).m_hand != (Object)null) { ((FVRInteractiveObject)self).m_hand.Buzz(((FVRInteractiveObject)self).m_hand.Buzzer.Buzz_GunShot); if ((Object)(object)((FVRPhysicalObject)self).AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)self).AltGrip).m_hand != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)self).AltGrip).m_hand.Buzz(((FVRInteractiveObject)self).m_hand.Buzzer.Buzz_GunShot); } } GM.CurrentSceneSettings.OnShotFired(self); if (self.IsSuppressed()) { GM.CurrentPlayerBody.VisibleEvent(0.1f); } else { GM.CurrentPlayerBody.VisibleEvent(2f); } float chamberVelMult = AM.GetChamberVelMult(chamber.RoundType, Vector3.Distance(((Component)chamber).transform.position, muzzle.position)); float num = self.GetCombinedFixedDrop(self.AccuracyClass) * 0.0166667f; Vector2 val = self.GetCombinedFixedDrift(self.AccuracyClass) * 0.0166667f; Vector3 val5 = default(Vector3); for (int i = 0; i < chamber.GetRound().NumProjectiles; i++) { float num2 = chamber.GetRound().ProjectileSpread + self.m_internalMechanicalMOA + self.GetCombinedMuzzleDeviceAccuracy(); if (!((Object)(object)chamber.GetRound().BallisticProjectilePrefab != (Object)null)) { continue; } Vector3 val2 = muzzle.forward * 0.005f; GameObject val3 = Object.Instantiate<GameObject>(chamber.GetRound().BallisticProjectilePrefab, muzzle.position - val2, muzzle.rotation); Vector2 val4 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num2; val3.transform.Rotate(new Vector3(val4.x + val.y + num, val4.y + val.x, 0f)); BallisticProjectile component = val3.GetComponent<BallisticProjectile>(); component.Fire(component.MuzzleVelocityBase * chamber.ChamberVelocityMultiplier * velMult * chamberVelMult, val3.transform.forward, self, true); TopAttackProjectile component2 = val3.GetComponent<TopAttackProjectile>(); if ((Object)(object)component2 != (Object)null) { Vector3? targetPoint = _targetPoint; ((Vector3)(ref val5))..ctor(float.MaxValue, float.MaxValue, float.MaxValue); if (!targetPoint.HasValue || (targetPoint.HasValue && targetPoint.GetValueOrDefault() != val5)) { if ((Object)(object)_targetRB == (Object)null) { component2.TargetPoint = _targetPoint; } else { component2.TargetRB = _targetRB; } component2.AttackMode = AttackMode; } } if (rangeOverride > 0f) { component.ForceSetMaxDist(rangeOverride); } } } else { orig.Invoke(self, chamber, muzzle, doBuzz, velMult, rangeOverride); } } } public class LaserGuidanceSystem : MonoBehaviour { public LayerMask TargetMask; [HideInInspector] public static List<Vector3> LaserTargets = new List<Vector3>(); public float Range; private Vector3 _lastTarget; public void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0067: 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_0049: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val, Range, LayerMask.op_Implicit(TargetMask), (QueryTriggerInteraction)2)) { LaserTargets.Remove(_lastTarget); LaserTargets.Add(((RaycastHit)(ref val)).point); _lastTarget = ((RaycastHit)(ref val)).point; } else { LaserTargets.Remove(_lastTarget); } } public void OnDestroy() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) LaserTargets.Remove(_lastTarget); } public void OnDisable() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) LaserTargets.Remove(_lastTarget); } } public class LaserGuidedProjectile : MonoBehaviour { public BallisticProjectile Projectile; public float TurningSpeed = 45f; public float TargetingConeAngle = 180f; public bool HasLimitedTurnAngle = true; public float TurnAngleLimit = 45f; [Tooltip("Doesn't work with AngleLimit cause the constant correction causes flown angles to add up quickly in target approach.")] public bool UsesInheritInaccuracy = true; public float AccuracyCircleRadius = 0.3f; public bool ScalesWithDistance = true; public float InaccuracyScaleOverDistanceFactor = 1.25f; public float BulletSwaySpeed = 0.5f; private float _turnedAngle; private Vector3 _curTarget; private Vector2 _currentInaccuracy = Vector2.zero; public void Awake() { //IL_0009: 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) if (UsesInheritInaccuracy) { _currentInaccuracy = Random.insideUnitCircle * AccuracyCircleRadius; } } public void Update() { //IL_000b: 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_0021: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if (!UsesInheritInaccuracy) { return; } Vector2 val = Random.insideUnitCircle * AccuracyCircleRadius * BulletSwaySpeed * Time.deltaTime; float num = 0f; if (ScalesWithDistance) { float num2 = Vector3.Distance(_curTarget, ((Component)Projectile).transform.position); if (num2 > 1f) { num = Mathf.Pow((num2 - 1f) * (InaccuracyScaleOverDistanceFactor - 1f), 2f); val *= num; } } if (((Vector2)(ref _currentInaccuracy)).magnitude > AccuracyCircleRadius * (1f + num)) { _currentInaccuracy = ((Vector2)(ref _currentInaccuracy)).normalized * AccuracyCircleRadius * (1f + num); } Vector2 val2 = val + _currentInaccuracy; if (((Vector2)(ref val2)).magnitude < AccuracyCircleRadius * (1f + num)) { _currentInaccuracy += val; } } public void FixedUpdate() { //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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0116: 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_0121: 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_0128: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_017a: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_01a1: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = Projectile.m_velocity; Quaternion val = ((((Vector3)(ref velocity)).magnitude == 0f) ? Quaternion.LookRotation(((Component)Projectile).transform.forward) : ((!(((Vector3)(ref velocity)).normalized != Vector3.up)) ? Quaternion.LookRotation(velocity, Vector3.right) : Quaternion.LookRotation(velocity, Vector3.up))); if ((HasLimitedTurnAngle && !(_turnedAngle < TurnAngleLimit)) || LaserGuidanceSystem.LaserTargets.Count == 0) { return; } List<Vector3> list = new List<Vector3>(); foreach (Vector3 laserTarget in LaserGuidanceSystem.LaserTargets) { if (Vector3.Angle(laserTarget - ((Component)Projectile).transform.position, ((Component)Projectile).transform.forward) <= TargetingConeAngle) { list.Add(laserTarget); } } if (list.Count != 0) { _curTarget = list[Random.Range(0, list.Count)]; Quaternion val2 = Quaternion.LookRotation(_curTarget + val * Vector2.op_Implicit(_currentInaccuracy) - ((Component)Projectile).transform.position); Quaternion val3 = Quaternion.RotateTowards(val, val2, TurningSpeed * Time.fixedDeltaTime) * Quaternion.Inverse(val); Projectile.m_velocity = val3 * velocity; if (!UsesInheritInaccuracy) { _turnedAngle += Vector3.Angle(Projectile.m_velocity, velocity); } } } } public class SmartWeapon : MonoBehaviour { public FVRFireArm FireArm; public MeshRenderer ReticleMesh; public bool DisableReticleWithoutTarget = true; public float EngageRange = 15f; [Range(1f, 179f)] public float EngageAngle = 45f; public float PrecisionAngle = 5f; public LayerMask LatchingMask; public LayerMask BlockingMask; public bool DoesRandomRotationOfBarrelForCinematicBulletTrails = true; public float RandomAngleMagnitude = 5f; [Tooltip("Use this if you want the last target to stay locked on for a certain period. Good for shooting around corners!")] public float LastTargetTimeout = 1f; [HideInInspector] public bool WasManuallyAdded; [HideInInspector] public SmartProjectile.SmartProjectileData ProjectileData; [HideInInspector] public float BulletVelocityModifier = 1f; private const string _nameOfDistanceVariable = "_RedDotDist"; private SosigLink _lastTarget; private GameObject _origMuzzlePos; private bool _timeoutStarted; public void Awake() { //IL_003d: 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) Hook(); _origMuzzlePos = Object.Instantiate<GameObject>(((Component)FireArm.MuzzlePos).gameObject, ((Component)this).transform); _origMuzzlePos.transform.localPosition = FireArm.MuzzlePos.localPosition; _origMuzzlePos.transform.localRotation = FireArm.MuzzlePos.localRotation; } 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 FVRFireArm.Fire -= new hook_Fire(FVRFireArm_Fire); } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FVRFireArm.Fire += new hook_Fire(FVRFireArm_Fire); } private void FVRFireArm_Fire(orig_Fire orig, FVRFireArm self, FVRFireArmChamber chamber, Transform muzzle, bool doBuzz, float velMult, float rangeOverride) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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) //IL_00f9: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_015c: 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_0165: 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) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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) if ((Object)(object)self == (Object)(object)FireArm) { if (doBuzz && (Object)(object)((FVRInteractiveObject)self).m_hand != (Object)null) { ((FVRInteractiveObject)self).m_hand.Buzz(((FVRInteractiveObject)self).m_hand.Buzzer.Buzz_GunShot); if ((Object)(object)((FVRPhysicalObject)self).AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)self).AltGrip).m_hand != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)self).AltGrip).m_hand.Buzz(((FVRInteractiveObject)self).m_hand.Buzzer.Buzz_GunShot); } } GM.CurrentSceneSettings.OnShotFired(self); if (self.IsSuppressed()) { GM.CurrentPlayerBody.VisibleEvent(0.1f); } else { GM.CurrentPlayerBody.VisibleEvent(2f); } float chamberVelMult = AM.GetChamberVelMult(chamber.RoundType, Vector3.Distance(((Component)chamber).transform.position, muzzle.position)); float num = self.GetCombinedFixedDrop(self.AccuracyClass) * 0.0166667f; Vector2 val = self.GetCombinedFixedDrift(self.AccuracyClass) * 0.0166667f; for (int i = 0; i < chamber.GetRound().NumProjectiles; i++) { float num2 = chamber.GetRound().ProjectileSpread + self.m_internalMechanicalMOA + self.GetCombinedMuzzleDeviceAccuracy(); if ((Object)(object)chamber.GetRound().BallisticProjectilePrefab != (Object)null) { Vector3 val2 = muzzle.forward * 0.005f; GameObject val3 = Object.Instantiate<GameObject>(chamber.GetRound().BallisticProjectilePrefab, muzzle.position - val2, muzzle.rotation); Vector2 val4 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num2; val3.transform.Rotate(new Vector3(val4.x + val.y + num, val4.y + val.x, 0f)); BallisticProjectile component = val3.GetComponent<BallisticProjectile>(); float num3 = component.MuzzleVelocityBase * chamber.ChamberVelocityMultiplier * velMult * chamberVelMult; component.Fire(num3 * BulletVelocityModifier, val3.transform.forward, self, true); SmartProjectile smartProjectile = val3.GetComponent<SmartProjectile>(); if ((Object)(object)smartProjectile == (Object)null && WasManuallyAdded) { smartProjectile = val3.AddComponent<SmartProjectile>(); smartProjectile.Projectile = component; smartProjectile.ConfigureFromData(ProjectileData); } if ((Object)(object)smartProjectile != (Object)null) { smartProjectile.TargetLink = _lastTarget; } if (rangeOverride > 0f) { component.ForceSetMaxDist(rangeOverride); } if (BulletVelocityModifier != 1f) { component.Mass = Mathf.Pow(num3, 2f) * component.Mass / Mathf.Pow(num3 * BulletVelocityModifier, 2f); } } } } else { orig.Invoke(self, chamber, muzzle, doBuzz, velMult, rangeOverride); } } public void Update() { //IL_00d1: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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) if (!((FVRInteractiveObject)FireArm).IsHeld) { return; } SosigLink val = FindTarget(); if ((Object)(object)val != (Object)null) { if (_timeoutStarted && LastTargetTimeout != 0f) { ((MonoBehaviour)this).StopCoroutine("LastTargetTimeoutCoroutine"); } _lastTarget = val; } else { if (!_timeoutStarted && LastTargetTimeout != 0f) { ((MonoBehaviour)this).StopCoroutine("LastTargetTimeoutCoroutine"); ((MonoBehaviour)this).StartCoroutine("LastTargetTimeoutCoroutine"); } if (DisableReticleWithoutTarget && (Object)(object)ReticleMesh != (Object)null) { ((Component)ReticleMesh).gameObject.SetActive(false); } } if ((Object)(object)_lastTarget != (Object)null && (Object)(object)ReticleMesh != (Object)null) { ((Component)ReticleMesh).transform.LookAt(((Component)_lastTarget).transform.position); ((Renderer)ReticleMesh).material.SetFloat("_RedDotDist", Vector3.Distance(((Component)_lastTarget).transform.position, ((Component)ReticleMesh).transform.position)); if (DisableReticleWithoutTarget) { ((Component)ReticleMesh).gameObject.SetActive(true); } } else if ((Object)(object)_lastTarget == (Object)null && (Object)(object)ReticleMesh != (Object)null) { ((Component)ReticleMesh).transform.localRotation = Quaternion.identity; if (DisableReticleWithoutTarget) { ((Component)ReticleMesh).gameObject.SetActive(false); } } if (DoesRandomRotationOfBarrelForCinematicBulletTrails) { Vector3 localEulerAngles = default(Vector3); localEulerAngles.x = Random.Range(0f - RandomAngleMagnitude, RandomAngleMagnitude); localEulerAngles.y = Random.Range(0f - RandomAngleMagnitude, RandomAngleMagnitude); FireArm.CurrentMuzzle.localEulerAngles = localEulerAngles; } } private IEnumerator LastTargetTimeoutCoroutine() { _timeoutStarted = true; yield return (object)new WaitForSeconds(LastTargetTimeout); _lastTarget = null; } private SosigLink FindTarget() { //IL_002a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Invalid comparison between Unknown and I4 //IL_010a: 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_011f: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) float num = EngageRange * Mathf.Tan(0.5f * EngageAngle * ((float)Math.PI / 180f)); Collider[] array = Physics.OverlapCapsule(FireArm.CurrentMuzzle.position, FireArm.CurrentMuzzle.position + _origMuzzlePos.transform.forward * EngageRange, num, LayerMask.op_Implicit(LatchingMask)); List<Rigidbody> list = new List<Rigidbody>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].attachedRigidbody != (Object)null && !list.Contains(array[i].attachedRigidbody)) { list.Add(array[i].attachedRigidbody); } } SosigLink result = null; SosigLink val = null; float num2 = EngageAngle; for (int j = 0; j < list.Count; j++) { SosigLink component = ((Component)list[j]).GetComponent<SosigLink>(); if ((Object)(object)component != (Object)null && (int)component.S.BodyState != 3) { float num3 = Vector3.Angle(((Component)list[j]).transform.position - FireArm.CurrentMuzzle.position, _origMuzzlePos.transform.forward); Sosig s = component.S; val = ((!(num3 <= PrecisionAngle)) ? s.Links[1] : s.Links[0]); if (num3 < num2 && !Physics.Linecast(FireArm.CurrentMuzzle.position, ((Component)val).transform.position, LayerMask.op_Implicit(BlockingMask), (QueryTriggerInteraction)1)) { result = val; num2 = num3; } } } return result; } } public class TopAttackProjectile : MonoBehaviour { public enum EAttackMode { Top, Direct } private enum AttackState { ClimbOut, AltitudeHold, Terminal } public BallisticProjectile Projectile; public GameObject MissileEngineEffects; [HideInInspector] public float MaxRangeOverride = 10000f; [HideInInspector] public Vector3? TargetPoint; [HideInInspector] public Rigidbody TargetRB; public float TurningSpeed = 45f; public float LaunchDelay = 0.5f; public float MaximumFlightSpeed = 150f; public float AccelerationWithRocketEngaged = 150f; public EAttackMode AttackMode; public float TopAttackLaunchAngle = 60f; public float TopAttackAttackAngle = 45f; public float DirectAttackLaunchAngle = 45f; public float DirectAttackAttackAngle = 1.75f; public float MaxHeightInTopAttack = 160f; private AttackState _attackState; private float _startingDistanceToTarget; private float _startingHeight; private Vector3 _startingPosition; private Vector3 _targetDirection; private float _targetHeight; private bool _doesAltitudeHolt; private float _altitudeHoldMaxDistance; private float _altitudeHoldCurrentDistance; private bool _debug; private float _launchDelayTick; private bool _rocketEngaged; public void Start() { if ((Object)(object)Projectile.ExtraDisplay != (Object)null) { Projectile.ExtraDisplay.SetActive(false); } if ((Object)(object)MissileEngineEffects != (Object)null) { MissileEngineEffects.SetActive(false); } Projectile.ForceSetMaxDist(MaxRangeOverride); } public void Update() { //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_001a: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; if ((Object)(object)TargetRB != (Object)null) { val = TargetRB.position; } else if (TargetPoint.HasValue) { val = TargetPoint.Value; } else { Object.Destroy((Object)(object)this); } if (!_rocketEngaged && _launchDelayTick >= LaunchDelay) { CalculateLaunchProfile(); _rocketEngaged = true; if ((Object)(object)Projectile.ExtraDisplay != (Object)null) { Projectile.ExtraDisplay.SetActive(true); } if ((Object)(object)MissileEngineEffects != (Object)null) { MissileEngineEffects.SetActive(true); } Projectile.GravityMultiplier = 0f; } else if (!_rocketEngaged) { Projectile.GravityMultiplier = 1f; if ((Object)(object)Projectile.ExtraDisplay != (Object)null) { Projectile.ExtraDisplay.SetActive(false); } } if (AttackMode == EAttackMode.Top && _rocketEngaged) { if (_doesAltitudeHolt && _attackState == AttackState.ClimbOut && ((Component)Projectile).transform.position.y >= _targetHeight + _startingHeight) { _attackState = AttackState.AltitudeHold; _targetDirection = Vector3.ProjectOnPlane(val - ((Component)Projectile).transform.position, Vector3.up); } else if (!_doesAltitudeHolt && _attackState == AttackState.ClimbOut && ((Component)Projectile).transform.position.y >= _targetHeight + _startingHeight) { _attackState = AttackState.Terminal; } if (_attackState == AttackState.AltitudeHold) { Vector3 val2 = Vector3.ProjectOnPlane(((Component)Projectile).transform.position - _startingPosition, Vector3.up); if (((Vector3)(ref val2)).magnitude >= _altitudeHoldMaxDistance) { _attackState = AttackState.Terminal; } } } else if (AttackMode == EAttackMode.Direct && _rocketEngaged && _attackState == AttackState.ClimbOut && ((Component)Projectile).transform.position.y >= _targetHeight + _startingHeight) { _attackState = AttackState.Terminal; } } public void FixedUpdate() { //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_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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0118: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) _launchDelayTick += Time.fixedDeltaTime; Vector3 val = Vector3.zero; if ((Object)(object)TargetRB != (Object)null) { val = TargetRB.position; } else if (TargetPoint.HasValue) { val = TargetPoint.Value; } else { Object.Destroy((Object)(object)this); } if (_rocketEngaged && !Projectile.hasTurnedOffRends && ((Vector3)(ref Projectile.m_velocity)).magnitude < MaximumFlightSpeed) { Projectile.m_velocity += ((Vector3)(ref Projectile.m_velocity)).normalized * AccelerationWithRocketEngaged * Time.fixedDeltaTime; } Quaternion val2 = ((((Vector3)(ref Projectile.m_velocity)).magnitude == 0f) ? Quaternion.LookRotation(((Component)Projectile).transform.forward) : ((!(((Vector3)(ref Projectile.m_velocity)).normalized != Vector3.up)) ? Quaternion.LookRotation(Projectile.m_velocity, Vector3.right) : Quaternion.LookRotation(Projectile.m_velocity, Vector3.up))); if (AttackMode == EAttackMode.Top) { if ((_attackState == AttackState.ClimbOut || _attackState == AttackState.AltitudeHold) && _rocketEngaged) { Quaternion val3 = Quaternion.LookRotation(_targetDirection); Quaternion val4 = Quaternion.RotateTowards(val2, val3, TurningSpeed * Time.fixedDeltaTime) * Quaternion.Inverse(val2); Projectile.m_velocity = val4 * Projectile.m_velocity; } else if (_attackState == AttackState.Terminal && _rocketEngaged) { Quaternion val5 = Quaternion.LookRotation(val - ((Component)Projectile).transform.position); Quaternion val6 = Quaternion.RotateTowards(val2, val5, TurningSpeed * Time.fixedDeltaTime) * Quaternion.Inverse(val2); Projectile.m_velocity = val6 * Projectile.m_velocity; } } else if (_attackState == AttackState.ClimbOut && _rocketEngaged) { Quaternion val7 = Quaternion.LookRotation(_targetDirection); Quaternion val8 = Quaternion.RotateTowards(val2, val7, TurningSpeed * Time.fixedDeltaTime) * Quaternion.Inverse(val2); Projectile.m_velocity = val8 * Projectile.m_velocity; } else if (_attackState == AttackState.Terminal && _rocketEngaged) { Quaternion val9 = Quaternion.LookRotation(val - ((Component)Projectile).transform.position); Quaternion val10 = Quaternion.RotateTowards(val2, val9, TurningSpeed * Time.fixedDeltaTime) * Quaternion.Inverse(val2); Projectile.m_velocity = val10 * Projectile.m_velocity; } } private void CalculateLaunchProfile() { //IL_0026: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_008e: 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_00a8: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_07a5: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_088e: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: 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_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0535: 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_0593: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) float num = 180f * MaximumFlightSpeed / ((float)Math.PI * TurningSpeed); _startingPosition = ((Component)Projectile).transform.position; _startingHeight = ((Component)Projectile).transform.position.y; Vector3 val = Vector3.zero; if ((Object)(object)TargetRB != (Object)null) { val = TargetRB.position; } else if (TargetPoint.HasValue) { val = TargetPoint.Value; } else { Object.Destroy((Object)(object)this); } float num2 = val.y - _startingHeight; Vector3 val2 = Vector3.ProjectOnPlane(val - ((Component)Projectile).transform.position, Vector3.up); float magnitude = ((Vector3)(ref val2)).magnitude; if (AttackMode == EAttackMode.Top) { float num3 = num2 / Mathf.Tan(TopAttackAttackAngle * ((float)Math.PI / 180f)); _startingDistanceToTarget = magnitude + num3; float num4 = TopAttackLaunchAngle - Vector3.Angle(((Component)Projectile).transform.forward, Vector3.ProjectOnPlane(((Component)Projectile).transform.forward, Vector3.up)) * (((Component)Projectile).transform.forward.y / Mathf.Abs(((Component)Projectile).transform.forward.y)); _targetDirection = Quaternion.AngleAxis(0f - num4, ((Component)Projectile).transform.right) * ((Component)Projectile).transform.forward; _targetHeight = _startingDistanceToTarget * (Mathf.Tan(TopAttackLaunchAngle * ((float)Math.PI / 180f)) * Mathf.Tan(TopAttackAttackAngle * ((float)Math.PI / 180f))) / (Mathf.Tan(TopAttackLaunchAngle * ((float)Math.PI / 180f)) + Mathf.Tan(TopAttackAttackAngle * ((float)Math.PI / 180f))); if (_debug) { Debug.Log((object)$"First _targetHeight: {_targetHeight}"); } if (num2 > 0f && _targetHeight > MaxHeightInTopAttack + num2) { _doesAltitudeHolt = true; _targetHeight = MaxHeightInTopAttack + num2; } else if (_targetHeight > MaxHeightInTopAttack) { _doesAltitudeHolt = true; _targetHeight = MaxHeightInTopAttack; } if (_debug) { Debug.Log((object)$"_doesAltitudeHolt: {_doesAltitudeHolt}"); } float num5 = 180f - (TopAttackLaunchAngle + TopAttackAttackAngle); float num6 = _targetHeight / Mathf.Sin(TopAttackLaunchAngle * ((float)Math.PI / 180f)); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(Mathf.Cos(TopAttackLaunchAngle * ((float)Math.PI / 180f)) * num6, Mathf.Sin(TopAttackLaunchAngle * ((float)Math.PI / 180f)) * num6); float num7 = num / Mathf.Sin(num5 / 2f * ((float)Math.PI / 180f)); Vector2 val4 = val3 - ((Vector2)(ref val3)).normalized * num7; Vector2 val5 = val3 + Vector2.right * num7; _targetHeight = val4.y; if (_debug) { Debug.Log((object)$"turnRadius: {num}"); Debug.Log((object)$"TargetDir: {val - ((Component)Projectile).transform.position}"); Debug.Log((object)$"deltaAngle: {num4}"); Debug.Log((object)$"_deltaHeight: {num2}"); Debug.Log((object)$"_deltaXZ: {magnitude}"); Debug.Log((object)$"_heightCorrection: {num3}"); Debug.Log((object)$"_startingDistanceToTarget: {_startingDistanceToTarget}"); Debug.Log((object)$"climbDistance: {num6}"); Debug.Log((object)$"highestPointInTriangle: {val3}"); Debug.Log((object)$"distanceToTurnCenter: {num7}"); Debug.Log((object)$"Final _targetHeight: {_targetHeight}"); Debug.Log((object)$"tangentPointEnter: {val4}"); } if (_doesAltitudeHolt) { float num8 = (float)Math.PI * num * ((180f - num5) / 180f); _altitudeHoldCurrentDistance = 0f - num8; float num9 = ((!(num2 > 0f)) ? (MaxHeightInTopAttack / Mathf.Sin(TopAttackAttackAngle * ((float)Math.PI / 180f))) : ((MaxHeightInTopAttack + num2) / Mathf.Sin(TopAttackAttackAngle * ((float)Math.PI / 180f)))); num5 = 180f - TopAttackAttackAngle; val3 = new Vector2(magnitude, 0f) + new Vector2((0f - Mathf.Cos(TopAttackAttackAngle * ((float)Math.PI / 180f))) * num9, Mathf.Sin(TopAttackAttackAngle * ((float)Math.PI / 180f)) * num9); num7 = num / Mathf.Sin(num5 / 2f * ((float)Math.PI / 180f)); Vector2 val6 = val3 + Vector2.left * num7; _altitudeHoldMaxDistance = val6.x; if (_debug) { Debug.Log((object)$"turnDistance: {num8}"); Debug.Log((object)$"descentDistance: {num9}"); Debug.Log((object)$"highestPointInTriangle AltitudeHold: {val3}"); Debug.Log((object)$"tangentPointExit: {val5}"); Debug.Log((object)$"tangentPointEnter2: {val6}"); Debug.Log((object)$"_startingDistanceToTarget: {_startingDistanceToTarget}"); Debug.Log((object)$"_altitudeHoldMaxDistance: {_altitudeHoldMaxDistance}"); } } } else { float num10 = num2 / Mathf.Tan(DirectAttackAttackAngle * ((float)Math.PI / 180f)); _startingDistanceToTarget = magnitude + num10; float num11 = DirectAttackLaunchAngle - Vector3.Angle(((Component)Projectile).transform.forward, Vector3.ProjectOnPlane(((Component)Projectile).transform.forward, Vector3.up)) * (((Component)Projectile).transform.forward.y / Mathf.Abs(((Component)Projectile).transform.forward.y)); _targetDirection = Quaternion.AngleAxis(0f - num11, ((Component)Projectile).transform.right) * ((Component)Projectile).transform.forward; _targetHeight = _startingDistanceToTarget * (Mathf.Tan(DirectAttackLaunchAngle * ((float)Math.PI / 180f)) * Mathf.Tan(DirectAttackAttackAngle * ((float)Math.PI / 180f))) / (Mathf.Tan(DirectAttackLaunchAngle * ((float)Math.PI / 180f)) + Mathf.Tan(DirectAttackAttackAngle * ((float)Math.PI / 180f))); if (_debug) { Debug.Log((object)$"First _targetHeight: {_targetHeight}"); } float num12 = 180f - (DirectAttackLaunchAngle + DirectAttackAttackAngle); float num13 = _targetHeight / Mathf.Sin(DirectAttackLaunchAngle * ((float)Math.PI / 180f)); Vector2 val7 = default(Vector2); ((Vector2)(ref val7))..ctor(Mathf.Cos(DirectAttackLaunchAngle * ((float)Math.PI / 180f)) * num13, Mathf.Sin(DirectAttackLaunchAngle * ((float)Math.PI / 180f)) * num13); float num14 = num / Mathf.Sin(num12 * ((float)Math.PI / 180f) / 2f); Vector2 val8 = val7 - ((Vector2)(ref val7)).normalized * num14; _targetHeight = val8.y; if (_debug) { Debug.Log((object)$"turnRadius: {num}"); Debug.Log((object)$"TargetDir: {val - ((Component)Projectile).transform.position}"); Debug.Log((object)$"deltaAngle: {num11}"); Debug.Log((object)$"_deltaHeight: {num2}"); Debug.Log((object)$"_deltaXZ: {magnitude}"); Debug.Log((object)$"_heightCorrection: {num10}"); Debug.Log((object)$"_startingDistanceToTarget: {_startingDistanceToTarget}"); Debug.Log((object)$"climbDistance: {num13}"); Debug.Log((object)$"highestPointInTriangle: {val7}"); Debug.Log((object)$"distanceToTurnCenter: {num14}"); Debug.Log((object)$"Final _targetHeight: {_targetHeight}"); Debug.Log((object)$"tangentPointEnter: {val8}"); } } } } public class SmartProjectile : MonoBehaviour { public class SmartProjectileData { public float TurningSpeed = 180f; public bool HasLimitedTurnAngle; public float TurnAngleLimit = 45f; [Tooltip("Doesn't work with AngleLimit cause the constant correction causes flown angles to add up quickly in target approach.")] public bool UsesInheritInaccuracy = true; public float AccuracyCircleRadius = 0.15f; public bool ScalesWithDistance = true; public float InaccuracyScaleOverDistanceFactor = 1.25f; public float BulletSwaySpeed = 0.5f; } public BallisticProjectile Projectile; [HideInInspector] public Vector3? TargetPoint; [HideInInspector] public Rigidbody TargetRB; [HideInInspector] public SosigLink TargetLink; public float TurningSpeed = 180f; public bool HasLimitedTurnAngle; public float TurnAngleLimit = 45f; [Tooltip("Doesn't work with AngleLimit cause the constant correction causes flown angles to add up quickly in target approach.")] public bool UsesInheritInaccuracy = true; public float AccuracyCircleRadius = 0.15f; public bool ScalesWithDistance = true; public float InaccuracyScaleOverDistanceFactor = 1.25f; public float BulletSwaySpeed = 0.5f; private float _turnedAngle; private Vector3 _curTarget; private Vector2 _currentInaccuracy = Vector2.zero; public void Awake() { //IL_001a: 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_003b: 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_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_0076: 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) if ((Object)(object)TargetLink != (Object)null) { _curTarget = ((Component)TargetLink).transform.position; } else if ((Object)(object)TargetRB != (Object)null) { _curTarget = TargetRB.position; } else if (TargetPoint.HasValue) { _curTarget = TargetPoint.Value; } else { Object.Destroy((Object)(object)this); } if (UsesInheritInaccuracy) { _currentInaccuracy = Random.insideUnitCircle * AccuracyCircleRadius; } } public void Update() { //IL_000b: 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_0021: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if (!UsesInheritInaccuracy) { return; } Vector2 val = Random.insideUnitCircle * AccuracyCircleRadius * BulletSwaySpeed * Time.deltaTime; float num = 0f; if (ScalesWithDistance) { float num2 = Vector3.Distance(_curTarget, ((Component)Projectile).transform.position); if (num2 > 1f) { num = Mathf.Pow((num2 - 1f) * (InaccuracyScaleOverDistanceFactor - 1f), 2f); val *= num; } } if (((Vector2)(ref _currentInaccuracy)).magnitude > AccuracyCircleRadius * (1f + num)) { _currentInaccuracy = ((Vector2)(ref _currentInaccuracy)).normalized * AccuracyCircleRadius * (1f + num); } Vector2 val2 = val + _currentInaccuracy; if (((Vector2)(ref val2)).magnitude < AccuracyCircleRadius * (1f + num)) { _currentInaccuracy += val; } } public void FixedUpdate() { //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_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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013d: 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_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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) if (_turnedAngle < TurnAngleLimit) { Vector3 velocity = Projectile.m_velocity; Quaternion val = ((((Vector3)(ref velocity)).magnitude == 0f) ? Quaternion.LookRotation(((Component)Projectile).transform.forward) : ((!(((Vector3)(ref velocity)).normalized != Vector3.up)) ? Quaternion.LookRotation(velocity, Vector3.right) : Quaternion.LookRotation(velocity, Vector3.up))); _curTarget = Vector3.zero; if ((Object)(object)TargetLink != (Object)null) { _curTarget = ((Component)TargetLink).transform.position; } else if ((Object)(object)TargetRB != (Object)null) { _curTarget = TargetRB.position; } else if (TargetPoint.HasValue) { _curTarget = TargetPoint.Value; } else { Object.Destroy((Object)(object)this); } Quaternion val2 = Quaternion.LookRotation(_curTarget + val * Vector2.op_Implicit(_currentInaccuracy) - ((Component)Projectile).transform.position); Quaternion val3 = Quaternion.RotateTowards(val, val2, TurningSpeed * Time.fixedDeltaTime) * Quaternion.Inverse(val); Projectile.m_velocity = val3 * velocity; if (!UsesInheritInaccuracy) { _turnedAngle += Vector3.Angle(Projectile.m_velocity, velocity); } } } public void ConfigureFromData(SmartProjectileData smartProjectileData) { TurningSpeed = smartProjectileData.TurningSpeed; HasLimitedTurnAngle = smartProjectileData.HasLimitedTurnAngle; TurnAngleLimit = smartProjectileData.TurnAngleLimit; UsesInheritInaccuracy = smartProjectileData.UsesInheritInaccuracy; AccuracyCircleRadius = smartProjectileData.AccuracyCircleRadius; ScalesWithDistance = smartProjectileData.ScalesWithDistance; InaccuracyScaleOverDistanceFactor = smartProjectileData.InaccuracyScaleOverDistanceFactor; BulletSwaySpeed = smartProjectileData.BulletSwaySpeed; } } public class SmartRevolver : MonoBehaviour { public Revolver revolver; public MeshRenderer reticle; public bool disableReticleWithoutTarget = true; public float EngageRange = 15f; [Range(1f, 179f)] public float EngageAngle = 45f; public float PrecisionAngle = 5f; public LayerMask LatchingMask; public LayerMask BlockingMask; public bool doesRandomRotationWithoutTarget = true; public float randomAngleMagnitude = 5f; private string nameOfDistanceVariable = "_RedDotDist"; public void Start() { Hook(); } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Handgun.UpdateInputAndAnimate += new hook_UpdateInputAndAnimate(Handgun_UpdateInputAndAnimate); } private void Handgun_UpdateInputAndAnimate(orig_UpdateInputAndAnimate orig, Handgun self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)revolver) { EarlyUpdate(); } orig.Invoke(self, hand); } public void EarlyUpdate() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0096: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((FVRInteractiveObject)revolver).m_hand != (Object)null)) { return; } Vector3 val = FindTarget(); if (val != new Vector3(0f, 0f, 0f)) { ((FVRFireArm)revolver).CurrentMuzzle.LookAt(val); ((FVRFireArm)revolver).MuzzlePos.LookAt(val); if ((Object)(object)reticle != (Object)null) { Material material = ((Renderer)reticle).material; string text = nameOfDistanceVariable; Vector3 val2 = val - ((FVRFireArm)revolver).CurrentMuzzle.position; material.SetFloat(text, ((Vector3)(ref val2)).magnitude); if (disableReticleWithoutTarget) { ((Component)reticle).gameObject.SetActive(true); } } } else { if (doesRandomRotationWithoutTarget) { Vector3 localEulerAngles = default(Vector3); localEulerAngles.x = Random.Range(0f - randomAngleMagnitude, randomAngleMagnitude); localEulerAngles.y = Random.Range(0f - randomAngleMagnitude, randomAngleMagnitude); ((FVRFireArm)revolver).CurrentMuzzle.localEulerAngles = localEulerAngles; ((FVRFireArm)revolver).MuzzlePos.localEulerAngles = localEulerAngles; } else { ((FVRFireArm)revolver).CurrentMuzzle.localEulerAngles = new Vector3(0f, 0f, 0f); ((FVRFireArm)revolver).MuzzlePos.localEulerAngles = new Vector3(0f, 0f, 0f); } if (disableReticleWithoutTarget && (Object)(object)reticle != (Object)null) { ((Component)reticle).gameObject.SetActive(false); } } } private Vector3 FindTarget() { //IL_002a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Invalid comparison between Unknown and I4 //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) float num = EngageRange * Mathf.Tan(0.5f * EngageAngle * ((float)Math.PI / 180f)); Collider[] array = Physics.OverlapCapsule(((FVRFireArm)revolver).CurrentMuzzle.position, ((FVRFireArm)revolver).CurrentMuzzle.position + ((Component)revolver).transform.forward * EngageRange, num, LayerMask.op_Implicit(LatchingMask)); List<Rigidbody> list = new List<Rigidbody>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].attachedRigidbody != (Object)null && !list.Contains(array[i].attachedRigidbody)) { list.Add(array[i].attachedRigidbody); } } bool flag = false; SosigLink val = null; SosigLink val2 = null; float num2 = EngageAngle; for (int j = 0; j < list.Count; j++) { SosigLink component = ((Component)list[j]).GetComponent<SosigLink>(); if (!((Object)(object)component == (Object)null) && (int)component.S.BodyState != 3) { float num3 = Vector3.Angle(((Component)list[j]).transform.position - ((FVRFireArm)revolver).CurrentMuzzle.position, ((Component)revolver).transform.forward); Sosig s = component.S; val2 = ((!(num3 <= PrecisionAngle)) ? s.Links[1] : s.Links[0]); if (num3 < num2 && !Physics.Linecast(((FVRFireArm)revolver).CurrentMuzzle.position, ((Component)val2).transform.position, LayerMask.op_Implicit(BlockingMask), (QueryTriggerInteraction)1)) { val = val2; num2 = num3; flag = true; } } } if (flag) { return ((Component)val).transform.position; } return new Vector3(0f, 0f, 0f); } } public class SmartRifle : MonoBehaviour { public ClosedBoltWeapon rifle; public MeshRenderer reticle; public bool disableReticleWithoutTarget = true; public float EngageRange = 15f; [Range(1f, 179f)] public float EngageAngle = 45f; public float PrecisionAngle = 5f; public LayerMask LatchingMask; public LayerMask BlockingMask; public bool locksUpWithoutTarget; public int safetyIndex; public bool doesRandomRotationWithoutTarget = true; public float randomAngleMagnitude = 5f; private string nameOfDistanceVariable = "_RedDotDist"; private bool isLocked; private int lastSelectorPos; public void Start() { Hook(); } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ClosedBoltWeapon.UpdateInputAndAnimate += new hook_UpdateInputAndAnimate(ClosedBoltWeapon_UpdateInputAndAnimate); } private void ClosedBoltWeapon_UpdateInputAndAnimate(orig_UpdateInputAndAnimate orig, ClosedBoltWeapon self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)rifle) { EarlyUpdate(); } orig.Invoke(self, hand); } public void EarlyUpdate() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0067: 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_0182: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_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) if (!((Object)(object)((FVRInteractiveObject)rifle).m_hand != (Object)null)) { return; } Vector3 val = FindTarget(); if (val != new Vector3(0f, 0f, 0f)) { if (locksUpWithoutTarget) { LockRifle(lockRifle: false); } ((FVRFireArm)rifle).CurrentMuzzle.LookAt(val); ((FVRFireArm)rifle).MuzzlePos.LookAt(val); if ((Object)(object)reticle != (Object)null) { Material material = ((Renderer)reticle).material; string text = nameOfDistanceVariable; Vector3 val2 = val - ((FVRFireArm)rifle).CurrentMuzzle.position; material.SetFloat(text, ((Vector3)(ref val2)).magnitude); if (disableReticleWithoutTarget) { ((Component)reticle).gameObject.SetActive(true); } } } else { if (locksUpWithoutTarget) { LockRifle(lockRifle: true); } if (doesRandomRotationWithoutTarget) { Vector3 localEulerAngles = default(Vector3); localEulerAngles.x = Random.Range(0f - randomAngleMagnitude, randomAngleMagnitude); localEulerAngles.y = Random.Range(0f - randomAngleMagnitude, randomAngleMagnitude); ((FVRFireArm)rifle).CurrentMuzzle.localEulerAngles = localEulerAngles; ((FVRFireArm)rifle).MuzzlePos.localEulerAngles = localEulerAngles; } else { ((FVRFireArm)rifle).CurrentMuzzle.localEulerAngles = new Vector3(0f, 0f, 0f); ((FVRFireArm)rifle).MuzzlePos.localEulerAngles = new Vector3(0f, 0f, 0f); } if (disableReticleWithoutTarget && (Object)(object)reticle != (Object)null) { ((Component)reticle).gameObject.SetActive(false); } } } private Vector3 FindTarget() { //IL_002a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Invalid comparison between Unknown and I4 //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) float num = EngageRange * Mathf.Tan(0.5f * EngageAngle * ((float)Math.PI / 180f)); Collider[] array = Physics.OverlapCapsule(((FVRFireArm)rifle).CurrentMuzzle.position, ((FVRFireArm)rifle).CurrentMuzzle.position + ((Component)rifle).transform.forward * EngageRange, num, LayerMask.op_Implicit(LatchingMask)); List<Rigidbody> list = new List<Rigidbody>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].attachedRigidbody != (Object)null && !list.Contains(array[i].attachedRigidbody)) { list.Add(array[i].attachedRigidbody); } } bool flag = false; SosigLink val = null; SosigLink val2 = null; float num2 = EngageAngle; for (int j = 0; j < list.Count; j++) { SosigLink component = ((Component)list[j]).GetComponent<SosigLink>(); if (!((Object)(object)component == (Object)null) && (int)component.S.BodyState != 3) { float num3 = Vector3.Angle(((Component)list[j]).transform.position - ((FVRFireArm)rifle).CurrentMuzzle.position, ((Component)rifle).transform.forward); Sosig s = component.S; val2 = ((!(num3 <= PrecisionAngle)) ? s.Links[1] : s.Links[0]); if (num3 < num2 && !Physics.Linecast(((FVRFireArm)rifle).CurrentMuzzle.position, ((Component)val2).transform.position, LayerMask.op_Implicit(BlockingMask), (QueryTriggerInteraction)1)) { val = val2; num2 = num3; flag = true; } } } if (flag) { return ((Component)val).transform.position; } return new Vector3(0f, 0f, 0f); } public void LockRifle(bool lockRifle) { if (lockRifle && !isLocked) { lastSelectorPos = rifle.m_fireSelectorMode; rifle.m_fireSelectorMode = safetyIndex; isLocked = true; } else if (lockRifle && isLocked) { rifle.m_fireSelectorMode = safetyIndex; } else if (!lockRifle && isLocked) { rifle.m_fireSelectorMode = lastSelectorPos; isLocked = false; } } } public class SmartPistol : MonoBehaviour { public Handgun pistol; public MeshRenderer reticle; public bool disableReticleWithoutTarget = true; public float EngageRange = 15f; [Range(1f, 179f)] public float EngageAngle = 45f; public float PrecisionAngle = 5f; public LayerMask LatchingMask; public LayerMask BlockingMask; public bool locksUpWithoutTarget = true; public bool doesRandomRotationWithoutTarget = true; public float randomAngleMagnitude = 5f; private string nameOfDistanceVariable = "_RedDotDist"; public void Start() { Hook(); } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Handgun.UpdateInputAndAnimate += new hook_UpdateInputAndAnimate(Handgun_UpdateInputAndAnimate); } private void Handgun_UpdateInputAndAnimate(orig_UpdateInputAndAnimate orig, Handgun self, FVRViveHand hand) { if ((Object)(object)self == (Object)(object)pistol) { EarlyUpdate(); } orig.Invoke(self, hand); } public void EarlyUpdate() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_006c: 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_018c: 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_0135: 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_0094: 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) if (!((Object)(object)((FVRInteractiveObject)pistol).m_hand != (Object)null)) { return; } Vector3 val = FindTarget(); if (val != new Vector3(0f, 0f, 0f)) { if (locksUpWithoutTarget) { pistol.m_isSafetyEngaged = false; } ((FVRFireArm)pistol).CurrentMuzzle.LookAt(val); ((FVRFireArm)pistol).MuzzlePos.LookAt(val); if ((Object)(object)reticle != (Object)null) { Material material = ((Renderer)reticle).material; string text = nameOfDistanceVariable; Vector3 val2 = val - ((FVRFireArm)pistol).CurrentMuzzle.position; material.SetFloat(text, ((Vector3)(ref val2)).magnitude); if (disableReticleWithoutTarget) { ((Component)reticle).gameObject.SetActive(true); } } } else { if (locksUpWithoutTarget) { pistol.m_isSafetyEngaged = true; } if (doesRandomRotationWithoutTarget) { Vector3 localEulerAngles = default(Vector3); localEulerAngles.x = Random.Range(0f - randomAngleMagnitude, randomAngleMagnitude); localEulerAngles.y = Random.Range(0f - randomAngleMagnitude, randomAngleMagnitude); ((FVRFireArm)pistol).CurrentMuzzle.localEulerAngles = localEulerAngles; ((FVRFireArm)pistol).MuzzlePos.localEulerAngles = localEulerAngles; } else { ((FVRFireArm)pistol).CurrentMuzzle.localEulerAngles = new Vector3(0f, 0f, 0f); ((FVRFireArm)pistol).MuzzlePos.localEulerAngles = new Vector3(0f, 0f, 0f); } if (disableReticleWithoutTarget && (Object)(object)reticle != (Object)null) { ((Component)reticle).gameObject.SetActive(false); } } } private Vector3 FindTarget() { //IL_002a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Invalid comparison between Unknown and I4 //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) float num = EngageRange * Mathf.Tan(0.5f * EngageAngle * ((float)Math.PI / 180f)); Collider[] array = Physics.OverlapCapsule(((FVRFireArm)pistol).CurrentMuzzle.position, ((FVRFireArm)pistol).CurrentMuzzle.position + ((Component)pistol).transform.forward * EngageRange, num, LayerMask.op_Implicit(LatchingMask)); List<Rigidbody> list = new List<Rigidbody>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].attachedRigidbody != (Object)null && !list.Contains(array[i].attachedRigidbody)) { list.Add(array[i].attachedRigidbody); } } bool flag = false; SosigLink val = null; SosigLink val2 = null; float num2 = EngageAngle; for (int j = 0; j < list.Count; j++) { SosigLink component = ((Component)list[j]).GetComponent<SosigLink>(); if (!((Object)(object)component == (Object)null) && (int)component.S.BodyState != 3) { float num3 = Vector3.Angle(((Component)list[j]).transform.position - ((FVRFireArm)pistol).CurrentMuzzle.position, ((Component)pistol).transform.forward); Sosig s = component.S; val2 = ((!(num3 <= PrecisionAngle)) ? s.Links[1] : s.Links[0]); if (num3 < num2 && !Physics.Linecast(((FVRFireArm)pistol).CurrentMuzzle.position, ((Component)val2).transform.position, LayerMask.op_Implicit(BlockingMask), (QueryTriggerInteraction)1)) { val = val2; num2 = num3; flag = true; } } } if (flag) { return ((Component)val).transform.position; } return new Vector3(0f, 0f, 0f); } }
plugins/SwitchBlade.dll
Decompiled 10 months agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("SwitchBlade")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SwitchBlade")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8937393d-75f3-4d80-8ca4-25d652985015")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] public class SwitchBladeProxy : MonoBehaviour { public Transform Blade; public Vector2 BladeRotRange = new Vector2(-90f, 90f); public float BladeOpeningTime; public float BladeClosingTime; public FVRMeleeWeapon FVRMelee; public AudioSource audio_source; public AudioClip open_clip; public AudioClip close_clip; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) SwitchBladeWeapon switchBladeWeapon = SwitchBladeWeapon.CopyFromMeleeWeapon(FVRMelee, ((Component)this).gameObject); switchBladeWeapon.Blade = Blade; switchBladeWeapon.BladeRotRange = BladeRotRange; switchBladeWeapon.BladeOpeningTime = BladeOpeningTime; switchBladeWeapon.BladeClosingTime = BladeClosingTime; switchBladeWeapon.audio_source = audio_source; switchBladeWeapon.open_clip = open_clip; switchBladeWeapon.close_clip = close_clip; ((Component)this).gameObject.SetActive(true); } } namespace FistVR { [AddComponentMenu("Script/SwitchBlade")] public class SwitchBladeWeapon : FVRMeleeWeapon { public enum SwitchBladeState { Closing, Closed, Opening, Open } public Transform Blade; public Vector2 BladeRotRange = new Vector2(-90f, 90f); public float BladeOpeningTime; public float BladeClosingTime; public AudioSource audio_source; public AudioClip open_clip; public AudioClip close_clip; private SwitchBladeState sbState = SwitchBladeState.Closed; private float timeElapsed; public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin) { ToggleSwitchBladeState(); } } private void ToggleSwitchBladeState() { if (!((FVRPhysicalObject)this).MP.IsJointedToObject) { if (sbState == SwitchBladeState.Closed) { PlaySound(audio_source, open_clip); ((MonoBehaviour)this).StartCoroutine("OpenBlade"); ((FVRPhysicalObject)this).MP.CanNewStab = true; } else if (sbState == SwitchBladeState.Open) { PlaySound(audio_source, close_clip); ((MonoBehaviour)this).StartCoroutine("CloseBlade"); ((FVRPhysicalObject)this).MP.CanNewStab = false; } } } private void SetBladeRot(float f) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) Blade.localEulerAngles = new Vector3(Mathf.Lerp(BladeRotRange.x, BladeRotRange.y, f), 0f, 0f); } private IEnumerator OpenBlade() { sbState = SwitchBladeState.Opening; timeElapsed = 0f; while (timeElapsed < BladeOpeningTime) { timeElapsed += Time.deltaTime; SetBladeRot(timeElapsed / BladeOpeningTime); yield return null; } SetBladeRot(1f); sbState = SwitchBladeState.Open; } private IEnumerator CloseBlade() { sbState = SwitchBladeState.Closing; timeElapsed = 0f; while (timeElapsed < BladeClosingTime) { timeElapsed += Time.deltaTime; SetBladeRot(1f - timeElapsed / BladeClosingTime); yield return null; } SetBladeRot(0f); sbState = SwitchBladeState.Closed; } private void PlaySound(AudioSource A_source, AudioClip A_clip) { A_source.clip = A_clip; A_source.Play(); } public static SwitchBladeWeapon CopyFromMeleeWeapon(FVRMeleeWeapon original, GameObject target) { //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_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_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_011c: 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_0128: 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_0134: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) target.gameObject.SetActive(false); SwitchBladeWeapon switchBladeWeapon = target.AddComponent<SwitchBladeWeapon>(); ((FVRInteractiveObject)switchBladeWeapon).ControlType = ((FVRInteractiveObject)original).ControlType; ((FVRInteractiveObject)switchBladeWeapon).IsSimpleInteract = ((FVRInteractiveObject)original).IsSimpleInteract; ((FVRInteractiveObject)switchBladeWeapon).HandlingGrabSound = ((FVRInteractiveObject)original).HandlingGrabSound; ((FVRInteractiveObject)switchBladeWeapon).HandlingReleaseSound = ((FVRInteractiveObject)original).HandlingReleaseSound; ((FVRInteractiveObject)switchBladeWeapon).PoseOverride = ((FVRInteractiveObject)original).PoseOverride; ((FVRInteractiveObject)switchBladeWeapon).QBPoseOverride = ((FVRInteractiveObject)original).QBPoseOverride; ((FVRInteractiveObject)switchBladeWeapon).PoseOverride_Touch = ((FVRInteractiveObject)original).PoseOverride_Touch; ((FVRInteractiveObject)switchBladeWeapon).UseGrabPointChild = ((FVRInteractiveObject)original).UseGrabPointChild; ((FVRInteractiveObject)switchBladeWeapon).UseGripRotInterp = ((FVRInteractiveObject)original).UseGripRotInterp; ((FVRInteractiveObject)switchBladeWeapon).PositionInterpSpeed = ((FVRInteractiveObject)original).PositionInterpSpeed; ((FVRInteractiveObject)switchBladeWeapon).RotationInterpSpeed = ((FVRInteractiveObject)original).RotationInterpSpeed; ((FVRInteractiveObject)switchBladeWeapon).EndInteractionIfDistant = ((FVRInteractiveObject)original).EndInteractionIfDistant; ((FVRInteractiveObject)switchBladeWeapon).EndInteractionDistance = ((FVRInteractiveObject)original).EndInteractionDistance; ((FVRInteractiveObject)switchBladeWeapon).UXGeo_Held = ((FVRInteractiveObject)original).UXGeo_Held; ((FVRInteractiveObject)switchBladeWeapon).UXGeo_Hover = ((FVRInteractiveObject)original).UXGeo_Hover; ((FVRInteractiveObject)switchBladeWeapon).UseFilteredHandTransform = ((FVRInteractiveObject)original).UseFilteredHandTransform; ((FVRInteractiveObject)switchBladeWeapon).UseFilteredHandRotation = ((FVRInteractiveObject)original).UseFilteredHandRotation; ((FVRInteractiveObject)switchBladeWeapon).UseFilteredHandPosition = ((FVRInteractiveObject)original).UseFilteredHandPosition; ((FVRInteractiveObject)switchBladeWeapon).UseSecondStepRotationFiltering = ((FVRInteractiveObject)original).UseSecondStepRotationFiltering; ((FVRPhysicalObject)switchBladeWeapon).ObjectWrapper = ((FVRPhysicalObject)original).ObjectWrapper; ((FVRPhysicalObject)switchBladeWeapon).SpawnLockable = ((FVRPhysicalObject)original).SpawnLockable; ((FVRPhysicalObject)switchBladeWeapon).Harnessable = ((FVRPhysicalObject)original).Harnessable; ((FVRPhysicalObject)switchBladeWeapon).HandlingReleaseIntoSlotSound = ((FVRPhysicalObject)original).HandlingReleaseIntoSlotSound; ((FVRPhysicalObject)switchBladeWeapon).Size = ((FVRPhysicalObject)original).Size; ((FVRPhysicalObject)switchBladeWeapon).QBSlotType = ((FVRPhysicalObject)original).QBSlotType; ((FVRPhysicalObject)switchBladeWeapon).ThrowVelMultiplier = ((FVRPhysicalObject)original).ThrowVelMultiplier; ((FVRPhysicalObject)switchBladeWeapon).ThrowAngMultiplier = ((FVRPhysicalObject)original).ThrowAngMultiplier; ((FVRPhysicalObject)switchBladeWeapon).UsesGravity = ((FVRPhysicalObject)original).UsesGravity; ((FVRPhysicalObject)switchBladeWeapon).DependantRBs = ((FVRPhysicalObject)original).DependantRBs; ((FVRPhysicalObject)switchBladeWeapon).DistantGrabbable = ((FVRPhysicalObject)original).DistantGrabbable; ((FVRPhysicalObject)switchBladeWeapon).IsDebug = ((FVRPhysicalObject)original).IsDebug; ((FVRPhysicalObject)switchBladeWeapon).IsAltHeld = ((FVRPhysicalObject)original).IsAltHeld; ((FVRPhysicalObject)switchBladeWeapon).IsKinematicLocked = ((FVRPhysicalObject)original).IsKinematicLocked; ((FVRPhysicalObject)switchBladeWeapon).DoesQuickbeltSlotFollowHead = ((FVRPhysicalObject)original).DoesQuickbeltSlotFollowHead; ((FVRPhysicalObject)switchBladeWeapon).IsInWater = ((FVRPhysicalObject)original).IsInWater; ((FVRPhysicalObject)switchBladeWeapon).AttachmentMounts = ((FVRPhysicalObject)original).AttachmentMounts; ((FVRPhysicalObject)switchBladeWeapon).IsAltToAltTransfer = ((FVRPhysicalObject)original).IsAltToAltTransfer; ((FVRPhysicalObject)switchBladeWeapon).CollisionSound = ((FVRPhysicalObject)original).CollisionSound; ((FVRPhysicalObject)switchBladeWeapon).IsPickUpLocked = ((FVRPhysicalObject)original).IsPickUpLocked; ((FVRPhysicalObject)switchBladeWeapon).OverridesObjectToHand = ((FVRPhysicalObject)original).OverridesObjectToHand; ((FVRPhysicalObject)switchBladeWeapon).MP = ((FVRPhysicalObject)original).MP; Object.Destroy((Object)(object)original); return switchBladeWeapon; } } } namespace Cityrobo { public class SwitchBladeMK2 : MonoBehaviour { public enum SwitchBladeState { Closing, Closed, Opening, Open } public FVRMeleeWeapon MeleeWeapon; public Transform Blade; public Vector2 BladeRotRange = new Vector2(-90f, 90f); public float BladeOpeningTime; public float BladeClosingTime; public AudioEvent OpenSound; public AudioEvent CloseSound; private SwitchBladeState _switchBladeState = SwitchBladeState.Closed; private float _timeElapsed; public void Update() { FVRViveHand hand = ((FVRInteractiveObject)MeleeWeapon).m_hand; if ((Object)(object)hand != (Object)null && hand.Input.TriggerDown) { ToggleSwitchBladeState(); } } private void ToggleSwitchBladeState() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!((FVRPhysicalObject)MeleeWeapon).MP.IsJointedToObject) { if (_switchBladeState == SwitchBladeState.Closed) { SM.PlayGenericSound(OpenSound, ((Component)MeleeWeapon).transform.position); ((MonoBehaviour)this).StartCoroutine(OpenBlade()); ((FVRPhysicalObject)MeleeWeapon).MP.CanNewStab = true; } else if (_switchBladeState == SwitchBladeState.Open) { SM.PlayGenericSound(CloseSound, ((Component)MeleeWeapon).transform.position); ((MonoBehaviour)this).StartCoroutine(CloseBlade()); ((FVRPhysicalObject)MeleeWeapon).MP.CanNewStab = false; } } } private void SetBladeRot(float f) { //IL_0026: 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_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_0043: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Euler(Mathf.Lerp(BladeRotRange.x, BladeRotRange.y, f), 0f, 0f); Blade.localRotation = Quaternion.RotateTowards(Blade.localRotation, val, float.MaxValue); } private IEnumerator OpenBlade() { _switchBladeState = SwitchBladeState.Opening; _timeElapsed = 0f; while (_timeElapsed < BladeOpeningTime) { _timeElapsed += Time.deltaTime; SetBladeRot(_timeElapsed / BladeOpeningTime); yield return null; } SetBladeRot(1f); _switchBladeState = SwitchBladeState.Open; } private IEnumerator CloseBlade() { _switchBladeState = SwitchBladeState.Closing; _timeElapsed = 0f; while (_timeElapsed < BladeClosingTime) { _timeElapsed += Time.deltaTime; SetBladeRot(1f - _timeElapsed / BladeClosingTime); yield return null; } SetBladeRot(0f); _switchBladeState = SwitchBladeState.Closed; } } public class SwitchBlade : FVRMeleeWeapon { public enum SwitchBladeState { Closing, Closed, Opening, Open } public Transform Blade; public Vector2 BladeRotRange = new Vector2(-90f, 90f); public float BladeOpeningTime; public float BladeClosingTime; public AudioSource audio_source; public AudioClip open_clip; public AudioClip close_clip; private SwitchBladeState sbState = SwitchBladeState.Closed; private float timeElapsed; public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin) { ToggleSwitchBladeState(); } } private void ToggleSwitchBladeState() { if (!((FVRPhysicalObject)this).MP.IsJointedToObject) { if (sbState == SwitchBladeState.Closed) { PlaySound(audio_source, open_clip); ((MonoBehaviour)this).StartCoroutine("OpenBlade"); ((FVRPhysicalObject)this).MP.CanNewStab = true; } else if (sbState == SwitchBladeState.Open) { PlaySound(audio_source, close_clip); ((MonoBehaviour)this).StartCoroutine("CloseBlade"); ((FVRPhysicalObject)this).MP.CanNewStab = false; } } } private void SetBladeRot(float f) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) Blade.localEulerAngles = new Vector3(Mathf.Lerp(BladeRotRange.x, BladeRotRange.y, f), 0f, 0f); } private IEnumerator OpenBlade() { sbState = SwitchBladeState.Opening; timeElapsed = 0f; while (timeElapsed < BladeOpeningTime) { timeElapsed += Time.deltaTime; SetBladeRot(timeElapsed / BladeOpeningTime); yield return null; } SetBladeRot(1f); sbState = SwitchBladeState.Open; } private IEnumerator CloseBlade() { sbState = SwitchBladeState.Closing; timeElapsed = 0f; while (timeElapsed < BladeClosingTime) { timeElapsed += Time.deltaTime; SetBladeRot(1f - timeElapsed / BladeClosingTime); yield return null; } SetBladeRot(0f); sbState = SwitchBladeState.Closed; } private void PlaySound(AudioSource A_source, AudioClip A_clip) { A_source.clip = A_clip; A_source.Play(); } } }
plugins/TemplateProject.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TemplateProject")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TemplateProject")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("467aa765-c9e8-4b7d-8fd6-348c5f43aac4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class Class1 : MonoBehaviour { }
plugins/ThermalVision_Enabler.dll
Decompiled 10 months agousing 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 BepInEx; using BepInEx.Configuration; using FistVR; using On.FistVR; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("WorldThermalVision_Enabler")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WorldThermalVision_Enabler")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1336f700-ac65-4851-b332-7b638e3f32cb")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [ExecuteInEditMode] public class ThermalBody : MonoBehaviour { [Range(0.5f, 8f)] public float ThermalDistribution = 4f; [Range(0f, 1f)] public float MaximumTemperature = 1f; [Range(0.001f, 1f)] public float MinimumTemperature = 0.001f; public bool isVariable; private List<Renderer> _childrenRenderers; private List<Material> origMaterialList; private List<Material> newMaterialsList; private void OnEnable() { if (MinimumTemperature < 0.001f) { MinimumTemperature = 0.001f; } _childrenRenderers = new List<Renderer>(((Component)this).GetComponentsInChildren<Renderer>()); if (origMaterialList == null) { origMaterialList = new List<Material>(); } else { origMaterialList.Clear(); } if (newMaterialsList == null) { newMaterialsList = new List<Material>(); } else { newMaterialsList.Clear(); } if (isVariable) { CopyMaterials(); } UpdateSubMaterialProperties(); } public void UpdateSubMaterialProperties() { if (_childrenRenderers.Count == 0) { return; } foreach (Renderer childrenRenderer in _childrenRenderers) { if (!((Object)(object)((Component)childrenRenderer).gameObject.GetComponent<ThermalBody>() == (Object)null) && !((Object)(object)((Component)childrenRenderer).gameObject == (Object)(object)((Component)this).gameObject)) { continue; } Material[] sharedMaterials = childrenRenderer.sharedMaterials; if (sharedMaterials.Length == 0) { continue; } Material[] array = sharedMaterials; foreach (Material val in array) { if ((Object)(object)val != (Object)null && val.renderQueue == 2000) { if (MaximumTemperature > 0.3f) { val.SetOverrideTag("Thermal", "Hot"); } else { val.SetOverrideTag("Thermal", "Cold"); } val.SetFloat("_ThermalPowExponent", ThermalDistribution); val.SetFloat("_ThermalMax", MaximumTemperature); val.SetFloat("_ThermalMin", MinimumTemperature); } } } } public void RestoreSubMaterialProperties() { if (_childrenRenderers.Count == 0) { return; } foreach (Renderer childrenRenderer in _childrenRenderers) { if (!((Object)(object)((Component)childrenRenderer).gameObject.GetComponent<ThermalBody>() == (Object)null) && !((Object)(object)((Component)childrenRenderer).gameObject == (Object)(object)((Component)this).gameObject)) { continue; } Material[] sharedMaterials = childrenRenderer.sharedMaterials; if (sharedMaterials.Length == 0) { continue; } Material[] array = sharedMaterials; foreach (Material val in array) { if ((Object)(object)val != (Object)null) { val.SetOverrideTag("Thermal", ""); } } } } private void OnDisable() { _ = isVariable; } public void OnDestroy() { if (isVariable) { ClearMaterials(); } } private void CopyMaterials() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown if (_childrenRenderers.Count == 0) { return; } foreach (Renderer childrenRenderer in _childrenRenderers) { if (!((Object)(object)((Component)childrenRenderer).gameObject.GetComponent<ThermalBody>() == (Object)null) && !((Object)(object)((Component)childrenRenderer).gameObject == (Object)(object)((Component)this).gameObject)) { continue; } Material[] sharedMaterials = childrenRenderer.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { if ((Object)(object)sharedMaterials[i] != (Object)null) { origMaterialList.Add(sharedMaterials[i]); } } for (int j = 0; j < childrenRenderer.sharedMaterials.Length; j++) { if ((Object)(object)sharedMaterials[j] != (Object)null) { childrenRenderer.materials[j] = new Material(sharedMaterials[j]); newMaterialsList.Add(childrenRenderer.materials[j]); } } } } private void RestoreMaterials() { if (_childrenRenderers.Count != 0) { foreach (Renderer childrenRenderer in _childrenRenderers) { if (!((Object)(object)((Component)childrenRenderer).gameObject.GetComponent<ThermalBody>() == (Object)null) && !((Object)(object)((Component)childrenRenderer).gameObject == (Object)(object)((Component)this).gameObject)) { continue; } Material[] sharedMaterials = childrenRenderer.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { if ((Object)(object)sharedMaterials[i] != (Object)null) { childrenRenderer.sharedMaterials[i] = origMaterialList[i]; } } } } for (int j = 0; j < newMaterialsList.Count; j++) { Object.Destroy((Object)(object)newMaterialsList[j]); } newMaterialsList.Clear(); } private void ClearMaterials() { for (int i = 0; i < newMaterialsList.Count; i++) { Object.Destroy((Object)(object)newMaterialsList[i]); } newMaterialsList.Clear(); } } namespace MiguelFerreira { public class ThermalVisionMode : MonoBehaviour { public Shader thermalShader; public Texture2D thermalLookUpTexture; public bool useOwnRenderTexture; public RenderTexture referenceRenderTexture; public MeshRenderer screen; private RenderingPath mainCameraOriginalRenderingPath; private bool mainCameraOriginalOcclusionCulling; private RenderTexture renderTexture; private Camera _mainCamera; private Camera MainCamera { get { if ((Object)(object)_mainCamera == (Object)null) { _mainCamera = ((Component)this).GetComponent<Camera>(); } return _mainCamera; } } public void OnEnable() { //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) Shader.SetGlobalTexture("_ThermalColorLUT", (Texture)(object)thermalLookUpTexture); mainCameraOriginalOcclusionCulling = MainCamera.useOcclusionCulling; mainCameraOriginalRenderingPath = MainCamera.renderingPath; MainCamera.useOcclusionCulling = false; MainCamera.renderingPath = (RenderingPath)1; MainCamera.SetReplacementShader(thermalShader, "Thermal"); if (useOwnRenderTexture) { renderTexture = Object.Instantiate<RenderTexture>(referenceRenderTexture); MainCamera.targetTexture = renderTexture; ((Renderer)screen).material.mainTexture = (Texture)(object)renderTexture; } } public void OnDisable() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) MainCamera.useOcclusionCulling = mainCameraOriginalOcclusionCulling; MainCamera.renderingPath = mainCameraOriginalRenderingPath; MainCamera.ResetReplacementShader(); } private RenderTexture CopyRenderTexture(RenderTexture reference) { //IL_0013: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown return new RenderTexture(((Texture)reference).width, ((Texture)reference).height, reference.depth, reference.format, (RenderTextureReadWrite)2) { antiAliasing = reference.antiAliasing, useMipMap = reference.useMipMap, autoGenerateMips = reference.autoGenerateMips, wrapMode = ((Texture)reference).wrapMode, filterMode = ((Texture)reference).filterMode, anisoLevel = ((Texture)reference).anisoLevel }; } } } namespace Cityrobo { [RequireComponent(typeof(ThermalBody))] public class CoolingDownPart : MonoBehaviour { public float heatDissipatedPerSecond = 0.1f; public float startingHeat; private float heat; public ThermalBody tB; private float tbMaxTemp; private float tbMinTemp; private bool wasEnabled; public void OnEnable() { if ((Object)(object)tB == (Object)null) { tB = ((Component)this).gameObject.GetComponent<ThermalBody>(); } ((Behaviour)tB).enabled = false; tB.isVariable = true; ((Behaviour)tB).enabled = true; tbMaxTemp = tB.MaximumTemperature; tbMinTemp = tB.MinimumTemperature; heat = startingHeat; wasEnabled = true; } public void OnDisable() { heat = tbMaxTemp; if ((Object)(object)tB != (Object)null) { tB.MaximumTemperature = heat; tB.UpdateSubMaterialProperties(); } wasEnabled = false; } private void Update() { if (wasEnabled && heat > tbMaxTemp) { tB.MaximumTemperature = heat; tB.UpdateSubMaterialProperties(); heat -= Time.deltaTime * heatDissipatedPerSecond; if (heat < tbMaxTemp) { heat = tbMaxTemp; } if (heat > 1f) { tB.MinimumTemperature = heat - 1f + tbMinTemp; } else { tB.MinimumTemperature = tbMinTemp; } } } } [RequireComponent(typeof(ThermalBody))] public class HeatingUpAttachmentPart : MonoBehaviour { public FVRFireArmAttachment attachment; public float heatPerShot; public float heatDissipatedPerSecond; private FVRFireArmChamber chamber; private bool chamberLoaded; private float heat; private ThermalBody tB; private float tbMaxTemp; private float tbMinTemp; private bool logOnce; private void Start() { if ((Object)(object)attachment == (Object)null) { attachment = ((Component)this).gameObject.GetComponent<FVRFireArmAttachment>(); } tB = ((Component)this).gameObject.GetComponent<ThermalBody>(); ((Behaviour)tB).enabled = false; tB.isVariable = true; ((Behaviour)tB).enabled = true; tbMaxTemp = tB.MaximumTemperature; tbMinTemp = tB.MinimumTemperature; heat = tbMaxTemp; } private void Update() { if (heat > tbMaxTemp) { tB.MaximumTemperature = heat; tB.UpdateSubMaterialProperties(); heat -= Time.deltaTime * heatDissipatedPerSecond; if (heat < tbMaxTemp) { heat = tbMaxTemp; } if (heat > 1f) { tB.MinimumTemperature = heat - 1f + tbMinTemp; } else { tB.MinimumTemperature = tbMinTemp; } } if ((Object)(object)attachment.curMount != (Object)null) { FVRPhysicalObject myObject = attachment.curMount.GetRootMount().MyObject; getChamber((FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null)); } if ((Object)(object)chamber != (Object)null) { if (!chamberLoaded && (Object)(object)chamber.m_round != (Object)null && !chamber.m_round.IsSpent) { chamberLoaded = true; } else if (chamberLoaded && (((Object)(object)chamber.m_round != (Object)null && chamber.m_round.IsSpent) || (Object)(object)chamber.m_round == (Object)null)) { heat += heatPerShot; chamberLoaded = false; } } } private void getChamber(FVRFireArm fireArm) { if ((Object)(object)fireArm == (Object)null) { chamber = null; return; } ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null); if (val == null) { OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null); if (val2 == null) { Handgun val3 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null); if (val3 == null) { if (!logOnce) { Debug.LogError((object)"Error in HeatingUpAttachmentPart script! Weapon type not yet supported!"); } chamber = null; logOnce = true; return; } chamber = val3.Chamber; } else { chamber = val2.Chamber; } } else { chamber = val.Chamber; } logOnce = false; } } [RequireComponent(typeof(ThermalBody))] public class HeatingUpWeaponPart : MonoBehaviour { public FVRFireArm fireArm; public float heatPerShot; public float heatDissipatedPerSecond; private FVRFireArmChamber chamber; private bool chamberLoaded; private float heat; private ThermalBody tB; private float tbMaxTemp; private float tbMinTemp; private void Start() { tB = ((Component)this).gameObject.GetComponent<ThermalBody>(); ((Behaviour)tB).enabled = false; tB.isVariable = true; ((Behaviour)tB).enabled = true; tbMaxTemp = tB.MaximumTemperature; tbMinTemp = tB.MinimumTemperature; heat = tbMaxTemp; FVRFireArm val = fireArm; ClosedBoltWeapon val2 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val2 == null) { OpenBoltReceiver val3 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val3 == null) { Handgun val4 = (Handgun)(object)((val is Handgun) ? val : null); if (val4 != null) { chamber = val4.Chamber; } else { Debug.LogError((object)"Error in HeatingUpWeaponPart script! Weapon type not yet supported!"); } } else { chamber = val3.Chamber; } } else { chamber = val2.Chamber; } } private void Update() { if (heat > tbMaxTemp) { tB.MaximumTemperature = heat; tB.UpdateSubMaterialProperties(); heat -= Time.deltaTime * heatDissipatedPerSecond; if (heat < tbMaxTemp) { heat = tbMaxTemp; } } if (heat > 1f) { tB.MinimumTemperature = heat - 1f + tbMinTemp; } else { tB.MinimumTemperature = tbMinTemp; } if ((Object)(object)chamber != (Object)null) { if (!chamberLoaded && (Object)(object)chamber.m_round != (Object)null && !chamber.m_round.IsSpent) { chamberLoaded = true; } else if (chamberLoaded && (((Object)(object)chamber.m_round != (Object)null && chamber.m_round.IsSpent) || (Object)(object)chamber.m_round == (Object)null)) { heat += heatPerShot; chamberLoaded = false; } } } } public static class StaticExtras { public static T GetCopyOf<T>(this Component comp, T other) where T : Component { Type type = ((object)comp).GetType(); if ((object)type != ((object)other).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite) { try { propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null); } catch { } } } FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(comp, fieldInfo.GetValue(other)); } return (T)(object)((comp is T) ? comp : null); } public static T GetCopyOf<T>(this Object comp, T other) where T : Object { Type type = ((object)comp).GetType(); if ((object)type != ((object)other).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite) { try { propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null); } catch { } } } FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(comp, fieldInfo.GetValue(other)); } return (T)(object)((comp is T) ? comp : null); } } [BepInPlugin("h3vr.cityrobo.thermalvision", "ThermalVision Enabler", "1.2.0")] public class ThermalVision_BepInEx : BaseUnityPlugin { public static ThermalVision_Hooks ThermalHooks; public static ThermalVision_BepInEx ThermalPlugin; public ThermalVision_Hooks.TemperatureData TemperatureData; public ConfigEntry<bool> enableThermalVision; private ConfigEntry<float> sosig_ThermalDistribution; private ConfigEntry<float> sosig_MaximumTemperature; private ConfigEntry<float> sosig_MinimumTemperature; private ConfigEntry<bool> encryption_hot; private ConfigEntry<float> encryption_ThermalDistributionHot; private ConfigEntry<float> encryption_MaximumTemperatureHot; private ConfigEntry<float> encryption_MinimumTemperatureHot; private ConfigEntry<float> physicalObject_ThermalDistribution; private ConfigEntry<float> physicalObject_MaximumTemperature; private ConfigEntry<float> physicalObject_MinimumTemperature; private ConfigEntry<float> muzzleDevice_HeatingRate; private ConfigEntry<float> muzzleDevice_CoolingRate; public ThermalVision_BepInEx() { ThermalPlugin = this; enableThermalVision = ((BaseUnityPlugin)this).Config.Bind<bool>("Thermal Vision Plugin Settings", "Enable Full Thermal Vision Hooks", true, "This enables most of the heavy code hooks that add features like heating casings and such. Sosigs, Items and Encryptions still get thermals."); sosig_ThermalDistribution = ((BaseUnityPlugin)this).Config.Bind<float>("Sosig ThermalBody Settings", "ThermalDistribution", 8f, "Thermal Distribution of Sosig Bodies (between 0 and 8)"); sosig_MaximumTemperature = ((BaseUnityPlugin)this).Config.Bind<float>("Sosig ThermalBody Settings", "MaximumTemperature", 0.3f, "Maximum Temperature of Sosig Bodies (between 0 and 1)"); sosig_MinimumTemperature = ((BaseUnityPlugin)this).Config.Bind<float>("Sosig ThermalBody Settings", "MinimumTemperature", 0.6f, "Minimum Temperature of Sosig Bodies (between 0 and 1) (yes, this is higher than the max temp because IDK it looks better in game)"); encryption_hot = ((BaseUnityPlugin)this).Config.Bind<bool>("Encryption ThermalBody Settings", "Encryptions are Hot", true, "if true, encryptions will appear hot in thermal vision."); encryption_ThermalDistributionHot = ((BaseUnityPlugin)this).Config.Bind<float>("Encryption ThermalBody Settings", "ThermalDistribution", 8f, "Thermal Distribution of Encryptions (between 0 and 8)"); encryption_MaximumTemperatureHot = ((BaseUnityPlugin)this).Config.Bind<float>("Encryption ThermalBody Settings", "MaximumTemperature", 0.3f, "Maximum Temperature of Encryptions (between 0 and 1)"); encryption_MinimumTemperatureHot = ((BaseUnityPlugin)this).Config.Bind<float>("Encryption ThermalBody Settings", "MinimumTemperature", 0.6f, "Minimum Temperature of Encryptions (between 0 and 1) (yes, this is higher than the max temp because IDK it looks better in game)"); physicalObject_ThermalDistribution = ((BaseUnityPlugin)this).Config.Bind<float>("PhysicalObject ThermalBody Settings", "ThermalDistribution", 4f, "Thermal Distribution of Objects in game (between 0 and 8)"); physicalObject_MaximumTemperature = ((BaseUnityPlugin)this).Config.Bind<float>("PhysicalObject ThermalBody Settings", "MaximumTemperature", 0.15f, "Maximum Temperature of Objects in game (between 0 and 1)"); physicalObject_MinimumTemperature = ((BaseUnityPlugin)this).Config.Bind<float>("PhysicalObject ThermalBody Settings", "MinimumTemperature", 0.001f, "Minimum Temperature of Objects in game (between 0 and 1)"); muzzleDevice_HeatingRate = ((BaseUnityPlugin)this).Config.Bind<float>("Muzzle Device Heating Settings", "Heat per Shot", 0.1f, "Heat gained per Shot"); muzzleDevice_CoolingRate = ((BaseUnityPlugin)this).Config.Bind<float>("Muzzle Device Heating Settings", "Cooling per Second", 0.1f, "Heat cooled off per Second"); TemperatureData.sosig_tempDist = sosig_ThermalDistribution.Value; TemperatureData.sosig_maxTemp = sosig_MaximumTemperature.Value; TemperatureData.sosig_minTemp = sosig_MinimumTemperature.Value; TemperatureData.encryption_hot = encryption_hot.Value; TemperatureData.encryption_tempDistHot = encryption_ThermalDistributionHot.Value; TemperatureData.encryption_maxTempHot = encryption_MaximumTemperatureHot.Value; TemperatureData.encryption_minTempHot = encryption_MinimumTemperatureHot.Value; TemperatureData.physicalObject_tempDist = physicalObject_ThermalDistribution.Value; TemperatureData.physicalObject_maxTemp = physicalObject_MaximumTemperature.Value; TemperatureData.physicalObject_minTemp = physicalObject_MinimumTemperature.Value; TemperatureData.muzzleDevice_HeatingRate = muzzleDevice_HeatingRate.Value; TemperatureData.muzzleDevice_CoolingRate = muzzleDevice_CoolingRate.Value; if (enableThermalVision.Value) { ThermalHooks = new ThermalVision_Hooks(); } else { ThermalHooks = new ThermalVision_Hooks(); } } private void OnDestroy() { ThermalHooks?.Unhook(); } } public class ThermalVision_Hooks { public struct TemperatureData { public float sosig_tempDist; public float sosig_maxTemp; public float sosig_minTemp; public bool encryption_hot; public float encryption_tempDistHot; public float encryption_maxTempHot; public float encryption_minTempHot; public float physicalObject_tempDist; public float physicalObject_maxTemp; public float physicalObject_minTemp; public float muzzleDevice_HeatingRate; public float muzzleDevice_CoolingRate; } private TemperatureData temperatureData; private bool essentialsOnly; public static float sosig_tempDist; public static float sosig_maxTemp; public static float sosig_minTemp; public static float physicalObject_tempDist; public static float physicalObject_maxTemp; public static float physicalObject_minTemp; public static bool IsHooked; public void Unhook() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (essentialsOnly) { Sosig.Start -= new hook_Start(Sosig_Start); FVRPhysicalObject.Awake -= new hook_Awake(FVRPhysicalObject_Awake); TNH_EncryptionTarget.Start -= new hook_Start(TNH_EncryptionTarget_Start); } else { Sosig.Start -= new hook_Start(Sosig_Start); FVRPhysicalObject.Awake -= new hook_Awake(FVRPhysicalObject_Awake); TNH_EncryptionTarget.Start -= new hook_Start(TNH_EncryptionTarget_Start); MuzzleDevice.Awake -= new hook_Awake(MuzzleDevice_Awake); FVRFireArmRound.FVRUpdate -= new hook_FVRUpdate(FVRFireArmRound_FVRUpdate); FVRFireArmChamber.UpdateProxyDisplay -= new hook_UpdateProxyDisplay(FVRFireArmChamber_UpdateProxyDisplay); FVRFireArmMagazine.UpdateBulletDisplay -= new hook_UpdateBulletDisplay(FVRFireArmMagazine_UpdateBulletDisplay); } IsHooked = false; } public void Hook(TemperatureData data) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown temperatureData = data; Sosig.Start += new hook_Start(Sosig_Start); FVRPhysicalObject.Awake += new hook_Awake(FVRPhysicalObject_Awake); TNH_EncryptionTarget.Start += new hook_Start(TNH_EncryptionTarget_Start); MuzzleDevice.Awake += new hook_Awake(MuzzleDevice_Awake); FVRFireArmRound.FVRUpdate += new hook_FVRUpdate(FVRFireArmRound_FVRUpdate); FVRFireArmChamber.UpdateProxyDisplay += new hook_UpdateProxyDisplay(FVRFireArmChamber_UpdateProxyDisplay); FVRFireArmMagazine.UpdateBulletDisplay += new hook_UpdateBulletDisplay(FVRFireArmMagazine_UpdateBulletDisplay); ApplyStaticValues(); IsHooked = true; } public void EssentialsHook(TemperatureData data) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown temperatureData = data; Sosig.Start += new hook_Start(Sosig_Start); FVRPhysicalObject.Awake += new hook_Awake(FVRPhysicalObject_Awake); TNH_EncryptionTarget.Start += new hook_Start(TNH_EncryptionTarget_Start); essentialsOnly = true; ApplyStaticValues(); IsHooked = true; } private void ApplyStaticValues() { sosig_tempDist = temperatureData.sosig_tempDist; sosig_maxTemp = temperatureData.sosig_maxTemp; sosig_minTemp = temperatureData.sosig_minTemp; physicalObject_tempDist = temperatureData.physicalObject_tempDist; physicalObject_maxTemp = temperatureData.physicalObject_maxTemp; physicalObject_minTemp = temperatureData.physicalObject_minTemp; } private void TNH_EncryptionTarget_Start(orig_Start orig, TNH_EncryptionTarget self) { orig.Invoke(self); ThermalBody component = ((Component)self).gameObject.GetComponent<ThermalBody>(); if (temperatureData.encryption_hot) { if ((Object)(object)component == (Object)null) { component = ((Component)self).gameObject.AddComponent<ThermalBody>(); ((Behaviour)component).enabled = false; component.ThermalDistribution = temperatureData.encryption_tempDistHot; component.MaximumTemperature = temperatureData.encryption_maxTempHot; component.MinimumTemperature = temperatureData.encryption_minTempHot; ((Behaviour)component).enabled = true; } else { ((Behaviour)component).enabled = false; component.ThermalDistribution = temperatureData.encryption_tempDistHot; component.MaximumTemperature = temperatureData.encryption_maxTempHot; component.MinimumTemperature = temperatureData.encryption_minTempHot; ((Behaviour)component).enabled = true; } } else if ((Object)(object)component == (Object)null) { component = ((Component)self).gameObject.AddComponent<ThermalBody>(); ((Behaviour)component).enabled = false; component.ThermalDistribution = temperatureData.physicalObject_tempDist; component.MaximumTemperature = temperatureData.physicalObject_maxTemp; component.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)component).enabled = true; } else { ((Behaviour)component).enabled = false; component.ThermalDistribution = temperatureData.physicalObject_tempDist; component.MaximumTemperature = temperatureData.physicalObject_maxTemp; component.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)component).enabled = true; } } private void FVRFireArmMagazine_UpdateBulletDisplay(orig_UpdateBulletDisplay orig, FVRFireArmMagazine self) { orig.Invoke(self); ThermalBody component = ((Component)self).gameObject.GetComponent<ThermalBody>(); if ((Object)(object)component == (Object)null) { component = ((Component)self).gameObject.AddComponent<ThermalBody>(); ((Behaviour)component).enabled = false; component.ThermalDistribution = temperatureData.physicalObject_tempDist; component.MaximumTemperature = temperatureData.physicalObject_maxTemp; component.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)component).enabled = true; } else { ((Behaviour)component).enabled = false; component.ThermalDistribution = temperatureData.physicalObject_tempDist; component.MaximumTemperature = temperatureData.physicalObject_maxTemp; component.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)component).enabled = true; } } private void FVRFireArmChamber_UpdateProxyDisplay(orig_UpdateProxyDisplay orig, FVRFireArmChamber self) { orig.Invoke(self); if (self.IsSpent) { ThermalBody thermalBody = ((Component)self.ProxyMesh).gameObject.GetComponent<ThermalBody>(); if ((Object)(object)thermalBody == (Object)null) { thermalBody = ((Component)self).gameObject.AddComponent<ThermalBody>(); ((Behaviour)thermalBody).enabled = false; thermalBody.isVariable = true; thermalBody.ThermalDistribution = temperatureData.physicalObject_tempDist; thermalBody.MaximumTemperature = temperatureData.physicalObject_maxTemp; thermalBody.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)thermalBody).enabled = true; } else { ((Behaviour)thermalBody).enabled = false; thermalBody.isVariable = true; thermalBody.ThermalDistribution = temperatureData.physicalObject_tempDist; thermalBody.MaximumTemperature = temperatureData.physicalObject_maxTemp; thermalBody.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)thermalBody).enabled = true; } if ((Object)(object)((Component)self.ProxyMesh).gameObject.GetComponent<CoolingDownPart>() == (Object)null) { CoolingDownPart coolingDownPart = ((Component)self).gameObject.AddComponent<CoolingDownPart>(); coolingDownPart.tB = thermalBody; ((Behaviour)coolingDownPart).enabled = false; coolingDownPart.startingHeat = 3f; coolingDownPart.heatDissipatedPerSecond = 0.4f; ((Behaviour)coolingDownPart).enabled = true; } } } private void FVRFireArmRound_FVRUpdate(orig_FVRUpdate orig, FVRFireArmRound self) { orig.Invoke(self); if (self.m_isSpent) { ThermalBody thermalBody = ((Component)self).gameObject.GetComponent<ThermalBody>(); if ((Object)(object)thermalBody == (Object)null) { thermalBody = ((Component)self).gameObject.AddComponent<ThermalBody>(); ((Behaviour)thermalBody).enabled = false; thermalBody.isVariable = true; thermalBody.ThermalDistribution = temperatureData.physicalObject_tempDist; thermalBody.MaximumTemperature = temperatureData.physicalObject_maxTemp; thermalBody.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)thermalBody).enabled = true; } else { ((Behaviour)thermalBody).enabled = false; thermalBody.isVariable = true; thermalBody.ThermalDistribution = temperatureData.physicalObject_tempDist; thermalBody.MaximumTemperature = temperatureData.physicalObject_maxTemp; thermalBody.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)thermalBody).enabled = true; } if ((Object)(object)((Component)self).gameObject.GetComponent<CoolingDownPart>() == (Object)null) { CoolingDownPart coolingDownPart = ((Component)self).gameObject.AddComponent<CoolingDownPart>(); coolingDownPart.tB = thermalBody; ((Behaviour)coolingDownPart).enabled = false; coolingDownPart.startingHeat = 3f; coolingDownPart.heatDissipatedPerSecond = 0.4f; ((Behaviour)coolingDownPart).enabled = true; } } } private void MuzzleDevice_Awake(orig_Awake orig, MuzzleDevice self) { orig.Invoke(self); ThermalBody component = ((Component)self).gameObject.GetComponent<ThermalBody>(); if ((Object)(object)component == (Object)null) { component = ((Component)self).gameObject.AddComponent<ThermalBody>(); ((Behaviour)component).enabled = false; component.isVariable = true; component.ThermalDistribution = temperatureData.physicalObject_tempDist; component.MaximumTemperature = temperatureData.physicalObject_maxTemp; component.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)component).enabled = true; } else { ((Behaviour)component).enabled = false; component.isVariable = true; component.ThermalDistribution = temperatureData.physicalObject_tempDist; component.MaximumTemperature = temperatureData.physicalObject_maxTemp; component.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)component).enabled = true; } if ((Object)(object)((Component)self).gameObject.GetComponent<HeatingUpAttachmentPart>() == (Object)null) { HeatingUpAttachmentPart heatingUpAttachmentPart = ((Component)self).gameObject.AddComponent<HeatingUpAttachmentPart>(); ((Behaviour)heatingUpAttachmentPart).enabled = false; heatingUpAttachmentPart.attachment = (FVRFireArmAttachment)(object)self; heatingUpAttachmentPart.heatPerShot = temperatureData.muzzleDevice_HeatingRate; heatingUpAttachmentPart.heatDissipatedPerSecond = temperatureData.muzzleDevice_CoolingRate; ((Behaviour)heatingUpAttachmentPart).enabled = true; } } private void Sosig_Start(orig_Start orig, Sosig self) { orig.Invoke(self); if ((Object)(object)((Component)self.DeParentOnSpawn).gameObject.GetComponent<ThermalBody>() == (Object)null) { ThermalBody thermalBody = ((Component)self.DeParentOnSpawn).gameObject.AddComponent<ThermalBody>(); ((Behaviour)thermalBody).enabled = false; thermalBody.ThermalDistribution = temperatureData.physicalObject_tempDist; thermalBody.MaximumTemperature = temperatureData.physicalObject_maxTemp; thermalBody.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)thermalBody).enabled = true; } else { ThermalBody component = ((Component)self.DeParentOnSpawn).gameObject.GetComponent<ThermalBody>(); ((Behaviour)component).enabled = false; component.ThermalDistribution = temperatureData.physicalObject_tempDist; component.MaximumTemperature = temperatureData.physicalObject_maxTemp; component.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)component).enabled = true; } Renderer[] renderers = self.Renderers; foreach (Renderer val in renderers) { ThermalBody component2 = ((Component)val).gameObject.GetComponent<ThermalBody>(); if ((Object)(object)component2 == (Object)null) { component2 = ((Component)val).gameObject.AddComponent<ThermalBody>(); ((Behaviour)component2).enabled = false; component2.ThermalDistribution = temperatureData.sosig_tempDist; component2.MaximumTemperature = temperatureData.sosig_maxTemp; component2.MinimumTemperature = temperatureData.sosig_minTemp; ((Behaviour)component2).enabled = true; } else { ((Behaviour)component2).enabled = false; component2.ThermalDistribution = temperatureData.sosig_tempDist; component2.MaximumTemperature = temperatureData.sosig_maxTemp; component2.MinimumTemperature = temperatureData.sosig_minTemp; ((Behaviour)component2).enabled = true; } } } private void FVRPhysicalObject_Awake(orig_Awake orig, FVRPhysicalObject self) { orig.Invoke(self); if ((Object)(object)((Component)self).gameObject.GetComponent<ThermalBody>() == (Object)null) { ((Component)self).gameObject.SetActive(false); ThermalBody thermalBody = ((Component)self).gameObject.AddComponent<ThermalBody>(); ((Behaviour)thermalBody).enabled = false; thermalBody.ThermalDistribution = temperatureData.physicalObject_tempDist; thermalBody.MaximumTemperature = temperatureData.physicalObject_maxTemp; thermalBody.MinimumTemperature = temperatureData.physicalObject_minTemp; ((Behaviour)thermalBody).enabled = true; ((Component)self).gameObject.SetActive(true); } } } public class ThermalVision_Enabler_World : MonoBehaviour { public float ThermalDistribution = 4f; public float MaximumTemperature = 0.15f; public float MinimumTemperature = 0.001f; [HideInInspector] public static List<ThermalVision_Enabler_World> ThermalVisionsInScene; private string rootWorldObjectName = "[Level]"; private GameObject rootWorldObject; private ThermalBody thermalBody; public void Start() { //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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown if (ThermalVisionsInScene == null) { ThermalVisionsInScene = new List<ThermalVision_Enabler_World>(); } ThermalVisionsInScene.Add(this); rootWorldObject = GameObject.Find(rootWorldObjectName); Scene activeScene = SceneManager.GetActiveScene(); GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects(); GameObject[] array; if ((Object)(object)rootWorldObject != (Object)null && (Object)(object)rootWorldObject.GetComponent<ThermalBody>() == (Object)null) { bool activeSelf = rootWorldObject.activeSelf; rootWorldObject.SetActive(false); thermalBody = rootWorldObject.AddComponent<ThermalBody>(); thermalBody.ThermalDistribution = ThermalDistribution; thermalBody.MaximumTemperature = MaximumTemperature; thermalBody.MinimumTemperature = MinimumTemperature; rootWorldObject.SetActive(activeSelf); } else if ((Object)(object)rootWorldObject == (Object)null) { rootWorldObject = new GameObject(rootWorldObjectName); array = rootGameObjects; foreach (GameObject val in array) { Rigidbody component = val.GetComponent<Rigidbody>(); Sosig component2 = val.GetComponent<Sosig>(); if ((Object)(object)component == (Object)null && (Object)(object)component2 == (Object)null) { val.transform.parent = rootWorldObject.transform; } } rootWorldObject.SetActive(false); thermalBody = rootWorldObject.AddComponent<ThermalBody>(); thermalBody.ThermalDistribution = ThermalDistribution; thermalBody.MaximumTemperature = MaximumTemperature; thermalBody.MinimumTemperature = MinimumTemperature; rootWorldObject.SetActive(true); } List<GameObject> list = new List<GameObject>(); List<GameObject> list2 = new List<GameObject>(); array = rootGameObjects; foreach (GameObject obj in array) { Rigidbody component3 = obj.GetComponent<Rigidbody>(); Sosig component4 = obj.GetComponent<Sosig>(); if ((Object)(object)component3 != (Object)null && (Object)(object)component4 == (Object)null) { list2.Add(((Component)component3).gameObject); } else if ((Object)(object)component4 != (Object)null) { list.Add(((Component)component4).gameObject); } } foreach (GameObject item in list2) { if (!((Object)(object)item.GetComponent<ThermalBody>() != (Object)null)) { bool activeSelf2 = item.gameObject.activeSelf; item.gameObject.SetActive(false); thermalBody = item.AddComponent<ThermalBody>(); thermalBody.ThermalDistribution = ThermalVision_Hooks.physicalObject_tempDist; thermalBody.MaximumTemperature = ThermalVision_Hooks.physicalObject_maxTemp; thermalBody.MinimumTemperature = ThermalVision_Hooks.physicalObject_minTemp; item.gameObject.SetActive(activeSelf2); } } foreach (GameObject item2 in list) { if (!((Object)(object)item2.GetComponent<ThermalBody>() != (Object)null)) { bool activeSelf3 = item2.gameObject.activeSelf; item2.gameObject.SetActive(false); thermalBody = item2.AddComponent<ThermalBody>(); thermalBody.ThermalDistribution = ThermalVision_Hooks.sosig_tempDist; thermalBody.MaximumTemperature = ThermalVision_Hooks.sosig_maxTemp; thermalBody.MinimumTemperature = ThermalVision_Hooks.sosig_minTemp; item2.gameObject.SetActive(activeSelf3); } } if (!ThermalVision_Hooks.IsHooked) { if (ThermalVision_BepInEx.ThermalPlugin.enableThermalVision.Value) { ThermalVision_BepInEx.ThermalHooks.Hook(ThermalVision_BepInEx.ThermalPlugin.TemperatureData); } else { ThermalVision_BepInEx.ThermalHooks.EssentialsHook(ThermalVision_BepInEx.ThermalPlugin.TemperatureData); } } } private void OnDestroy() { ThermalVisionsInScene.Remove(this); if (ThermalVisionsInScene.Count == 0) { ThermalVision_BepInEx.ThermalHooks.Unhook(); } } } }
plugins/TriggerModification.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TriggerModification")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TriggerModification")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("449775cf-4dbb-44c6-bc8e-c21370b3fd3a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; public class ForcedBurst : MonoBehaviour { public FVRFireArm FireArm; public float CooldownPeriod = 0.25f; private bool _isHooked; private bool _isBurstFiring; private int _burstAmount; private bool _isCoolingDown; private bool _shouldCoolDown; public void Awake() { ((Component)this).gameObject.SetActive(false); ForcedBurst obj = ((Component)this).gameObject.AddComponent<ForcedBurst>(); obj.FireArm = FireArm; obj.CooldownPeriod = CooldownPeriod; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } public class ChargeTrigger : MonoBehaviour { public FVRFireArm FireArm; [Tooltip("Charge time in seconds")] public float ChargeTime = 1f; [Tooltip("If checked, every shot will be charged, even in automatic fire. Else only the first shot will be delayed.")] public bool ChargesUpEveryShot; public AudioEvent ChargingSounds; public AudioEvent ChargingAbortSounds; private bool _isHooked; private float _timeCharged; private bool _isCharging; private bool _isAutomaticFire; public void Awake() { ((Component)this).gameObject.SetActive(false); ChargeTrigger obj = ((Component)this).gameObject.AddComponent<ChargeTrigger>(); obj.FireArm = FireArm; obj.ChargeTime = ChargeTime; obj.ChargesUpEveryShot = ChargesUpEveryShot; obj.ChargingSounds = ChargingSounds; obj.ChargingAbortSounds = ChargingAbortSounds; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/Typhoon.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using FistVR; using OpenScripts2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Typhoon")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Typhoon")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("de9462f0-707c-4575-8e41-55f96c0a8b61")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Cityrobo; internal class MagLock : MonoBehaviour { public enum dirtype { x, y, z, w } public OpenBoltReceiver openBoltWeapon; public int safetyMode; public bool safetyLock; public GameObject lockHandle; public GameObject MagReloadTrigger; public Vector3 start; public Vector3 end; public float wiggleroom = 0.05f; public dirtype direction; public bool is_rotation; private bool isLocked; private int lastFireMode; public void Update() { //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) float num = ((Vector3)(ref start))[(int)direction]; float num2 = ((Vector3)(ref end))[(int)direction]; Vector3 localPosition = lockHandle.transform.localPosition; float num3 = Mathf.InverseLerp(num, num2, ((Vector3)(ref localPosition))[(int)direction]); if (safetyLock) { if (0f + wiggleroom <= num3) { if (!isLocked) { lastFireMode = openBoltWeapon.m_fireSelectorMode; } openBoltWeapon.m_fireSelectorMode = safetyMode; isLocked = true; } else if (0f + wiggleroom >= num3 && isLocked) { openBoltWeapon.m_fireSelectorMode = lastFireMode; isLocked = false; } } if (1f - wiggleroom <= num3) { MagReloadTrigger.SetActive(true); } else { MagReloadTrigger.SetActive(false); } } } public class MagMove : MonoBehaviour { public FVRFireArm fireArm; private bool posChanged; public void Awake() { ((Component)this).gameObject.SetActive(false); ((Component)this).gameObject.AddComponent<ForceMagazineMountingToMagMountPos>().FireArm = fireArm; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } } internal class MagSafety : MonoBehaviour { public OpenBoltReceiver openFireArm; public ClosedBoltWeapon closedFireArm; public int SafetyFireModePosition; private int lastFireMode; private bool magSafetyEngaged; public void Awake() { ((Component)this).gameObject.SetActive(false); MagazineSafety obj = ((Component)this).gameObject.AddComponent<MagazineSafety>(); obj.FireArm = (FVRFireArm)(((object)openFireArm) ?? ((object)closedFireArm)); obj.SafetyFireModePosition = SafetyFireModePosition; ((Component)this).gameObject.SetActive(true); Object.Destroy((Object)(object)this); } }
plugins/WeaponEnhancementAttachment.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("WeaponEnhancementAttachment")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WeaponEnhancementAttachment")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("39a3aff2-e498-4ed1-adf5-423a18deaf80")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace Cityrobo; public class RecoilPercentage : MonoBehaviour { public FVRFireArm fireArm; public float multiplier; private void Start() { FVRFireArmRecoilProfile recoilProfile = fireArm.RecoilProfile; FVRFireArmRecoilProfile recoilProfileStocked = fireArm.RecoilProfileStocked; FVRFireArmRecoilProfile val = Object.Instantiate<FVRFireArmRecoilProfile>(fireArm.RecoilProfile); FVRFireArmRecoilProfile val2 = Object.Instantiate<FVRFireArmRecoilProfile>(fireArm.RecoilProfileStocked); } private void AdjustRecoilProfile(Component original) { //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) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Type type = ((object)original).GetType(); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { object value = fieldInfo.GetValue(original); if (value is float) { fieldInfo.SetValue(original, (float)value * multiplier); } else if (value is Quaternion val) { val.x = 1f / multiplier; val.y = 1f / multiplier; val.z = 1f / multiplier; val.w = 1f / multiplier; fieldInfo.SetValue(original, val); } } } } public class WeaponEnhancementAttachment : FVRFireArmAttachment { public FireArmRoundClass roundClass = (FireArmRoundClass)5; private FVRFireArm _fireArm = null; private FireArmRoundClass _origRoundClass; public override void FVRUpdate() { //IL_006c: 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_010c: 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_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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)base.curMount != (Object)null) { ref FVRFireArm fireArm = ref _fireArm; FVRPhysicalObject myObject = base.curMount.GetRootMount().MyObject; fireArm = (FVRFireArm)(object)((myObject is FVRFireArm) ? myObject : null); if ((Object)(object)_fireArm != (Object)null) { FVRFireArmChamber curentChamber = GetCurentChamber(); if ((Object)(object)curentChamber != (Object)null && (Object)(object)curentChamber.m_round != (Object)null && curentChamber.m_round.RoundClass != roundClass) { _origRoundClass = curentChamber.m_round.RoundClass; curentChamber.m_round = ((AnvilAsset)AM.GetRoundSelfPrefab(curentChamber.m_round.RoundType, roundClass)).GetGameObject().GetComponent<FVRFireArmRound>(); curentChamber.UpdateProxyDisplay(); } } } else if ((Object)(object)_fireArm != (Object)null) { FVRFireArmChamber curentChamber2 = GetCurentChamber(); if ((Object)(object)curentChamber2 != (Object)null && (Object)(object)curentChamber2.m_round != (Object)null) { curentChamber2.m_round = ((AnvilAsset)AM.GetRoundSelfPrefab(curentChamber2.m_round.RoundType, _origRoundClass)).GetGameObject().GetComponent<FVRFireArmRound>(); curentChamber2.UpdateProxyDisplay(); } _fireArm = null; } } private FVRFireArmChamber GetCurentChamber() { FVRFireArm fireArm = _fireArm; FVRFireArm val = fireArm; Handgun val2 = (Handgun)(object)((val is Handgun) ? val : null); if (val2 == null) { ClosedBoltWeapon val3 = (ClosedBoltWeapon)(object)((val is ClosedBoltWeapon) ? val : null); if (val3 == null) { OpenBoltReceiver val4 = (OpenBoltReceiver)(object)((val is OpenBoltReceiver) ? val : null); if (val4 == null) { TubeFedShotgun val5 = (TubeFedShotgun)(object)((val is TubeFedShotgun) ? val : null); if (val5 == null) { BoltActionRifle val6 = (BoltActionRifle)(object)((val is BoltActionRifle) ? val : null); if (val6 == null) { BreakActionWeapon val7 = (BreakActionWeapon)(object)((val is BreakActionWeapon) ? val : null); if (val7 == null) { Revolver val8 = (Revolver)(object)((val is Revolver) ? val : null); if (val8 == null) { SingleActionRevolver val9 = (SingleActionRevolver)(object)((val is SingleActionRevolver) ? val : null); if (val9 == null) { RevolvingShotgun val10 = (RevolvingShotgun)(object)((val is RevolvingShotgun) ? val : null); if (val10 == null) { Flaregun val11 = (Flaregun)(object)((val is Flaregun) ? val : null); if (val11 == null) { RollingBlock val12 = (RollingBlock)(object)((val is RollingBlock) ? val : null); if (val12 == null) { Derringer val13 = (Derringer)(object)((val is Derringer) ? val : null); if (val13 == null) { LAPD2019 val14 = (LAPD2019)(object)((val is LAPD2019) ? val : null); if (val14 == null) { BAP val15 = (BAP)(object)((val is BAP) ? val : null); if (val15 == null) { HCB val16 = (HCB)(object)((val is HCB) ? val : null); if (val16 == null) { M72 val17 = (M72)(object)((val is M72) ? val : null); if (val17 == null) { MF2_RL val18 = (MF2_RL)(object)((val is MF2_RL) ? val : null); if (val18 == null) { RGM40 val19 = (RGM40)(object)((val is RGM40) ? val : null); if (val19 == null) { RPG7 val20 = (RPG7)(object)((val is RPG7) ? val : null); if (val20 == null) { SimpleLauncher val21 = (SimpleLauncher)(object)((val is SimpleLauncher) ? val : null); if (val21 == null) { SimpleLauncher2 val22 = (SimpleLauncher2)(object)((val is SimpleLauncher2) ? val : null); if (val22 == null) { RemoteMissileLauncher val23 = (RemoteMissileLauncher)(object)((val is RemoteMissileLauncher) ? val : null); if (val23 == null) { PotatoGun val24 = (PotatoGun)(object)((val is PotatoGun) ? val : null); if (val24 == null) { GrappleGun val25 = (GrappleGun)(object)((val is GrappleGun) ? val : null); if (val25 != null) { return val25.Chambers[val25.m_curChamber]; } if (_fireArm.FChambers.Count > 0) { return _fireArm.FChambers[0]; } return null; } return val24.Chamber; } return val23.Chamber; } return val22.Chamber; } return val21.Chamber; } return val20.Chamber; } return val19.Chamber; } return val18.Chamber; } return val17.Chamber; } return val16.Chamber; } return val15.Chamber; } return val14.Chambers[val14.CurChamber]; } return val13.Barrels[val13.m_curBarrel].Chamber; } return val12.Chamber; } return val11.Chamber; } return val10.Chambers[val10.CurChamber]; } return val9.Cylinder.Chambers[val9.CurChamber]; } return val8.Chambers[val8.CurChamber]; } return val7.Barrels[val7.m_curBarrel].Chamber; } return val6.Chamber; } return val5.Chamber; } return val4.Chamber; } return val3.Chamber; } return val2.Chamber; } }