Decompiled source of DBS2 Double Freedom v1.0.0
DBS2_Double_Freedom.dll
Decompiled 18 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using DigitalRuby.LightningBolt; using FistVR; using H3VRUtils; using HarmonyLib; using ModularWorkshop; using OpenScripts2; using OtherLoader; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace ShermanJumbo { public class AnimationPlayOnFire : MonoBehaviour { public FVRFireArm FireArm; public Animator Animator; public string FiringAnimationNode = "GunFire"; public void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(ShotFired); } public void OnDestroy() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(ShotFired); } private void ShotFired(FVRFireArm firearm) { if ((Object)(object)firearm == (Object)(object)FireArm) { Animator.Play(FiringAnimationNode); } } } public class BallisticProjLightningBolt : MonoBehaviour { public GameObject TransformToMove; private Vector3 SpawnLocation; private 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) SpawnLocation = ((Component)this).gameObject.transform.position; } private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) TransformToMove.transform.position = SpawnLocation; } } public class BallisticProjectileKillIfBelowSpeed : MonoBehaviour { public BallisticProjectile Projectile; public float KillIfVelBelowThisMagnitude = 20f; private void Update() { //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) if (((Vector3)(ref Projectile.m_velocity)).magnitude <= KillIfVelBelowThisMagnitude) { Projectile.m_velocity = Vector3.zero; } } } } public class BreakActionMainHandFireSelector : MonoBehaviour { public BreakActionWeapon Weapon; public Transform SelectorSwitch; public Vector3 PosSingleFire; public Vector3 PosMultiFire; public bool IsRot = false; public Vector3 RotEngaged; public bool SwapsTrigger = false; public Transform SecondTrigger; public float SecondTriggerPulledAngle = 20f; private Transform OriginalTrigger; private float OriginalTriggerPulled; private void Awake() { OriginalTrigger = Weapon.Triggers[0]; OriginalTriggerPulled = Weapon.TriggerPulled; } private void Update() { //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) FVRViveHand hand = ((FVRInteractiveObject)Weapon).m_hand; if (!((Object)(object)hand == (Object)null) && ((hand.IsInStreamlinedMode && hand.Input.AXButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f))) { SwapFiremodes(); } } public void SwapFiremodes() { //IL_0043: 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_0060: 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) ((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)15, 1f); if (Weapon.FireAllBarrels) { Weapon.FireAllBarrels = false; if (!IsRot) { SelectorSwitch.localPosition = PosSingleFire; } if (IsRot) { SelectorSwitch.localEulerAngles = Vector3.zero; } if (SwapsTrigger) { Weapon.Triggers[0] = OriginalTrigger; Weapon.TriggerPulled = OriginalTriggerPulled; } } else if (!Weapon.FireAllBarrels) { Weapon.FireAllBarrels = true; if (!IsRot) { SelectorSwitch.localPosition = PosMultiFire; } if (IsRot) { SelectorSwitch.localEulerAngles = RotEngaged; } if (SwapsTrigger) { Weapon.Triggers[0] = SecondTrigger; Weapon.TriggerPulled = SecondTriggerPulledAngle; } } } } namespace ShermanJumbo { public class BreakActionSpeedloaderInsertTrigger : MonoBehaviour { public BreakActionWeapon Weapon; } public class BreakActionSpeedloaderTrigger : MonoBehaviour { public FVRFireArmMagazine Loader; private void OnTriggerEnter(Collider collider) { //IL_006a: 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_00ff: 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_010d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Loader != (Object)null) || !((Object)(object)Loader.FireArm == (Object)null) || !((Object)(object)((FVRPhysicalObject)Loader).QuickbeltSlot == (Object)null) || !((Object)(object)((Component)collider).gameObject.GetComponent<BreakActionSpeedloaderInsertTrigger>() != (Object)null)) { return; } BreakActionSpeedloaderInsertTrigger component = ((Component)collider).gameObject.GetComponent<BreakActionSpeedloaderInsertTrigger>(); BreakActionWeapon weapon = component.Weapon; if (((FVRFireArm)weapon).RoundType != Loader.RoundType || weapon.m_isLatched) { return; } for (int i = 0; i < weapon.Barrels.Length; i++) { if (Loader.HasARound() && !weapon.Barrels[i].Chamber.IsFull) { FVRLoadedRound val = Loader.RemoveRound(0); Transform transform = Loader.DisplayBullets[Mathf.Clamp(0, Loader.DisplayBullets.Length - 1, i)].transform; weapon.Barrels[i].Chamber.Autochamber(val.LR_Class, transform.position, transform.rotation); ((FVRFireArm)weapon).PlayAudioEvent((FirearmAudioEventType)20, 1f); } } } } public class CSGCapTrigger : FVRInteractiveObject { public CappedStickyGrenade Grenade; public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!Grenade.m_isArmed) { Grenade.Arm(); } } } public class CSGDestroyNotifier : MonoBehaviour { public delegate void DestroyedAction(); public event DestroyedAction OnDestroyed; private void OnDestroy() { if (this.OnDestroyed != null) { this.OnDestroyed(); } } } public class CannonballSecondaryRenderer : MonoBehaviour { public Renderer Rend; public CannonBall Cannonball; private void Update() { if (Cannonball.TurnsOffRends && !Cannonball.hasTurnedOffRends) { Rend.enabled = false; } } } public class CappedStickyGrenade : FVRPhysicalObject { [Serializable] public class CSGDetonationStage { public bool HasFired = false; public float FireWhenFuseHits = 0f; public GameObject[] PrefabToSpawn; } [Header("Grenade Settings")] public Rigidbody grenadeRigidbody; public bool m_isArmed = false; public float FuseTime = 0f; public List<GameObject> SpawnOnSplode; public AudioEvent ArmedSound; public int IFF; private float m_fuseTime = 0f; private bool m_hasSploded = false; public bool UsesStagedDetonation = false; public CSGDetonationStage[] DetonationStages; [Header("Cap Settings")] public bool UsesCapSystem = false; public GameObject DummyCap; public GameObject CapPrefab; public Transform CapPrefabSpawnPos; [Header("Sticky Grenade Settings")] public bool isStickyGrenade = true; public Collider stickyCollider; public float stickingDistance = 0.1f; public LayerMask stickyLayers; public float embeddingDistance = 0.02f; public bool playStickSoundForRigidbodiesOnly = true; public AudioEvent stickSounds; public float minimumStickVelocity = 2f; public float regrabActivationDelay = 0.5f; public float massWhileStuck = 10f; private bool wasHeld = false; private bool armChecked = false; private bool shouldCheckVelocity = false; private bool hasReleasedLever = false; private bool isSticking = false; private bool canStick = false; private float timeSinceRelease = 0f; private GameObject parentObject; private Vector3 savedPosition; private Quaternion savedRotation; private Vector3 savedScale; private FVRInteractiveObject interactiveObject; private bool isCookingCoroutineRunning = false; [Header("Extra Settings")] public bool UsesArmedPfx = false; public ParticleSystem[] Pfx; public float ActivateParticlesWhenFuseHits = 3f; private bool HasActivatedParticles = false; public bool PlaysAnimationOnArm = false; public Animator Animator; public string ArmingAnimationNode = "animation"; public bool PlaysSoundWhileArmed = false; public AudioSource ArmedSounds; public float ActivateSoundsWhenFuseHits = 0f; private bool HasPlayedArmedSounds = false; private void Start() { interactiveObject = ((Component)this).GetComponent<FVRInteractiveObject>(); if (UsesArmedPfx) { ParticleSystem[] pfx = Pfx; foreach (ParticleSystem val in pfx) { if (val.isPlaying) { val.Stop(); } } } if (PlaysSoundWhileArmed && ArmedSounds.isPlaying) { ArmedSounds.Stop(); } } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); IFF = GM.CurrentPlayerBody.GetPlayerIFF(); } public override void FVRUpdate() { //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0453: 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) ((FVRPhysicalObject)this).FVRUpdate(); if (!armChecked && m_isArmed) { armChecked = true; shouldCheckVelocity = true; if (isStickyGrenade) { EnableStickyCollider(); } } if (!wasHeld && ((FVRInteractiveObject)this).IsHeld) { timeSinceRelease = 0f; if (m_isArmed) { EnableStickyCollider(); } shouldCheckVelocity = m_isArmed; wasHeld = true; canStick = true; isSticking = false; FixedJoint component = ((Component)this).GetComponent<FixedJoint>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); grenadeRigidbody.isKinematic = false; grenadeRigidbody.detectCollisions = true; grenadeRigidbody.useGravity = true; grenadeRigidbody.constraints = (RigidbodyConstraints)0; Debug.Log((object)"FixedJoint grenade unstuck upon being picked up."); } else if ((Object)(object)((Component)this).transform.parent != (Object)null && ((Object)((Component)((Component)this).transform.parent).gameObject).name == "DummyParent") { GameObject gameObject = ((Component)((Component)this).transform.parent).gameObject; ((Component)this).transform.SetParent((Transform)null, true); Object.Destroy((Object)(object)gameObject); grenadeRigidbody.isKinematic = false; grenadeRigidbody.detectCollisions = true; grenadeRigidbody.useGravity = true; grenadeRigidbody.constraints = (RigidbodyConstraints)0; Debug.Log((object)"Static-stuck grenade unstuck upon being picked up."); } if (isStickyGrenade) { DisableStickyColliderTemporarily(); } } if (wasHeld && !((FVRInteractiveObject)this).IsHeld) { isSticking = false; wasHeld = false; } if (m_isArmed || !((FVRInteractiveObject)this).IsHeld) { DisableMeleeDamage((FVRPhysicalObject)(object)this); } else { EnableMeleeDamage((FVRPhysicalObject)(object)this); } if (!m_isArmed) { return; } m_fuseTime -= Time.deltaTime; if (m_fuseTime < ActivateParticlesWhenFuseHits && !HasActivatedParticles) { HasActivatedParticles = true; ParticleSystem[] pfx = Pfx; foreach (ParticleSystem val in pfx) { val.Play(); } } if (m_fuseTime < ActivateSoundsWhenFuseHits && !HasPlayedArmedSounds) { HasPlayedArmedSounds = true; ArmedSounds.Play(); } if (m_fuseTime <= 0.05f) { if (!m_hasSploded) { m_hasSploded = true; ParticleSystem[] pfx2 = Pfx; foreach (ParticleSystem val2 in pfx2) { if (val2.isPlaying) { val2.Stop(); } } for (int k = 0; k < SpawnOnSplode.Count; k++) { GameObject val3 = Object.Instantiate<GameObject>(SpawnOnSplode[k], ((Component)this).transform.position, Quaternion.identity); Explosion component2 = val3.GetComponent<Explosion>(); if ((Object)(object)component2 != (Object)null) { component2.IFF = IFF; } ExplosionSound component3 = val3.GetComponent<ExplosionSound>(); if ((Object)(object)component3 != (Object)null) { component3.IFF = IFF; } GrenadeExplosion component4 = val3.GetComponent<GrenadeExplosion>(); if ((Object)(object)component4 != (Object)null) { component4.IFF = IFF; } } } else { if (((FVRInteractiveObject)this).IsHeld) { FVRViveHand hand = ((FVRInteractiveObject)this).m_hand; ((FVRInteractiveObject)this).m_hand.ForceSetInteractable((FVRInteractiveObject)null); ((FVRInteractiveObject)this).EndInteraction(hand); } Object.Destroy((Object)(object)((Component)this).gameObject); } } if (!UsesStagedDetonation) { return; } CSGDetonationStage[] detonationStages = DetonationStages; foreach (CSGDetonationStage cSGDetonationStage in detonationStages) { if (!cSGDetonationStage.HasFired && m_fuseTime <= cSGDetonationStage.FireWhenFuseHits) { cSGDetonationStage.HasFired = true; GameObject[] prefabToSpawn = cSGDetonationStage.PrefabToSpawn; foreach (GameObject val4 in prefabToSpawn) { Object.Instantiate<GameObject>(val4, ((Component)this).transform.position, ((Component)this).transform.rotation); } } } } public override void FVRFixedUpdate() { //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) ((FVRPhysicalObject)this).FVRFixedUpdate(); if (shouldCheckVelocity && ((FVRInteractiveObject)this).IsHeld) { Vector3 velocity = grenadeRigidbody.velocity; if (((Vector3)(ref velocity)).magnitude >= minimumStickVelocity) { canStick = true; } else { canStick = false; } } } private void DisableMeleeDamage(FVRPhysicalObject physicalObject) { if (physicalObject.MP != null && physicalObject.MP.IsMeleeWeapon) { physicalObject.MP.IsMeleeWeapon = false; } } private void EnableMeleeDamage(FVRPhysicalObject physicalObject) { if (physicalObject.MP != null && !physicalObject.MP.IsMeleeWeapon) { physicalObject.MP.IsMeleeWeapon = true; } } private void OnCollisionEnter(Collision collision) { //IL_00a6: 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_00c6: 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_0103: Unknown result type (might be due to invalid IL or missing references) if (!m_isArmed || isSticking || !isStickyGrenade || !((Object)(object)stickyCollider != (Object)null) || (Object)(object)collision.gameObject.GetComponent<BreakableGlass>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenade>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenadePin>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<SosigWeapon>() != (Object)null) { return; } ContactPoint[] contacts = collision.contacts; for (int i = 0; i < contacts.Length; i++) { ContactPoint contact = contacts[i]; if (!((Object)(object)((ContactPoint)(ref contact)).thisCollider == (Object)(object)stickyCollider)) { continue; } if ((LayerMask.op_Implicit(stickyLayers) & (1 << collision.gameObject.layer)) == 0 || !IsContactPointWithinStickingDistance(((ContactPoint)(ref contact)).point)) { break; } isSticking = true; StickToSurface(collision, contact); PlayStickingSound(collision); parentObject = collision.gameObject; if ((Object)(object)parentObject != (Object)null) { CSGDestroyNotifier cSGDestroyNotifier = parentObject.GetComponent<CSGDestroyNotifier>(); if ((Object)(object)cSGDestroyNotifier == (Object)null) { cSGDestroyNotifier = parentObject.AddComponent<CSGDestroyNotifier>(); } cSGDestroyNotifier.OnDestroyed += OnDestroyUnstickGrenade; } break; } } private bool IsContactPointWithinStickingDistance(Vector3 contactPoint) { //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_000d: 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) Vector3 val = stickyCollider.ClosestPoint(contactPoint); float num = Vector3.Distance(contactPoint, val); return num < stickingDistance; } private void StickToSurface(Collision collision, ContactPoint contact) { //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_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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0088: 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_014f: Expected O, but got Unknown //IL_0158: 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_01be: 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_01da: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022e: 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_00a3: 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 ((Object)(object)stickyCollider == (Object)null) { return; } if ((Object)(object)interactiveObject != (Object)null && interactiveObject.IsHeld) { interactiveObject.ForceBreakInteraction(); } savedPosition = ((Component)this).transform.position; savedRotation = ((Component)this).transform.rotation; Vector3 lossyScale = ((Component)this).transform.lossyScale; Rigidbody rigidbody = collision.rigidbody; Vector3 val = ((ContactPoint)(ref contact)).normal * embeddingDistance; if ((Object)(object)rigidbody != (Object)null) { ((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val; FixedJoint component = ((Component)this).GetComponent<FixedJoint>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } FixedJoint val2 = ((Component)this).gameObject.AddComponent<FixedJoint>(); ((Joint)val2).connectedBody = rigidbody; ((Joint)val2).breakForce = float.MaxValue; ((Joint)val2).breakTorque = float.MaxValue; grenadeRigidbody.useGravity = false; grenadeRigidbody.isKinematic = false; grenadeRigidbody.constraints = (RigidbodyConstraints)0; grenadeRigidbody.mass = massWhileStuck; SetCollidersToLayer(stickyCollider, "NoCol"); } else { GameObject val3 = new GameObject("DummyParent"); val3.transform.position = ((ContactPoint)(ref contact)).point; val3.transform.rotation = collision.transform.rotation; grenadeRigidbody.isKinematic = true; val3.transform.SetParent(collision.transform, true); ((Component)this).transform.SetParent(val3.transform, false); ((Component)this).transform.localScale = new Vector3(lossyScale.x / ((Component)this).transform.lossyScale.x, lossyScale.y / ((Component)this).transform.lossyScale.y, lossyScale.z / ((Component)this).transform.lossyScale.z); ((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val; ((Component)this).transform.rotation = savedRotation; } } private void EnableStickyCollider() { if ((Object)(object)stickyCollider != (Object)null) { stickyCollider.enabled = true; } } private void DisableStickyColliderTemporarily() { if ((Object)(object)stickyCollider != (Object)null) { stickyCollider.enabled = false; } ((MonoBehaviour)this).StartCoroutine(ReenableStickyColliderAfterDelay()); } private IEnumerator ReenableStickyColliderAfterDelay() { yield return (object)new WaitForSeconds(regrabActivationDelay); EnableStickyCollider(); } private void PlayStickingSound(Collision collision) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if ((playStickSoundForRigidbodiesOnly && (Object)(object)collision.rigidbody != (Object)null) || !playStickSoundForRigidbodiesOnly) { SM.PlayCoreSound((FVRPooledAudioType)10, stickSounds, ((Component)this).transform.position); } } private void OnDestroyUnstickGrenade() { if ((Object)(object)this == (Object)null) { return; } if ((Object)(object)parentObject != (Object)null) { CSGDestroyNotifier component = parentObject.GetComponent<CSGDestroyNotifier>(); if ((Object)(object)component != (Object)null) { component.OnDestroyed -= OnDestroyUnstickGrenade; } parentObject = null; } FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } else if ((Object)(object)((Component)this).transform.parent != (Object)null) { ((Component)this).transform.SetParent((Transform)null); } if ((Object)(object)grenadeRigidbody != (Object)null) { grenadeRigidbody.isKinematic = false; grenadeRigidbody.detectCollisions = true; grenadeRigidbody.useGravity = true; grenadeRigidbody.constraints = (RigidbodyConstraints)0; } isSticking = false; if ((Object)(object)stickyCollider != (Object)null) { stickyCollider.enabled = false; } canStick = false; } private void SetCollidersToLayer(Collider collider, string layer) { ((Component)collider).gameObject.layer = LayerMask.NameToLayer(layer); } private void OnDestroy() { if ((Object)(object)parentObject != (Object)null) { CSGDestroyNotifier component = parentObject.GetComponent<CSGDestroyNotifier>(); if ((Object)(object)component != (Object)null) { component.OnDestroyed -= OnDestroyUnstickGrenade; } } } public void Arm() { //IL_002e: 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) if (!m_isArmed) { m_isArmed = true; m_fuseTime = FuseTime; SM.PlayCoreSound((FVRPooledAudioType)10, ArmedSound, ((Component)this).transform.position); if (PlaysAnimationOnArm) { Animator.Play(ArmingAnimationNode); } if (UsesCapSystem) { DummyCap.SetActive(false); Object.Instantiate<GameObject>(CapPrefab, CapPrefabSpawnPos.position, CapPrefabSpawnPos.rotation); } } } } public class ChamberDependentParticlesAndSounds : MonoBehaviour { public FVRFireArmChamber ChamberToRead; public ParticleSystem ParticlesToEnable; public AudioSource SoundsToEnable; private void Update() { if (ChamberToRead.IsFull) { if (!ParticlesToEnable.isPlaying) { ParticlesToEnable.Play(); } if (!SoundsToEnable.isPlaying) { SoundsToEnable.Play(); } } else { ParticlesToEnable.Stop(); SoundsToEnable.Stop(); } } } public class ClosedBoltBeltFedDualFeedFix : MonoBehaviour { public ClosedBoltWeapon Weapon; public ClosedBoltMagEjectionTrigger MagGrabTrigger; public Vector3 TriggerPosForBeltBox; public Vector3 ScaleForBeltBoxTrigger; private Vector3 TriggerPosForMag; private Vector3 ScaleForMagTrigger; private 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_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) TriggerPosForMag = ((FVRInteractiveObject)MagGrabTrigger).Transform.localPosition; ScaleForMagTrigger = ((FVRInteractiveObject)MagGrabTrigger).Transform.localScale; } private void Update() { //IL_0044: 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_0090: 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) FVRFireArmMagazine magazine = ((FVRFireArm)Weapon).Magazine; ClosedBoltMagEjectionTrigger magGrabTrigger = MagGrabTrigger; if ((Object)(object)magazine == (Object)null) { return; } if (!magazine.IsBeltBox) { ((Component)magGrabTrigger).gameObject.SetActive(true); ((FVRInteractiveObject)magGrabTrigger).Transform.localPosition = TriggerPosForMag; ((FVRInteractiveObject)magGrabTrigger).Transform.localScale = ScaleForMagTrigger; } if (magazine.IsBeltBox) { if (!((FVRFireArm)Weapon).ConnectedToBox) { ((Component)magGrabTrigger).gameObject.SetActive(true); ((FVRInteractiveObject)magGrabTrigger).Transform.localPosition = TriggerPosForBeltBox; ((FVRInteractiveObject)magGrabTrigger).Transform.localScale = ScaleForBeltBoxTrigger; } else { ((Component)MagGrabTrigger).gameObject.SetActive(false); } } } } public class ClosedBoltMagReleaseSelector : MonoBehaviour { public ClosedBoltWeapon Gun; public Vector3 MagReleaseUnpress_Safe; public Vector3 MagReleaseUnpress_NotSafe; private void Update() { //IL_0018: 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_0046: 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) if ((int)Gun.FireSelector_Modes[Gun.m_fireSelectorMode].ModeType == 0) { Gun.MagReleaseUnpressed = MagReleaseUnpress_Safe; } else { Gun.MagReleaseUnpressed = MagReleaseUnpress_NotSafe; } } } public class ClosedBoltPokeToChamberRound : FVRInteractiveObject { public ClosedBoltWeapon Weapon; public FVRFireArmChamber Chamber; public override void Poke(FVRViveHand hand) { if (((Object)(object)((FVRInteractiveObject)Weapon).m_hand == (Object)null || (Object)(object)hand != (Object)(object)((FVRInteractiveObject)Weapon).m_hand) && !Chamber.IsFull) { Weapon.Bolt.ImpartFiringImpulse(); } } } public class Commando : FVRFireArm { [Serializable] public class CommandoMovingPart { public MovableObjectPart ObjectPart; public E_State DesiredState; } [Header("Commando")] public FVRFireArmChamber[] CommandoChambers; public Transform[] CommandoMuzzles; public int CurrentChamber = 0; public bool AlsoPlaysSecondFireSound = true; public AudioEvent SecondFireSound; public Transform SecondFireSoundPosition; public bool DeletesCartridgeOnFire = true; public bool DestroyWhenEmpty = false; public float KillDelay = 30f; public bool IsEmpty = false; public bool UseEnableDisablePerChamberSystem = true; public GameObject[] EnableIfCorrespondingChamberIsSpent; public GameObject[] DisableIfCorrespondingChamberIsSpent; public Transform Trigger; public float Trigger_ForwardValue; public float Trigger_RearwardValue; public Axis TriggerAxis; public InterpStyle TriggerInterpStyle = (InterpStyle)1; private float m_triggerFloat; [Header("Moving Parts Stuff")] public bool UsesMovingPartSystem = false; public bool AllMovingPartsReady = false; public CommandoMovingPart[] MovingParts; public override void Awake() { ((FVRFireArm)this).Awake(); FVRFireArmChamber[] commandoChambers = CommandoChambers; foreach (FVRFireArmChamber item in commandoChambers) { base.FChambers.Add(item); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); m_triggerFloat = hand.Input.TriggerFloat; if ((Object)(object)Trigger != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), TriggerInterpStyle, TriggerAxis); } if (!((FVRPhysicalObject)this).IsAltHeld && hand.Input.TriggerDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && CurrentChamber <= CommandoChambers.Length - 1) { Fire(); } IsEmpty = true; FVRFireArmChamber[] commandoChambers = CommandoChambers; foreach (FVRFireArmChamber val in commandoChambers) { if (val.IsFull && !val.IsSpent) { IsEmpty = false; break; } } if (IsEmpty && DestroyWhenEmpty) { Object.Destroy((Object)(object)((Component)this).gameObject, KillDelay); } } public override Transform GetMuzzle() { return CommandoMuzzles[CurrentChamber]; } public void Fire() { //IL_0104: 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_005d: 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) if (!CommandoChambers[CurrentChamber].IsFull || CommandoChambers[CurrentChamber].IsSpent) { return; } if (UsesMovingPartSystem) { AllMovingPartsReady = true; CommandoMovingPart[] movingParts = MovingParts; foreach (CommandoMovingPart commandoMovingPart in movingParts) { if (commandoMovingPart.ObjectPart.State != commandoMovingPart.DesiredState) { AllMovingPartsReady = false; } } if (!AllMovingPartsReady) { return; } } FVRFireArmChamber val = CommandoChambers[CurrentChamber]; val.Fire(); ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (AlsoPlaysSecondFireSound) { SM.PlayCoreSound((FVRPooledAudioType)0, SecondFireSound, ((Component)SecondFireSoundPosition).transform.position); } if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; val.UpdateProxyDisplay(); } else if (DeletesCartridgeOnFire) { val.SetRound((FVRFireArmRound)null, false); } if (UseEnableDisablePerChamberSystem) { EnableIfCorrespondingChamberIsSpent[CurrentChamber].SetActive(true); DisableIfCorrespondingChamberIsSpent[CurrentChamber].SetActive(false); } CurrentChamber++; if (CurrentChamber >= CommandoChambers.Length) { CurrentChamber = 0; } } public override List<FireArmRoundClass> GetChamberRoundList() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (CommandoChambers[0].IsFull && !CommandoChambers[0].IsSpent) { List<FireArmRoundClass> list = new List<FireArmRoundClass>(); list.Add(CommandoChambers[0].GetRound().RoundClass); return list; } return null; } public override void SetLoadedChambers(List<FireArmRoundClass> rounds) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) FVRFireArmChamber[] commandoChambers = CommandoChambers; foreach (FVRFireArmChamber val in commandoChambers) { if (rounds.Count > 0) { val.Autochamber(rounds[0]); } } } } public class DemonadeProximityDetonate : MonoBehaviour { public MF2_Demonade Demonade; public float ActivationDelay = 1f; private float m_timetoDelay = 0f; private bool isArmed = false; private void Update() { if (m_timetoDelay < ActivationDelay) { m_timetoDelay += Time.deltaTime; } if (m_timetoDelay >= ActivationDelay) { isArmed = true; } } private void OnTriggerEnter(Collider other) { if (isArmed) { string text = LayerMask.LayerToName(((Component)other).gameObject.layer); if (Demonade.ExplodeOnContactLayerName == text) { Demonade.Explode(); } } } } public class DisableIfCurrentMagIsBeltBox : MonoBehaviour { public FVRFireArm Firearm; public GameObject GameObjectToDisable; private void Update() { GameObjectToDisable.SetActive(true); } } public class Epoch : FVRFireArm { [Header("Epoch Component Params")] public GameObject UnchargedBolt; public GameObject ChargedBolt; private bool HasRound = false; [Header("Epoch Trigger Params")] public float TriggerBreakPoint; public Transform Trigger; public float Trigger_ForwardValue; public float Trigger_RearwardValue; public Axis TriggerAxis; public InterpStyle TriggerInterpStyle = (InterpStyle)1; private float TriggerHeldStartTime = 0f; public float SafeHoldTime = 1f; public float MaxUnsafeHoldTime = 3f; public GameObject[] SelfDestructPrefabs; private float m_triggerFloat; private bool IsChargedToPowerful = false; private float ManipulationFactor = 0f; private float ManipulationFactor2 = 0f; private bool HasStartedCharging = false; [Header("Epoch Visual Params")] public ParticleSystem ChargingParticles; public ParticleSystem ChargedParticles; public ParticleSystem FiringParticles; public int NumberOfParticles; public Transform MainChargeBars; public Vector2 YScaleMainSafe; public Vector2 YScaleMainUnsafe; public Transform OpticChargeBar; public Vector2 YScaleOptic; public Vector2 YScaleOpticUnsafe; [Header("Epoch Audio Params")] public FVRTailSoundClass TailClass = (FVRTailSoundClass)8; public AudioEvent ChargingClip; public AudioEvent FullyChargedClip; public AudioSource ChargeLoopAudio; private bool HasPlayedFullyChargedSound = false; public float MaxChargeLoopPitch = 1.5f; private void Start() { ChargeLoopAudio.Stop(); ChargingParticles.Stop(); ChargedParticles.Stop(); } public override void EndInteraction(FVRViveHand hand) { ((FVRFireArm)this).EndInteraction(hand); ManipulationFactor = 0f; ManipulationFactor2 = 0f; if (ChargingParticles.isPlaying) { ChargingParticles.Stop(); } if (ChargedParticles.isPlaying) { ChargedParticles.Stop(); } if (ChargeLoopAudio.isPlaying) { ChargeLoopAudio.Stop(); } HasPlayedFullyChargedSound = false; } public override void UpdateInteraction(FVRViveHand hand) { //IL_009e: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); m_triggerFloat = hand.Input.TriggerFloat; if (IsChargedToPowerful && !ChargeLoopAudio.isPlaying) { ChargeLoopAudio.Play(); } if (!IsChargedToPowerful && ChargeLoopAudio.isPlaying) { ChargeLoopAudio.Stop(); } if ((Object)(object)Trigger != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), TriggerInterpStyle, TriggerAxis); } HasRound = true; EpochMagazine epochMagazine = (EpochMagazine)(object)base.Magazine; if ((Object)(object)epochMagazine == (Object)null || epochMagazine.NumOfRoundsRemaining == 0) { HasRound = false; } if (!((FVRPhysicalObject)this).IsAltHeld && m_triggerFloat >= TriggerBreakPoint && !HasStartedCharging && HasRound) { HasStartedCharging = true; TriggerHeldStartTime = Time.time; IsChargedToPowerful = false; ManipulationFactor = 0f; SM.PlayCoreSound((FVRPooledAudioType)0, ChargingClip, ((Component)this).transform.position); } if (!((FVRPhysicalObject)this).IsAltHeld && m_triggerFloat >= TriggerBreakPoint) { float num = Time.time - TriggerHeldStartTime; if (num < SafeHoldTime) { ManipulationFactor = Mathf.Clamp01(num / SafeHoldTime); } if (num >= SafeHoldTime) { ManipulationFactor = 1f; IsChargedToPowerful = true; if (!HasPlayedFullyChargedSound) { SM.PlayCoreSound((FVRPooledAudioType)0, FullyChargedClip, ((Component)this).transform.position); HasPlayedFullyChargedSound = true; } } if (num >= SafeHoldTime && num < MaxUnsafeHoldTime) { if (!HasPlayedFullyChargedSound) { SM.PlayCoreSound((FVRPooledAudioType)0, FullyChargedClip, ((Component)this).transform.position); HasPlayedFullyChargedSound = true; } ManipulationFactor = 1f; IsChargedToPowerful = true; ManipulationFactor2 = Mathf.Clamp01((num - SafeHoldTime) / (MaxUnsafeHoldTime - SafeHoldTime)); ChargeLoopAudio.pitch = 1f + ManipulationFactor2 * MaxChargeLoopPitch; } if (num >= MaxUnsafeHoldTime) { SelfDestruct(hand); } if (!ChargingParticles.isPlaying) { ChargingParticles.Play(); } } if (m_triggerFloat < TriggerBreakPoint && IsChargedToPowerful && !((FVRPhysicalObject)this).IsAltHeld) { Fire(); IsChargedToPowerful = false; ManipulationFactor = 0f; ManipulationFactor2 = 0f; FiringParticles.Emit(NumberOfParticles); ChargingParticles.Stop(); HasPlayedFullyChargedSound = false; } if (m_triggerFloat < TriggerBreakPoint && !IsChargedToPowerful) { ManipulationFactor = 0f; if (ChargingParticles.isPlaying) { ChargingParticles.Stop(); } HasPlayedFullyChargedSound = false; HasStartedCharging = false; TriggerHeldStartTime = Time.time; } UpdateAnimatedParts(); } public void UpdateAnimatedParts() { //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_006b: 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_00de: Unknown result type (might be due to invalid IL or missing references) float num = YScaleMainSafe.x - YScaleMainSafe.y; float num2 = YScaleMainUnsafe.x - YScaleMainUnsafe.y; Vector3 localScale = ((Component)MainChargeBars).transform.localScale; localScale.y = 1f - (ManipulationFactor * num + ManipulationFactor2 * num2); ((Component)MainChargeBars).transform.localScale = localScale; float num3 = YScaleOptic.x - YScaleOptic.y; float num4 = YScaleOpticUnsafe.x - YScaleOpticUnsafe.y; Vector3 localScale2 = ((Component)OpticChargeBar).transform.localScale; localScale2.y = 1f - (num3 * ManipulationFactor + ManipulationFactor2 * num4); ((Component)OpticChargeBar).transform.localScale = localScale2; if (IsChargedToPowerful && !ChargedParticles.isPlaying) { ChargedParticles.Play(); } if (!IsChargedToPowerful && ChargedParticles.isPlaying) { ChargedParticles.Stop(); } } public void Fire() { //IL_001b: 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_006f: 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_00dd: 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_00f7: 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_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) GameObject val = null; if (IsChargedToPowerful) { val = Object.Instantiate<GameObject>(UnchargedBolt, ((FVRFireArm)this).GetMuzzle().position, ((FVRFireArm)this).GetMuzzle().rotation); } if (!IsChargedToPowerful) { val = Object.Instantiate<GameObject>(ChargedBolt, ((FVRFireArm)this).GetMuzzle().position, ((FVRFireArm)this).GetMuzzle().rotation); } BallisticProjectile component = val.GetComponent<BallisticProjectile>(); component.Fire(val.transform.forward, (FVRFireArm)(object)this); HasPlayedFullyChargedSound = false; ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); base.m_pool_shot.PlayClip(base.AudioClipSet.Shots_Main, base.MuzzlePos.position, (AudioMixerGroup)null); base.m_pool_tail.PlayClipPitchOverride(SM.GetTailSet(TailClass, GM.CurrentPlayerBody.GetCurrentSoundEnvironment()), ((FVRFireArm)this).GetMuzzle().position, base.AudioClipSet.TailPitchMod_Main, (AudioMixerGroup)null); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { EpochMagazine epochMagazine = (EpochMagazine)(object)base.Magazine; epochMagazine.NumOfRoundsRemaining++; } HasStartedCharging = false; ChargeLoopAudio.pitch = 1f; } public void SelfDestruct(FVRViveHand hand) { //IL_0023: 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) ((FVRInteractiveObject)this).EndInteraction(hand); GameObject[] selfDestructPrefabs = SelfDestructPrefabs; foreach (GameObject val in selfDestructPrefabs) { Object.Instantiate<GameObject>(val, ((Component)this).transform.position, ((Component)this).transform.rotation); } ((FVRInteractiveObject)this).ForceBreakInteraction(); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class EpochMagazine : FVRFireArmMagazine { [Header("Epoch Cell Params")] public int NumOfRoundsRemaining = 3; } } namespace Cityrobo { public class FirearmEjectAndDeleteMagOnEmpty : MonoBehaviour { public FVRFireArm Firearm; public bool DeleteMagazineEntirely = false; public void Update() { if ((Object)(object)Firearm.Magazine != (Object)null && !Firearm.Magazine.HasARound()) { FVRFireArmMagazine magazine = Firearm.Magazine; Firearm.EjectMag(false); if (DeleteMagazineEntirely) { Object.Destroy((Object)(object)((Component)magazine).gameObject); } } } } } namespace ShermanJumbo { public class FirearmFlyOutOfHand : MonoBehaviour { public FVRFireArm Gun; public FVRFireArmChamber Chamber; public float TriggerFloat = 0.85f; protected bool IsSpent = false; protected bool WasSpent = false; public float Force = 30f; public float Torque = 20f; private void Update() { //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_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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0123: 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) IsSpent = Chamber.IsSpent; if (IsSpent && !WasSpent && (Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null && ((FVRInteractiveObject)Gun).m_hand.Input.TriggerFloat >= TriggerFloat && !Gun.IsTwoHandStabilized() && !Gun.IsForegripStabilized()) { if ((Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null) { ((FVRInteractiveObject)Gun).m_hand.EndInteractionIfHeld((FVRInteractiveObject)(object)Gun); ((FVRInteractiveObject)Gun).ForceBreakInteraction(); } ((FVRPhysicalObject)Gun).RootRigidbody.AddForceAtPosition((-((Component)this).transform.forward + ((Component)this).transform.up + Random.onUnitSphere * 0.25f) * Force, Gun.MuzzlePos.position, (ForceMode)1); ((FVRPhysicalObject)Gun).RootRigidbody.AddRelativeTorque(Vector3.right * Torque, (ForceMode)1); } WasSpent = Chamber.IsSpent; } } public class FirearmMainHandObjectToggler : MonoBehaviour { public bool OnOff = true; public GameObject[] ItemsToToggle; public AudioEvent AudEvent_OnClip; public AudioEvent AudEvent_OffClip; private bool _isItemToggled = false; public FVRFireArm Weapon; private void Update() { //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_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) FVRViveHand hand = ((FVRInteractiveObject)Weapon).m_hand; if (!((Object)(object)hand == (Object)null)) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if ((hand.IsInStreamlinedMode && hand.Input.BYButtonDown) || (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.left) <= 45f)) { Toggle(); } } } public void Toggle() { //IL_00b3: 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 (!OnOff) { return; } if (_isItemToggled) { GameObject[] itemsToToggle = ItemsToToggle; foreach (GameObject val in itemsToToggle) { val.SetActive(false); } SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_OffClip, ((Component)this).transform.position); _isItemToggled = false; } else { GameObject[] itemsToToggle2 = ItemsToToggle; foreach (GameObject val2 in itemsToToggle2) { val2.SetActive(true); } SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_OnClip, ((Component)this).transform.position); _isItemToggled = true; } } } public class FirearmSpinnyBarrels : MonoBehaviour { public FVRFireArm Gun; public GameObject SpinningBarrels; public float SpinRate; public dirType DirectionOfSpin; public float DecelerationRate = 0.5f; public float TriggerDeadzone = 0.01f; private float currentSpinSpeed = 0f; private bool TriggerPulled = false; public AudioSource SpinnySounds; public float SpinnySoundsVolume = 0.4f; private void Awake() { if ((Object)(object)SpinnySounds != (Object)null) { SpinnySounds.volume = 0f; } } private void Update() { //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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected I4, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)SpinnySounds != (Object)null) { SpinnySounds.volume = currentSpinSpeed / SpinRate * SpinnySoundsVolume; } if ((Object)(object)Gun != (Object)null && (Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null) { float triggerFloat = ((FVRInteractiveObject)Gun).m_hand.Input.TriggerFloat; if (triggerFloat >= TriggerDeadzone) { if (!TriggerPulled) { TriggerPulled = true; } currentSpinSpeed = SpinRate; } else if (TriggerPulled) { TriggerPulled = false; } } if (!TriggerPulled && currentSpinSpeed > 0f) { currentSpinSpeed -= DecelerationRate * Time.deltaTime; if (currentSpinSpeed < 0f) { currentSpinSpeed = 0f; } } if (currentSpinSpeed > 0f && (Object)(object)SpinningBarrels != (Object)null) { Vector3 zero = Vector3.zero; int num = (int)DirectionOfSpin; if (num >= 0 && num <= 2) { ((Vector3)(ref zero))[num] = currentSpinSpeed * Time.deltaTime; SpinningBarrels.transform.Rotate(zero); } else { Debug.LogWarning((object)"Invalid DirectionOfSpin value!"); } } } } public class GrenadeFuseTimeReadout : MonoBehaviour { public PinnedGrenade Grenade; public Text Text; public bool UseBetterVarTimeFuse = true; public float[] FuzeTimes; public float PitchStart = 1f; public float PitchEnd = 2.5f; private int FuzeTimeIndex = 0; private void Update() { //IL_00fc: 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) //IL_01ed: 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) if (Grenade.m_isLeverReleased) { float num = Grenade.m_fuseTime; if (num < 0f) { num = 0f; } Text.text = num.ToString("F1") + "s"; if (UseBetterVarTimeFuse) { float num2 = Mathf.Clamp(1f - Grenade.m_fuseTime / Grenade.m_startFuseTime, 0f, 1f); num2 = Mathf.Pow(num2, 2f); if (Grenade.m_fuse_tick <= 0f) { Grenade.m_fuse_tick = Mathf.Lerp(Grenade.m_fuse_StartRefire, Grenade.m_fuse_EndRefire, num2); float num3 = Mathf.Lerp(PitchStart, PitchEnd, num2); SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, Grenade.AudEvent_FusePulse, ((FVRInteractiveObject)Grenade).Transform.position, new Vector2(1f, 1f), new Vector2(num3, num3)); Grenade.FusePSystem.Emit(2); } else { PinnedGrenade grenade = Grenade; grenade.m_fuse_tick -= Time.deltaTime; } } } if (!UseBetterVarTimeFuse) { return; } if ((Object)(object)((FVRInteractiveObject)Grenade).m_hand != (Object)null && ((((FVRInteractiveObject)Grenade).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)Grenade).m_hand.Input.BYButtonDown) || (((FVRInteractiveObject)Grenade).m_hand.Input.TouchpadDown && ((Vector2)(ref ((FVRInteractiveObject)Grenade).m_hand.Input.TouchpadAxes)).magnitude > 0.2f && Vector2.Angle(((FVRInteractiveObject)Grenade).m_hand.Input.TouchpadAxes, Vector2.up) <= 45f))) { if (FuzeTimeIndex < FuzeTimes.Length - 1) { FuzeTimeIndex++; } else { FuzeTimeIndex = 0; } } Grenade.DefaultFuse.x = FuzeTimes[FuzeTimeIndex]; Grenade.DefaultFuse.y = FuzeTimes[FuzeTimeIndex]; if (!Grenade.m_isLeverReleased) { float num4 = FuzeTimes[FuzeTimeIndex]; Grenade.DefaultFuse.x = num4; Grenade.DefaultFuse.y = num4; Grenade.m_startFuseTime = num4; Grenade.m_fuseTime = num4; Text.text = num4.ToString("F1") + "s"; } } } } namespace BitWizrd.GrenadeMod { public class GrenadeMod : FVRPhysicalObject { [Header("Grenade Settings")] public GameObject grenadeGameObject; public PinnedGrenadeRing pinnedGrenadeRing; public Rigidbody grenadeRigidbody; public bool activateLeverOnPinPull = false; [Header("Sticky Grenade Settings")] public bool isStickyGrenade = true; public Collider stickyCollider; public float stickingDistance = 0.1f; public LayerMask stickyLayers; public float embeddingDistance = 0.02f; public bool playStickSoundForRigidbodiesOnly = true; public AudioSource stickSoundSource; public AudioClip[] stickSounds; public float minimumStickVelocity = 2f; public float regrabActivationDelay = 0.5f; public float massWhileStuck = 10f; [Header("Grenade Cooking Settings")] public GameObject pinPullEffectPrefab; public AudioSource cookingAudioSource; public AudioClip[] cookingClips; public float cookingSoundDelay = 1f; [Header("Grenade Fast Throw Settings")] public AudioSource fastThrowAudioSource; public AudioClip[] fastThrowClips; public float fastThrowVelocityThreshold = 10f; public float releaseWindow = 0.5f; private PinnedGrenade grenade; private Collider grenadeCollider; private bool hasPlayedFastThrowSound = false; private bool isPinPulled = false; private bool isHeld = false; private bool wasHeld = false; private bool pinPulledChecked = false; private bool shouldCheckVelocity = false; private bool hasReleasedLever = false; private bool isSticking = false; private bool canStick = false; private float timeSinceRelease = 0f; private GameObject parentObject; private Vector3 savedPosition; private Quaternion savedRotation; private Vector3 savedScale; private FVRInteractiveObject interactiveObject; private bool isCookingCoroutineRunning = false; private void Start() { interactiveObject = ((Component)this).GetComponent<FVRInteractiveObject>(); } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)grenadeGameObject == (Object)null) { return; } grenade = grenadeGameObject.GetComponent<PinnedGrenade>(); if ((Object)(object)grenade == (Object)null) { return; } FVRPhysicalObject component = grenadeGameObject.GetComponent<FVRPhysicalObject>(); if ((Object)(object)component == (Object)null) { return; } grenadeCollider = grenadeGameObject.GetComponent<Collider>(); if ((Object)(object)grenadeCollider == (Object)null) { return; } isHeld = ((FVRInteractiveObject)component).IsHeld; if ((Object)(object)pinnedGrenadeRing != (Object)null) { isPinPulled = pinnedGrenadeRing.HasPinDetached(); if (!pinPulledChecked && isPinPulled) { pinPulledChecked = true; shouldCheckVelocity = true; if (isStickyGrenade) { EnableStickyCollider(); } if ((Object)(object)pinPullEffectPrefab != (Object)null) { pinPullEffectPrefab.SetActive(true); } } if (!wasHeld && isHeld) { hasPlayedFastThrowSound = false; timeSinceRelease = 0f; if (isPinPulled) { EnableStickyCollider(); } shouldCheckVelocity = isPinPulled; wasHeld = true; canStick = true; isSticking = false; FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); grenadeRigidbody.isKinematic = false; grenadeRigidbody.detectCollisions = true; grenadeRigidbody.useGravity = true; grenadeRigidbody.constraints = (RigidbodyConstraints)0; Debug.Log((object)"FixedJoint grenade unstuck upon being picked up."); } else if ((Object)(object)((Component)this).transform.parent != (Object)null && ((Object)((Component)((Component)this).transform.parent).gameObject).name == "DummyParent") { GameObject gameObject = ((Component)((Component)this).transform.parent).gameObject; ((Component)this).transform.SetParent((Transform)null, true); Object.Destroy((Object)(object)gameObject); grenadeRigidbody.isKinematic = false; grenadeRigidbody.detectCollisions = true; grenadeRigidbody.useGravity = true; grenadeRigidbody.constraints = (RigidbodyConstraints)0; Debug.Log((object)"Static-stuck grenade unstuck upon being picked up."); } if (isStickyGrenade) { DisableStickyColliderTemporarily(); } } if (wasHeld && !isHeld) { isSticking = false; wasHeld = false; } } if (isPinPulled || !isHeld) { DisableMeleeDamage(component); } else { EnableMeleeDamage(component); } if (isPinPulled && !cookingAudioSource.isPlaying && cookingClips.Length > 0 && !isCookingCoroutineRunning) { if (cookingSoundDelay == 0f) { PlayCookingSoundImmediately(); } else { ((MonoBehaviour)this).StartCoroutine(HandleCookingSoundDelay()); } } if (isPinPulled && (Object)(object)pinPullEffectPrefab != (Object)null) { pinPullEffectPrefab.SetActive(true); } if (isPinPulled && activateLeverOnPinPull && !hasReleasedLever) { grenade.ReleaseLever(); hasReleasedLever = true; } } public override void FVRFixedUpdate() { //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_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) ((FVRPhysicalObject)this).FVRFixedUpdate(); if (shouldCheckVelocity && isHeld) { Vector3 velocity = grenadeRigidbody.velocity; if (((Vector3)(ref velocity)).magnitude >= minimumStickVelocity) { canStick = true; } else { canStick = false; } } if (!shouldCheckVelocity || isHeld) { return; } timeSinceRelease += Time.fixedDeltaTime; if (timeSinceRelease <= releaseWindow) { Vector3 velocity2 = grenadeRigidbody.velocity; if (((Vector3)(ref velocity2)).magnitude > fastThrowVelocityThreshold && !hasPlayedFastThrowSound) { PlayFastThrowSound(); } } else { shouldCheckVelocity = false; } } private void DisableMeleeDamage(FVRPhysicalObject physicalObject) { if (physicalObject.MP != null && physicalObject.MP.IsMeleeWeapon) { physicalObject.MP.IsMeleeWeapon = false; } } private void EnableMeleeDamage(FVRPhysicalObject physicalObject) { if (physicalObject.MP != null && !physicalObject.MP.IsMeleeWeapon) { physicalObject.MP.IsMeleeWeapon = true; } } private void PlayFastThrowSound() { if (fastThrowClips.Length > 0 && (Object)(object)fastThrowAudioSource != (Object)null) { AudioClip val = fastThrowClips[Random.Range(0, fastThrowClips.Length)]; fastThrowAudioSource.PlayOneShot(val); } hasPlayedFastThrowSound = true; } private void OnCollisionEnter(Collision collision) { //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_00d6: 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_0113: Unknown result type (might be due to invalid IL or missing references) if (!isPinPulled || isSticking || !isStickyGrenade || !((Object)(object)stickyCollider != (Object)null) || (Object)(object)collision.gameObject.GetComponent<BreakableGlass>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenade>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenadePin>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<SosigWeapon>() != (Object)null) { return; } ContactPoint[] contacts = collision.contacts; for (int i = 0; i < contacts.Length; i++) { ContactPoint contact = contacts[i]; if (!((Object)(object)((ContactPoint)(ref contact)).thisCollider == (Object)(object)stickyCollider)) { continue; } if ((LayerMask.op_Implicit(stickyLayers) & (1 << collision.gameObject.layer)) == 0 || !IsContactPointWithinStickingDistance(((ContactPoint)(ref contact)).point)) { break; } isSticking = true; StickToSurface(collision, contact); PlayStickingSound(collision); parentObject = collision.gameObject; if ((Object)(object)parentObject != (Object)null) { DestroyNotifier destroyNotifier = parentObject.GetComponent<DestroyNotifier>(); if ((Object)(object)destroyNotifier == (Object)null) { destroyNotifier = parentObject.AddComponent<DestroyNotifier>(); } destroyNotifier.OnDestroyed += OnDestroyUnstickGrenade; } break; } } private bool IsContactPointWithinStickingDistance(Vector3 contactPoint) { //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_000d: 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) Vector3 val = stickyCollider.ClosestPoint(contactPoint); float num = Vector3.Distance(contactPoint, val); return num < stickingDistance; } private void StickToSurface(Collision collision, ContactPoint contact) { //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_007c: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_015a: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_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_01f8: 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_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_021f: 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_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_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)stickyCollider == (Object)null) { return; } if ((Object)(object)interactiveObject != (Object)null && interactiveObject.IsHeld) { interactiveObject.ForceBreakInteraction(); } savedPosition = ((Component)this).transform.position; savedRotation = ((Component)this).transform.rotation; Vector3 lossyScale = ((Component)this).transform.lossyScale; Rigidbody rigidbody = collision.rigidbody; Vector3 val = ((ContactPoint)(ref contact)).normal * embeddingDistance; if ((Object)(object)rigidbody != (Object)null) { ((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val; FixedJoint component = ((Component)this).GetComponent<FixedJoint>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } FixedJoint val2 = ((Component)this).gameObject.AddComponent<FixedJoint>(); ((Joint)val2).connectedBody = rigidbody; ((Joint)val2).breakForce = float.MaxValue; ((Joint)val2).breakTorque = float.MaxValue; grenadeRigidbody.useGravity = false; grenadeRigidbody.isKinematic = false; grenadeRigidbody.constraints = (RigidbodyConstraints)0; grenadeRigidbody.mass = massWhileStuck; SetCollidersToLayer(stickyCollider, "NoCol"); } else { GameObject val3 = new GameObject("DummyParent"); val3.transform.position = ((ContactPoint)(ref contact)).point; val3.transform.rotation = collision.transform.rotation; grenadeRigidbody.isKinematic = true; val3.transform.SetParent(collision.transform, true); ((Component)this).transform.SetParent(val3.transform, false); ((Component)this).transform.localScale = new Vector3(lossyScale.x / ((Component)this).transform.lossyScale.x, lossyScale.y / ((Component)this).transform.lossyScale.y, lossyScale.z / ((Component)this).transform.lossyScale.z); ((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val; ((Component)this).transform.rotation = savedRotation; } } private void EnableStickyCollider() { if ((Object)(object)stickyCollider != (Object)null) { stickyCollider.enabled = true; } } private void DisableStickyColliderTemporarily() { if ((Object)(object)stickyCollider != (Object)null) { stickyCollider.enabled = false; } ((MonoBehaviour)this).StartCoroutine(ReenableStickyColliderAfterDelay()); } private IEnumerator ReenableStickyColliderAfterDelay() { yield return (object)new WaitForSeconds(regrabActivationDelay); EnableStickyCollider(); } private void PlayStickingSound(Collision collision) { if ((Object)(object)stickSoundSource != (Object)null && stickSounds.Length > 0 && ((playStickSoundForRigidbodiesOnly && (Object)(object)collision.rigidbody != (Object)null) || !playStickSoundForRigidbodiesOnly)) { int num = Random.Range(0, stickSounds.Length); stickSoundSource.clip = stickSounds[num]; stickSoundSource.Play(); } } private void OnDestroyUnstickGrenade() { if ((Object)(object)this == (Object)null) { return; } if ((Object)(object)parentObject != (Object)null) { DestroyNotifier component = parentObject.GetComponent<DestroyNotifier>(); if ((Object)(object)component != (Object)null) { component.OnDestroyed -= OnDestroyUnstickGrenade; } parentObject = null; } FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } else if ((Object)(object)((Component)this).transform.parent != (Object)null) { ((Component)this).transform.SetParent((Transform)null); } if ((Object)(object)grenadeRigidbody != (Object)null) { grenadeRigidbody.isKinematic = false; grenadeRigidbody.detectCollisions = true; grenadeRigidbody.useGravity = true; grenadeRigidbody.constraints = (RigidbodyConstraints)0; } isSticking = false; if ((Object)(object)stickyCollider != (Object)null) { stickyCollider.enabled = false; } canStick = false; } private void SetCollidersToLayer(Collider collider, string layer) { ((Component)collider).gameObject.layer = LayerMask.NameToLayer(layer); } private IEnumerator HandleCookingSoundDelay() { isCookingCoroutineRunning = true; if (cookingSoundDelay > 0f) { yield return (object)new WaitForSeconds(cookingSoundDelay); } if ((Object)(object)cookingAudioSource != (Object)null && cookingClips.Length > 0) { int num = Random.Range(0, cookingClips.Length); cookingAudioSource.clip = cookingClips[num]; cookingAudioSource.Play(); } isCookingCoroutineRunning = false; } private void PlayCookingSoundImmediately() { if ((Object)(object)cookingAudioSource != (Object)null && cookingClips.Length > 0) { int num = Random.Range(0, cookingClips.Length); cookingAudioSource.clip = cookingClips[num]; cookingAudioSource.Play(); } } private void OnDestroy() { if ((Object)(object)parentObject != (Object)null) { DestroyNotifier component = parentObject.GetComponent<DestroyNotifier>(); if ((Object)(object)component != (Object)null) { component.OnDestroyed -= OnDestroyUnstickGrenade; } } } } public class DestroyNotifier : MonoBehaviour { public delegate void DestroyedAction(); public event DestroyedAction OnDestroyed; private void OnDestroy() { if (this.OnDestroyed != null) { this.OnDestroyed(); } } } } namespace ShermanJumbo { public class GrenadeParticlesIfArmed : MonoBehaviour { public PinnedGrenade Grenade; public ParticleSystem[] Particles; public AudioSource ArmedSounds; public bool ReleaseLeverOnPinPull = true; private bool m_hasReleasedLever = false; private bool m_hasArmed = false; private bool m_hasExploded = false; private void Start() { StopParticles(); ArmedSounds.Stop(); } private void Update() { if ((Object)(object)Grenade == (Object)null || Particles == null || (Object)(object)ArmedSounds == (Object)null) { return; } bool isPinPulled = Grenade.m_isPinPulled; bool isLeverReleased = Grenade.m_isLeverReleased; bool hasSploded = Grenade.m_hasSploded; if (ReleaseLeverOnPinPull && isPinPulled && !m_hasReleasedLever) { m_hasReleasedLever = true; Grenade.ReleaseLever(); } if (isLeverReleased && !m_hasArmed) { m_hasArmed = true; PlayParticles(); if (!ArmedSounds.isPlaying) { ArmedSounds.Play(); } } if (hasSploded && !m_hasExploded) { m_hasExploded = true; StopParticles(); if (ArmedSounds.isPlaying) { ArmedSounds.Stop(); } } } private void PlayParticles() { if (Particles == null) { return; } ParticleSystem[] particles = Particles; foreach (ParticleSystem val in particles) { if ((Object)(object)val != (Object)null && !val.isPlaying) { val.Play(); } } } private void StopParticles() { if (Particles == null) { return; } ParticleSystem[] particles = Particles; foreach (ParticleSystem val in particles) { if ((Object)(object)val != (Object)null && val.isPlaying) { val.Stop(); } } } } public class GrenadeTouchpadArm : MonoBehaviour { public PinnedGrenade Grenade; private FVRViveHand Hand; private void Update() { //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_0084: 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) Hand = ((FVRInteractiveObject)Grenade).m_hand; if ((Object)(object)Hand == (Object)null) { return; } Vector2 touchpadAxes = Hand.Input.TouchpadAxes; if ((!Hand.IsInStreamlinedMode || !Hand.Input.AXButtonPressed) && (!Hand.Input.TouchpadPressed || !(((Vector2)(ref touchpadAxes)).magnitude > 0.2f) || !(Vector2.Angle(touchpadAxes, Vector2.down) <= 45f))) { return; } foreach (PinnedGrenadeRing ring in Grenade.m_rings) { ring.PopOutRoutine(); } Grenade.ReleaseLever(); } } public class LAPD2019LaserMaxDistance : MonoBehaviour { public GameObject BeamHitPoint; public Transform Aperture; public LayerMask LM; private RaycastHit m_hit; private bool m_isOn; public bool UsesAutoOnOff; public FVRPhysicalObject PO; public Transform Muzzle; public float MaxDistance = 1000f; public void TurnOn() { m_isOn = true; } public void TurnOff() { m_isOn = false; } private void Update() { //IL_0062: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0198: 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) if (UsesAutoOnOff) { if (((FVRInteractiveObject)PO).IsHeld) { TurnOn(); } else { TurnOff(); } } if (m_isOn) { if ((Object)(object)Muzzle != (Object)null) { ((Component)Aperture).transform.LookAt(Muzzle.position + Muzzle.forward * 25f); ((Component)Aperture).transform.localEulerAngles = new Vector3(((Component)Aperture).transform.localEulerAngles.x, 0f, 0f); } if (!BeamHitPoint.activeSelf) { BeamHitPoint.SetActive(true); } Vector3 position = Aperture.position + Aperture.forward * MaxDistance; float num = MaxDistance; if (Physics.Raycast(Aperture.position, Aperture.forward, ref m_hit, MaxDistance, LayerMask.op_Implicit(LM), (QueryTriggerInteraction)1)) { position = ((RaycastHit)(ref m_hit)).point; num = ((RaycastHit)(ref m_hit)).distance; } float num2 = num * 0.01f; float num3 = Mathf.Lerp(0.01f, 0.2f, num2); BeamHitPoint.transform.position = position; BeamHitPoint.transform.localScale = new Vector3(num3, num3, num3); } else if (BeamHitPoint.activeSelf) { BeamHitPoint.SetActive(false); } } } public class LAPDLaserAsAttachment : MonoBehaviour { public LAPD2019Laser Laser; private void Awake() { Laser.m_isOn = true; } } } namespace DigitalRuby.LightningBolt { public enum LightningBoltAnimationMode { None, Random, Loop, PingPong } [RequireComponent(typeof(LineRenderer))] public class LightningBoltScript : MonoBehaviour { [Tooltip("The game object where the lightning will emit from. If null, StartPosition is used.")] public GameObject StartObject; [Tooltip("The start position where the lightning will emit from. This is in world space if StartObject is null, otherwise this is offset from StartObject position.")] public Vector3 StartPosition; [Tooltip("The game object where the lightning will end at. If null, EndPosition is used.")] public GameObject EndObject; [Tooltip("The end position where the lightning will end at. This is in world space if EndObject is null, otherwise this is offset from EndObject position.")] public Vector3 EndPosition; [Range(0f, 8f)] [Tooltip("How manu generations? Higher numbers create more line segments.")] public int Generations = 6; [Range(0.01f, 1f)] [Tooltip("How long each bolt should last before creating a new bolt. In ManualMode, the bolt will simply disappear after this amount of seconds.")] public float Duration = 0.05f; private float timer; [Range(0f, 1f)] [Tooltip("How chaotic should the lightning be? (0-1)")] public float ChaosFactor = 0.15f; [Tooltip("In manual mode, the trigger method must be called to create a bolt")] public bool ManualMode; [Range(1f, 64f)] [Tooltip("The number of rows in the texture. Used for animation.")] public int Rows = 1; [Range(1f, 64f)] [Tooltip("The number of columns in the texture. Used for animation.")] public int Columns = 1; [Tooltip("The animation mode for the lightning")] public LightningBoltAnimationMode AnimationMode = LightningBoltAnimationMode.PingPong; [NonSerialized] [HideInInspector] public Random RandomGenerator = new Random(); private LineRenderer lineRenderer; private List<KeyValuePair<Vector3, Vector3>> segments = new List<KeyValuePair<Vector3, Vector3>>(); private int startIndex; private Vector2 size; private Vector2[] offsets; private int animationOffsetIndex; private int animationPingPongDirection = 1; private bool orthographic; private void GetPerpendicularVector(ref Vector3 directionNormalized, out Vector3 side) { //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_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_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) if (directionNormalized == Vector3.zero) { side = Vector3.right; return; } float x = directionNormalized.x; float y = directionNormalized.y; float z = directionNormalized.z; float num = Mathf.Abs(x); float num2 = Mathf.Abs(y); float num3 = Mathf.Abs(z); float num4; float num5; float num6; if (num >= num2 && num2 >= num3) { num4 = 1f; num5 = 1f; num6 = (0f - (y * num4 + z * num5)) / x; } else if (num2 >= num3) { num6 = 1f; num5 = 1f; num4 = (0f - (x * num6 + z * num5)) / y; } else { num6 = 1f; num4 = 1f; num5 = (0f - (x * num6 + y * num4)) / z; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num6, num4, num5); side = ((Vector3)(ref val)).normalized; } private void GenerateLightningBolt(Vector3 start, Vector3 end, int generation, int totalGenerations, float offsetAmount) { //IL_004c: 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_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_0078: 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_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_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) //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_0125: 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) if (generation < 0 || generation > 8) { return; } if (orthographic) { start.z = (end.z = Mathf.Min(start.z, end.z)); } segments.Add(new KeyValuePair<Vector3, Vector3>(start, end)); if (generation == 0) { return; } if (offsetAmount <= 0f) { Vector3 val = end - start; offsetAmount = ((Vector3)(ref val)).magnitude * ChaosFactor; } while (generation-- > 0) { int num = startIndex; startIndex = segments.Count; for (int i = num; i < startIndex; i++) { start = segments[i].Key; end = segments[i].Value; Vector3 val2 = (start + end) * 0.5f; RandomVector(ref start, ref end, offsetAmount, out var result); val2 += result; segments.Add(new KeyValuePair<Vector3, Vector3>(start, val2)); segments.Add(new KeyValuePair<Vector3, Vector3>(val2, end)); } offsetAmount *= 0.5f; } } public void RandomVector(ref Vector3 start, ref Vector3 end, float offsetAmount, out Vector3 result) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008a: 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_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_00cd: 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_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_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_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_005d: 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) if (orthographic) { Vector3 val = end - start; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f - normalized.y, normalized.x, normalized.z); float num = (float)RandomGenerator.NextDouble() * offsetAmount * 2f - offsetAmount; result = val2 * num; } else { Vector3 val3 = end - start; Vector3 directionNormalized = ((Vector3)(ref val3)).normalized; GetPerpendicularVector(ref directionNormalized, out var side); float num2 = ((float)RandomGenerator.NextDouble() + 0.1f) * offsetAmount; float num3 = (float)RandomGenerator.NextDouble() * 360f; result = Quaternion.AngleAxis(num3, directionNormalized) * side * num2; } } private void SelectOffsetFromAnimationMode() { //IL_0024: 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_0132: Unknown result type (might be due to invalid IL or missing references) if (AnimationMode == LightningBoltAnimationMode.None) { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[0]; return; } int num; if (AnimationMode == LightningBoltAnimationMode.PingPong) { num = animationOffsetIndex; animationOffsetIndex += animationPingPongDirection; if (animationOffsetIndex >= offsets.Length) { animationOffsetIndex = offsets.Length - 2; animationPingPongDirection = -1; } else if (animationOffsetIndex < 0) { animationOffsetIndex = 1; animationPingPongDirection = 1; } } else if (AnimationMode == LightningBoltAnimationMode.Loop) { num = animationOffsetIndex++; if (animationOffsetIndex >= offsets.Length) { animationOffsetIndex = 0; } } else { num = RandomGenerator.Next(0, offsets.Length); } if (num >= 0 && num < offsets.Length) { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[num]; } else { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[0]; } } private void UpdateLineRenderer() { //IL_0050: 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) int num = segments.Count - startIndex + 1; lineRenderer.positionCount = num; if (num >= 1) { int num2 = 0; lineRenderer.SetPosition(num2++, segments[startIndex].Key); for (int i = startIndex; i < segments.Count; i++) { lineRenderer.SetPosition(num2++, segments[i].Value); } segments.Clear(); SelectOffsetFromAnimationMode(); } } private void Start() { orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic; lineRenderer = ((Component)this).GetComponent<LineRenderer>(); lineRenderer.positionCount = 0; UpdateFromMaterialChange(); } private void Update() { orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic; if (timer <= 0f) { if (ManualMode) { timer = Duration; lineRenderer.positionCount = 0; } else { Trigger(); } } timer -= Time.deltaTime; } public void Trigger() { //IL_0049: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) //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_00a0: 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) timer = Duration + Mathf.Min(0f, timer); Vector3 start = ((!((Object)(object)StartObject == (Object)null)) ? (StartObject.transform.position + StartPosition) : StartPosition); Vector3 end = ((!((Object)(object)EndObject == (Object)null)) ? (EndObject.transform.position + EndPosition) : EndPosition); startIndex = 0; GenerateLightningBolt(start, end, Generations, Generations, 0f); UpdateLineRenderer(); } public void UpdateFromMaterialChange() { //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_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) size = new Vector2(1f / (float)Columns, 1f / (float)Rows); ((Renderer)lineRenderer).material.mainTextureScale = size; offsets = (Vector2[])(object)new Vector2[Rows * Columns]; for (int i = 0; i < Rows; i++) { for (int j = 0; j < Columns; j++) { ref Vector2 reference = ref offsets[j + i * Columns]; reference = new Vector2((float)j / (float)Columns, (float)i / (float)Rows); } } } } } namespace ShermanJumbo { public class LightningBoltOnFire : MonoBehaviour { public FVRFireArm FireArm; public LightningBoltScript LightningBolt; public void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(ShotFired); } public void OnDestroy() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(ShotFired); } private void ShotFired(FVRFireArm firearm) { if ((Object)(object)firearm == (Object)(object)FireArm) { LightningBolt.Trigger(); } } } public class MagazineDeleteIfEmpty : MonoBehaviour { public FVRFireArmMagazine Magazine; private void Update() { if (!((Object)(object)Magazine.FireArm == (Object)null) && !Magazine.HasARound()) { FVRFireArmMagazine magazine = Magazine; Magazine.FireArm.EjectMag(false); Object.Destroy((Object)(object)((Component)magazine).gameObject); } } } } namespace MeatKit { public class HideInNormalInspectorAttribute : PropertyAttribute { } } namespace ShermanJumbo.DBS2_Double_Freedom { [BepInPlugin("ShermanJumbo.DBS2_Double_Freedom", "DBS2_Double_Freedom", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class DBS2_Double_FreedomPlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "ShermanJumbo.DBS2_Double_Freedom"); OtherLoader.RegisterDirectLoad(BasePath, "ShermanJumbo.DBS2_Double_Freedom", "", "", "shermanjumbo_dbs2doublefreedom", ""); } } } namespace ShermanJumbo { public class MinigunExtraBarrelVisual : MonoBehaviour { public Minigun Minigun; public Transform Barrel; private void Update() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) Barrel.localEulerAngles = new Vector3(0f, 0f, Minigun.m_foreRot); } } } public class MinigunMultipleMuzzles : MonoBehaviour { public Minigun Minigun; private int CurrentRoundCount; private int PreviousRoundCount; public Transform[] Muzzles; private int MuzzleIndex; private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown MinigunBox val = (MinigunBox)((FVRFireArm)Minigun).Magazine; if ((Object)(object)val == (Object)null) { return; } CurrentRoundCount = val.NumBulletsLeft; if (CurrentRoundCount < PreviousRoundCount) { MuzzleIndex++; if (MuzzleIndex > Muzzles.Length - 1) { MuzzleIndex = 0; } ((FVRFireArm)Minigun).MuzzlePos = Muzzles[MuzzleIndex]; ((FVRFireArm)Minigun).UpdateCurrentMuzzle(); } PreviousRoundCount = CurrentRoundCount; } } namespace ShermanJumbo { public class OpenBoltFakeChamberDisplay : MonoBehaviour { public OpenBoltReceiver Gun; public OpenBoltReceiverBolt Bolt; public GameObject DisplayRound; private void Update() { //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_0048: Invalid comparison between Unknown and I4 if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null && ((FVRFireArm)Gun).Magazine.HasARound() && (int)Bolt.CurPos != 0 && (int)Bolt.CurPos != 1) { DisplayRound.SetActive(true); } else { DisplayRound.SetActive(false); } } } public class DoubleBarrelClosedBoltWeaponBolt : FVRInteractiveObject { public enum BoltPos { Forward, ForwardToMid, Locked, LockedToRear, Rear } [Header("Bolt")] public DoubleBarreledClosedBoltWeapon Weapon; public float Speed_Forward; public float Speed_Rearward; public float Speed_Held; public float SpringStiffness = 5f; public BoltPos CurPos; public BoltPos LastPos; public Transform Point_Bolt_Forward; public Transform Point_Bolt_LockPoint; public Transform Point_Bolt_Rear; public Transform Point_Bolt_SafetyLock; public bool HasLastRoundBoltHoldOpen = true; public bool UsesAKSafetyLock; public bool DoesClipHoldBoltOpen = true; private float m_curBoltSpeed; private float m_boltZ_current; private float m_boltZ_heldTarget; private float m_boltZ_forward; private float m_boltZ_lock; private float m_boltZ_rear; private float m_boltZ_safetylock; private bool m_isBoltLocked; private bool m_isHandleHeld; private float m_handleLerp; public bool HasBoltCatchReleaseButton; private bool m_isBoltCatchHeldOnHandle; private bool m_isReleaseCatchHeldOnHandle; [Header("Reciprocating Barrel")] public bool HasReciprocatingBarrel; public Transform Barrel; public Vector3 BarrelForward; public Vector3 BarrelRearward; private bool m_isBarrelReciprocating; [Header("Hammer")] public bool HasHammer; public Transform Hammer; public Vector3 HammerForward; public Vector3 HammerRearward; [Header("Rotating Bit")] public bool HasRotatingPart; public Transform RotatingPart; public Vector3 RotatingPartNeutralEulers; public Vector3 RotatingPartLeftEulers; public Vector3 RotatingPartRightEulers; [Header("Z Rot Part")] public bool HasZRotPart; public Transform ZRotPiece; public AnimationCurve ZRotCurve; public Vector2 ZAngles; public bool ZRotPieceDips; public float DipMagnitude; public bool ZRotPieceLags; public float LagMagnitude; [Header("Z Scale Part")] public bool HasZScalePart; public Transform ZScalePiece; public AnimationCurve ZScaleCurve; public override void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //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_007e: 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) ((FVRInteractiveObject)this).Awake(); m_boltZ_current = ((Component)this).transform.localPosition.z; m_boltZ_forward = Point_Bolt_Forward.localPosition.z; m_boltZ_lock = Point_Bolt_LockPoint.localPosition.z; m_boltZ_rear = Point_Bolt_Rear.localPosition.z; if (UsesAKSafetyLock) { m_boltZ_safetylock = Point_Bolt_SafetyLock.localPosition.z; } } public float GetBoltLerpBetweenLockAndFore() { return Mathf.InverseLerp(m_boltZ_lock, m_boltZ_forward, m_boltZ_current); } public float GetBoltLerpBetweenRearAndFore() { return Mathf.InverseLerp(m_boltZ_rear, m_boltZ_forward, m_boltZ_current); } public void LockBolt() { if (!m_isBoltLocked) { m_isBoltLocked = true; } } public void ReleaseBolt() { if (m_isBoltLocked) { if (!((FVRInteractiveObject)this).IsHeld) { ((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)8, 1f); } m_isBoltLocked = false; } } public void SnapToRear() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) CurPos = BoltPos.Rear; m_boltZ_current = m_boltZ_rear; ((Component)this).transform.localPosition = Point_Bolt_Rear.localPosition; } public bool IsBoltLocked() { return m_isBoltLocked; } public override void UpdateInteraction(FVRViveHand hand) { //IL_001a: 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)