using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using FistVR; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("nootarc")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Published under Unlicense license.")] [assembly: AssemblyDescription("Scripts for my H3VR mods. It's like i'm a real modder now!")] [assembly: AssemblyFileVersion("0.2.16.0")] [assembly: AssemblyInformationalVersion("0.2.16+5e428ae74c8c4c1a47e448bcd68f9a88eb68e86a")] [assembly: AssemblyProduct("TerribleScripts")] [assembly: AssemblyTitle("TerribleScripts")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.16.0")] [module: UnverifiableCode] namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace nootarc { [CreateAssetMenu(menuName = "Misc/CalculateBDCC", fileName = "NewBDCCurve")] public class ScaleBDCC : ScriptableObject { public AnimationCurve curve; public AnimationCurve scaledCurve; public float Width = 1f; public float Height = 0.1f; [ContextMenu("Scale Curve")] public void ScaleCurve() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < curve.keys.Length; i++) { Keyframe val = curve.keys[i]; ((Keyframe)(ref val)).value = ((Keyframe)(ref curve.keys[i])).value * Height; ((Keyframe)(ref val)).time = ((Keyframe)(ref curve.keys[i])).time * Width; ((Keyframe)(ref val)).inTangent = ((Keyframe)(ref curve.keys[i])).inTangent * Height / Width; ((Keyframe)(ref val)).outTangent = ((Keyframe)(ref curve.keys[i])).outTangent * Height / Width; scaledCurve.AddKey(val); } } } } namespace nootarc.HCBBoltStuff { public class HCBBoltify : MonoBehaviour { public FVRFireArm FireArm; public FVRFireArmChamber Chamber; private void Hook() { //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(OnShotFired); } private void OnShotFired(FVRFireArm firearm) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)firearm == (Object)(object)FireArm && (Object)(object)((Component)Chamber.GetRound()).GetComponent() != (Object)null) { FVRFireArmRound round = Chamber.GetRound(); RoundHCBBoltType component = ((Component)round).GetComponent(); GameObject roundHCBBolt = component.RoundHCBBolt; GameObject val = Object.Instantiate(roundHCBBolt, firearm.CurrentMuzzle.position, firearm.CurrentMuzzle.rotation); HCBBolt component2 = val.GetComponent(); component2.SetCookedAmount(1f); component2.Fire(firearm.MuzzlePos.forward, firearm.MuzzlePos.position, 1f); } } public void Awake() { Hook(); } } public class RoundHCBBoltType : MonoBehaviour { public GameObject RoundHCBBolt; } public class TrepangExplodeyBolt : MonoBehaviour { public ParticleSystem fuseParticles; public AudioEvent fuseSound; [HideInInspector] public float fuseTime = 3f; public float startFuseTime = 3f; public List ExplosionSpawns; [HideInInspector] public int IFF; [HideInInspector] public float fuseTick; public void StartExplosion() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) fuseTime -= Time.deltaTime; float num = Mathf.Clamp(1f - fuseTime / startFuseTime, 0f, 1f); num = Mathf.Pow(num, 2f); if (fuseTick <= 0f) { fuseTick = Mathf.Lerp(0.3f, 0.01f, num); float num2 = Mathf.Lerp(1.8f, 3.7f, num); SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, fuseSound, ((Component)this).transform.position, new Vector2(1f, 1f), new Vector2(num2, num2)); fuseParticles.Emit(2); } else { fuseTick -= Time.deltaTime; } if (!(fuseTime <= 0f)) { return; } foreach (GameObject explosionSpawn in ExplosionSpawns) { GameObject val = Object.Instantiate(explosionSpawn, ((Component)this).transform.position, Quaternion.identity); Explosion component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.IFF = IFF; } ExplosionSound component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.IFF = IFF; } } Object.Destroy((Object)(object)((Component)this).gameObject); } public void Update() { if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent()) || !((Component)this).gameObject.GetComponent().m_isFlying) { StartExplosion(); } } } } namespace TerribleScripts { [BepInProcess("h3vr.exe")] [BepInPlugin("TerribleScripts", "TerribleScripts", "0.2.16+5e428ae74c8c4c1a47e448bcd68f9a88eb68e86a")] public class TerribleScriptsBase : BaseUnityPlugin { public enum StreamlinedButton { AX, BY } public enum TouchpadVector { up, down, left, right } public const string Id = "TerribleScripts"; public static string Name => "TerribleScripts"; public static string Version => "0.2.16+5e428ae74c8c4c1a47e448bcd68f9a88eb68e86a"; } } namespace TerribleScripts.WeaponModifications { public class AlternatingMuzzle : MonoBehaviour { [Header("Note: Firearm should have the first muzzle in this list as the muzzle position")] [Tooltip("Firearm with all the muzzle shenanigans")] public FVRFireArm FireArm; [Tooltip("Your muzzles. Top-down will dictate the order the muzzles are fired in. Note the header!")] public List Muzzles; [HideInInspector] public int Index; [Header("Closed Bolt Moving Barrel stuff")] [Tooltip("Reciprocating/Moving barrels to do")] public List Barrels; [Tooltip("Forward Positions of the Barrels. Note the order of the list above.")] public List BarrelsForward; [Tooltip("Same as above, Rearward Positions of the Barrels.")] public List BarrelsRearward; [HideInInspector] public bool IsClosedBolt; [HideInInspector] public ClosedBoltWeapon ClosedBolt; [HideInInspector] public bool MovingBarrelsAvailable; public void Hook() { //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(OnShotFired); } public void Awake() { Hook(); if (FireArm is ClosedBoltWeapon) { ref ClosedBoltWeapon closedBolt = ref ClosedBolt; FVRFireArm fireArm = FireArm; closedBolt = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null); IsClosedBolt = true; if (Barrels != null) { MovingBarrelsAvailable = true; } } } public void OnShotFired(FVRFireArm firearm) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)firearm == (Object)(object)FireArm) { FireArm.MuzzlePos = (FireArm.CurrentMuzzle = Muzzles[Index]); if (IsClosedBolt && MovingBarrelsAvailable) { ClosedBolt.Bolt.Barrel = Barrels[Index]; ClosedBolt.Bolt.BarrelForward = BarrelsForward[Index]; ClosedBolt.Bolt.BarrelRearward = BarrelsRearward[Index]; } Index++; if (Index >= Muzzles.Count) { Index = 0; } } } } public class DuplicatedMuzzle : MonoBehaviour { public FVRFireArm FireArm; public void Hook() { //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(OnShotFired); } public void Awake() { Hook(); } public void OnShotFired(FVRFireArm firearm) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)firearm == (Object)(object)FireArm)) { return; } float chamberVelMult = AM.GetChamberVelMult(firearm.FChambers[0].RoundType, Vector3.Distance(((Component)firearm.FChambers[0]).transform.position, firearm.CurrentMuzzle.position)); float num = firearm.GetCombinedFixedDrop(firearm.AccuracyClass) * 0.0166667f; Vector2 val = firearm.GetCombinedFixedDrift(firearm.AccuracyClass) * 0.0166667f; for (int i = 0; i < firearm.FChambers[0].GetRound().NumProjectiles; i++) { float num2 = firearm.FChambers[0].GetRound().ProjectileSpread + firearm.m_internalMechanicalMOA + firearm.GetCombinedMuzzleDeviceAccuracy(); if ((Object)(object)firearm.FChambers[0].GetRound().BallisticProjectilePrefab != (Object)null) { Vector3 val2 = ((Component)this).transform.forward * 0.005f; GameObject val3 = Object.Instantiate(firearm.FChambers[0].GetRound().BallisticProjectilePrefab, ((Component)this).transform.position - val2, ((Component)this).transform.rotation); Vector2 val4 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num2; val3.transform.Rotate(new Vector3(val4.x + val.y + num, val4.y + val.x, 0f)); BallisticProjectile component = val3.GetComponent(); component.Fire(component.MuzzleVelocityBase * firearm.FChambers[0].ChamberVelocityMultiplier * 1f * chamberVelMult, val3.transform.forward, firearm, true); } } } } public class EjectMagOnEmpty : MonoBehaviour { [Tooltip("Firearm :)")] public FVRFireArm FireArm; [HideInInspector] public float CurrentAmount; [HideInInspector] public int LoadedChambers; [HideInInspector] public bool MagIn; private void Update() { for (int i = 0; i < FireArm.FChambers.Count; i++) { if (FireArm.FChambers[i].IsFull) { LoadedChambers++; } } if ((Object)(object)FireArm.Magazine != (Object)null) { CurrentAmount = FireArm.Magazine.m_numRounds + LoadedChambers; MagIn = true; } if (MagIn && CurrentAmount <= 0f) { FireArm.EjectMag(false); } LoadedChambers = 0; } } public class FakeMinigunSounds : MonoBehaviour { } public class ReplenishFirearmMagazineAutomagically : MonoBehaviour { [Header("NOTE: This script is used with firearms, not magazines!")] [Tooltip("The round class that should be replenished by default if the gun spawns empty")] public FireArmRoundClass FallbackRoundClass = (FireArmRoundClass)1; public FVRFireArm firearm; [Tooltip("Makes the magazine only replenish when the firearm is being held and the AX button is being pressed. If false, firearm replenishes when *not* held, and stops when held. ")] public bool HoldToReplenish; [Tooltip("*Only functions when HoldToReplenish is false* Clicking the AX button toggles the replenish-when-not-held feature on and off.")] public bool ToggleToReplenish; [Tooltip("Should the trigger make the firearm stop replenishing")] public bool TriggerBlocksReplenish; [Header("Delays")] [Tooltip("Delay in seconds between loading rounds at the fastest")] public float minReplenishRate = 0.066f; [Tooltip("Delay in seconds between loading rounds at the slowest")] public float maxReplenishRate = 5f; [Tooltip("Smaller the number, the longer the delay, and vice versa. 0 to bypass lerp and replenish at max, 1 to replenish at min")] public float lerpFactor = 0.5f; [Header("Audio")] [Tooltip("Makes the mag insert round sound every time a round is replenished")] public bool IndividualRoundSound; [Tooltip("OPTIONAL: audio source w/ clip that will play when the gun is replenishing, e.g. if you want to have a quiet loop instead of CLICK CLICK CLICK CLICK CLICK")] public AudioSource replenishAudioSource; [HideInInspector] public bool isReplenishing; [HideInInspector] public float replenishTimer; [HideInInspector] public FireArmRoundClass RoundClass; [HideInInspector] public FVRViveHand hand; public void Awake() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) RoundClass = FallbackRoundClass; } public void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)firearm.FChambers[0].GetRound() != (Object)null && RoundClass != firearm.FChambers[0].GetRound().RoundClass) { RoundClass = firearm.FChambers[0].GetRound().RoundClass; } if (isReplenishing && replenishTimer > 0f) { replenishTimer -= Time.deltaTime; } else if (isReplenishing && replenishTimer <= 0f) { firearm.Magazine.AddRound(RoundClass, IndividualRoundSound, false); replenishTimer = Mathf.Lerp(replenishTimer, minReplenishRate, lerpFactor); } if ((Object)(object)replenishAudioSource != (Object)null) { if (isReplenishing && !replenishAudioSource.isPlaying) { replenishAudioSource.Play(); } else { replenishAudioSource.Stop(); } } if (HoldToReplenish) { isReplenishing = false; } if ((Object)(object)((FVRInteractiveObject)firearm).m_hand == (Object)null && (HoldToReplenish || ToggleToReplenish)) { return; } if (HoldToReplenish) { hand = ((FVRInteractiveObject)firearm).m_hand; if ((TriggerBlocksReplenish && (double)hand.Input.TriggerFloat < 0.1) || !TriggerBlocksReplenish) { if (hand.Input.AXButtonDown) { isReplenishing = true; } else if (hand.Input.AXButtonUp) { isReplenishing = false; } } else { isReplenishing = false; } } else if (ToggleToReplenish) { hand = ((FVRInteractiveObject)firearm).m_hand; if (hand.Input.AXButtonDown) { isReplenishing = !isReplenishing; } } else { isReplenishing = !((FVRInteractiveObject)firearm).IsHeld; } } } public class SparksAndHeat : MonoBehaviour { [Header("99.5% chance you don't need this script. If you hit the 0.5%, I'm so sorry. At least you can just pick one effect")] [Tooltip("Firearm with all the effects")] public FVRFireArm FireArm; [Tooltip("Round Class that will enable all the effects")] public FireArmRoundClass RoundClass; [Tooltip("Particle System that will enable and disable on Round Class loaded")] public ParticleSystem Particles; [Tooltip("Audio Source that will play and stop")] public AudioSource Audio; [Tooltip("Mesh to modify the Emissions Weight of (Kinda like Object Temperature without the Object Temperature)")] public MeshRenderer Mesh; [Tooltip("Emissions Weight when the Round Class is Loaded")] public float LoadedWeight = 1f; [Tooltip("Vice versa as above")] public float UnloadedWeight; [Tooltip("Spinny Bit")] public GameObject Spinny; public float RotPerFrame; [HideInInspector] public float RotZ; [HideInInspector] public int EmissionWeight; [HideInInspector] public bool JustPlayed; [HideInInspector] public bool MeshAvailable; [HideInInspector] public bool AudioAvailable; [HideInInspector] public bool ParticlesAvailable; [HideInInspector] public bool SpinnyAvailable; public void Awake() { EmissionWeight = Shader.PropertyToID("_EmissionWeight"); if ((Object)(object)Mesh != (Object)null) { MeshAvailable = true; } if ((Object)(object)Audio != (Object)null) { AudioAvailable = true; } if ((Object)(object)Particles != (Object)null) { ParticlesAvailable = true; } if ((Object)(object)Spinny != (Object)null) { SpinnyAvailable = true; } } public void Update() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0040: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) MaterialPropertyBlock val = new MaterialPropertyBlock(); if ((Object)(object)FireArm.Magazine != (Object)null && FireArm.Magazine.LoadedRounds[0] != null && FireArm.Magazine.LoadedRounds[0].LR_Class == RoundClass) { if (SpinnyAvailable) { Spinny.transform.Rotate(0f, 0f, RotPerFrame); } if (!JustPlayed) { val.SetFloat(EmissionWeight, LoadedWeight); if (MeshAvailable) { ((Renderer)Mesh).SetPropertyBlock(val); } if (ParticlesAvailable) { Particles.Play(); } if (AudioAvailable) { Audio.Play(); } JustPlayed = true; } } else if (((Object)(object)FireArm.Magazine == (Object)null || FireArm.Magazine.m_numRounds == 0 || FireArm.Magazine.LoadedRounds[0].LR_Class != RoundClass || (Object)(object)((FVRInteractiveObject)FireArm).m_hand == (Object)null) && JustPlayed) { val.SetFloat(EmissionWeight, UnloadedWeight); if (MeshAvailable) { ((Renderer)Mesh).SetPropertyBlock(val); } if (ParticlesAvailable) { Particles.Stop(); } if (AudioAvailable) { Audio.Stop(); } JustPlayed = false; } } } public class ToggleOnGrabRelease : MonoBehaviour { [Tooltip("Object that you pick up/release")] public FVRPhysicalObject Parent; [Tooltip("When true, enables objects when parent is held and disables them when not held; Reverse when false")] public bool Enable; [Tooltip("Objects to toggle")] public List Objects; [HideInInspector] public bool Held; public void Hook() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.ObjectPickedUpEvent += new FVRObjectPickedUp(ObjectPickedUp); } public void Awake() { Hook(); } public void ObjectPickedUp(FVRPhysicalObject ParentObject) { if ((Object)(object)ParentObject == (Object)(object)Parent) { for (int i = 0; i < Objects.Count; i++) { Objects[i].SetActive(Enable); Held = true; } } } private void Update() { if (Held && !((FVRInteractiveObject)Parent).m_isHeld) { for (int i = 0; i < Objects.Count; i++) { Objects[i].SetActive(!Enable); } Held = false; } } } } namespace TerribleScripts.ModMods { public class AmmoCountUIColorShenanigans : MonoBehaviour { [Header("Note: There should be one gradient per object with them having")] [Header("the same positions (topmost object will use the topmost gradient, for example)")] [Tooltip("Graphics to recolor")] public List Graphics; [Tooltip("Lasers & Lights to recolor (Uses gradients that come immediately after the graphics ones)")] public List LaserLights; [Tooltip("Line Renderers to recolor the Emissions tint of (uses gradients that come immediately after the Laser Light ones")] public List Lines; [Tooltip("Gradients to recolor the graphics with; key position is the fullness factor (e.g 0.2f is 20% capacity remaining)")] public List Gradients; [Tooltip("Firearm :)")] public FVRFireArm FireArm; [Tooltip("Does your firearm have/uses magazines or is it direct chamber-loaded?")] public bool UsesMags; [HideInInspector] public int MaxCap; [HideInInspector] public float CurrentAmount; [HideInInspector] public int LoadedChambers; [HideInInspector] public float CurrentPercentage; [HideInInspector] public Color UIColor; [HideInInspector] public bool LaserLightsAvailable; [HideInInspector] public bool LinesAvailable; [HideInInspector] public bool GraphicsAvailable; [HideInInspector] public int EmissionColor; public void Awake() { if (LaserLights.Count > 0) { LaserLightsAvailable = true; } if (Lines.Count > 0) { LinesAvailable = true; } if (Graphics.Count > 0) { GraphicsAvailable = true; } EmissionColor = Shader.PropertyToID("_EmissionColor"); } public void Update() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < FireArm.FChambers.Count; i++) { if (FireArm.FChambers[i].IsFull) { LoadedChambers++; } } if ((Object)(object)FireArm.Magazine != (Object)null) { MaxCap = FireArm.Magazine.m_capacity; CurrentAmount = FireArm.Magazine.m_numRounds; } else { MaxCap = ((!UsesMags) ? 1 : FireArm.FChambers.Count); CurrentAmount = LoadedChambers; } float num = CurrentAmount / (float)MaxCap; CurrentPercentage = Mathf.Clamp01(num); int num2 = 0; if (GraphicsAvailable) { int num3 = 0; while (num3 < Graphics.Count) { UIColor = Gradients[num2].Evaluate(CurrentPercentage); Graphics[num3].color = UIColor; num3++; num2++; } } if (LaserLightsAvailable) { int num4 = 0; while (num4 < LaserLights.Count) { UIColor = Gradients[num2].Evaluate(CurrentPercentage); LaserLights[num4].color = UIColor; num4++; num2++; } } if (LinesAvailable) { int num5 = 0; while (num5 < Lines.Count) { MaterialPropertyBlock val = new MaterialPropertyBlock(); UIColor = Gradients[num2].Evaluate(CurrentPercentage); val.SetColor(EmissionColor, UIColor); ((Renderer)Lines[num5]).SetPropertyBlock(val); num5++; num2++; } } LoadedChambers = 0; } } public class DropCompUpdateButton : FVRInteractiveObject { public TerribleDropComp DropComp; public override void SimpleInteraction(FVRViveHand hand) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position); DropComp.UpdateData(); } } public class RotateUIToMagnification : MonoBehaviour { public MaskableGraphic Display; public PIPScopeController ScopeController; public AnimationCurve MagnificationCurve; public bool ColorParity; public List WhatToColor; private Material MatInstance; private int ColorProperty; public void Awake() { ColorProperty = Shader.PropertyToID("_Color"); MatInstance = Object.Instantiate(((Graphic)Display).material); foreach (MaskableGraphic item in WhatToColor) { ((Graphic)item).material = MatInstance; } } public void Update() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (ColorParity) { MatInstance.SetColor(ColorProperty, ScopeController.PScope.reticleIllumination); } Vector3 eulerAngles = ((Component)Display).transform.eulerAngles; eulerAngles.z = 0f - MagnificationCurve.Evaluate(ScopeController.PScope.currentMagnification); ((Component)Display).transform.rotation = Quaternion.Euler(eulerAngles); } public void OnDestroy() { Object.Destroy((Object)(object)MatInstance); } } public class TerribleDropComp : MonoBehaviour { [Header("NOTE: Put this on dedicated GameObject anywhere in hierarchy")] [Tooltip("Your PIPScopeController.")] public PIPScopeController ScopeController; [Tooltip("Max count of simulated frames. 90 = 1s.")] public int CalcFrames = 900; [Tooltip("Artificial distance limit for drop compensation.")] public float MaxDistance = 999f; [Header("OPTIONAL BIT")] [Tooltip("Text object that displays the distance between the approximate hit point and the muzzle. 1 metre precision. If you need any other precision or style of output feel free to bug me about it")] public Text DistanceDisplay; [Tooltip("String that will display after the numerical output.")] public string Suffix = "m"; [Tooltip("String that will display if the calculated distance is over the MaxDisplayDistance")] public string MaxDistanceString = "---m"; [Tooltip("Flag this if you want your DistanceDisplay to have the same color as the current reticle color.")] public bool TextColorParity; [Tooltip("Updates data automtaically with every frame, no button needed. EXTREMELY EXPENSIVE!")] public bool AutoUpdate; private FVRFireArm Firearm; private BallisticProjectile Projectile; private Vector3 Velocity; private Vector3 Dimensions; private Material MatInstance; private int Color; private LayerMask LM; private float LastDistance = 100f; private bool DDAvailable; private bool DataAvailable; private float Timer; private float Mass; private float Density; private float MuzzleVel; private float Gravity; private float VelocityMultiplier; private float GravityMultiplier; private FVRFireArmChamber StaleChamber; public void UpdateData() { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected I4, but got Unknown if ((Object)(object)((FVRFireArmAttachmentInterface)ScopeController).Attachment != (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)ScopeController).Attachment.curMount != (Object)null && ((FVRFireArmAttachmentInterface)ScopeController).Attachment.curMount.Parent is FVRFireArm) { ref FVRFireArm firearm = ref Firearm; FVRPhysicalObject parent = ((FVRFireArmAttachmentInterface)ScopeController).Attachment.curMount.Parent; firearm = (FVRFireArm)(object)((parent is FVRFireArm) ? parent : null); } if ((Object)(object)Firearm == (Object)null) { DataAvailable = false; return; } FVRFireArmChamber val = (StaleChamber = Firearm.GetChambers()[0]); FVRFireArmMagazine magazine = Firearm.Magazine; FVRFireArmRound val2; if ((Object)(object)val != (Object)null && (Object)(object)val.GetRound() == (Object)null) { if (!((Object)(object)magazine != (Object)null) || magazine.LoadedRounds[magazine.m_numRounds - 1] == null) { DataAvailable = false; return; } val2 = ((AnvilAsset)magazine.LoadedRounds[magazine.m_numRounds - 1].LR_ObjectWrapper).GetGameObject().GetComponent(); } else { val2 = val.GetRound(); } LM = AM.PLM; Projectile = val2.BallisticProjectilePrefab.GetComponent(); MuzzleVel = Projectile.MuzzleVelocityBase * val.ChamberVelocityMultiplier * AM.GetChamberVelMult(val.RoundType, Vector3.Distance(((Component)val).transform.position, Firearm.MuzzlePos.position)); Mass = Projectile.Mass; Dimensions = Projectile.Dimensions; Density = 1.225f * Projectile.AirDragMultiplier; VelocityMultiplier = Projectile.FlightVelocityMultiplier; GravityMultiplier = Projectile.GravityMultiplier; GravityMode ballisticGravityMode = GM.Options.SimulationOptions.BallisticGravityMode; GravityMode val3 = ballisticGravityMode; switch ((int)val3) { case 0: Gravity = 9.81f; break; case 1: Gravity = 5f; break; case 2: Gravity = 1.622f; break; case 3: Gravity = 0f; break; } DataAvailable = true; } private void Awake() { MatInstance = Object.Instantiate(((Graphic)DistanceDisplay).material); Color = Shader.PropertyToID("_Color"); ((Graphic)DistanceDisplay).material = MatInstance; if ((Object)(object)DistanceDisplay != (Object)null) { DDAvailable = true; } } private void Update() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (AutoUpdate) { FVRFireArmChamber val = Firearm.GetChambers()[0]; if ((Object)(object)val.GetRound() != (Object)(object)StaleChamber.GetRound() && (Object)(object)val.GetRound() != (Object)null) { UpdateData(); } } if (TextColorParity) { Color reticleIllumination = ScopeController.PScope.reticleIllumination; MatInstance.SetColor(Color, reticleIllumination); } } private void FixedUpdate() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected I4, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected I4, but got Unknown //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Firearm == (Object)null) { DataAvailable = false; } if (!DataAvailable) { return; } ((Component)this).transform.position = ((Component)Firearm.MuzzlePos).transform.position; Vector3 val = ((Component)this).transform.position; Velocity = ((Component)Firearm.MuzzlePos).transform.forward * MuzzleVel; RaycastHit val2 = default(RaycastHit); for (int i = 0; i <= CalcFrames; i++) { Velocity += Vector3.down * (Gravity * Time.deltaTime * GravityMultiplier); Velocity = ApplyDrag(Velocity, Density, Time.deltaTime); val += Velocity * (Time.deltaTime * VelocityMultiplier); if (Physics.Linecast(((Component)this).transform.position, val, ref val2, LayerMask.op_Implicit(LM))) { ((Component)this).transform.position = ((RaycastHit)(ref val2)).point; Timer = 0f; float num = (LastDistance = Vector3.Distance(((Component)Firearm.MuzzlePos).transform.position, ((RaycastHit)(ref val2)).point)); if (num >= MaxDistance) { break; } Timer = 0f; if (DDAvailable) { DistanceDisplay.text = $"{num:F0}{Suffix}"; } Vector2 val3 = ScopeController.PScope.ZeroToWorldPoint(((RaycastHit)(ref val2)).point, false); float num2 = (float)ScopeController.ReticleElevationMagnitude * ScopeController.ReticleElevationAdjustmentPerTick; float num3 = (float)ScopeController.ReticleWindageMagnitude * ScopeController.ReticleWindageAdjustmentPerTick; PipScopeZeroScaling zeroScaling = ScopeController.ZeroScaling; PipScopeZeroScaling val4 = zeroScaling; switch (val4 - 1) { case 0: num2 *= 1f / 60f; break; case 1: num2 *= 9f / 160f; break; case 2: num2 *= 0.05729578f; break; } PipScopeZeroScaling zeroScaling2 = ScopeController.ZeroScaling; PipScopeZeroScaling val5 = zeroScaling2; switch (val5 - 1) { case 0: num3 *= 1f / 60f; break; case 1: num3 *= 9f / 160f; break; case 2: num3 *= 0.05729578f; break; } ScopeController.PScope.reticleAdjustmentDegrees = new Vector2(val3.x + num3, val3.y + num2); return; } ((Component)this).transform.position = val; } if (DDAvailable) { DistanceDisplay.text = LerpMaxDistance() ?? ""; } ScopeController.FixedBaseZero = 100f; ScopeController.UpdateScopeParams(); } private string LerpMaxDistance() { Timer += Time.deltaTime; if (Timer < 1f) { return $"{Mathf.Lerp(LastDistance, MaxDistance, Timer):F0}{Suffix}"; } Timer = 1f; return MaxDistanceString; } private void OnDestroy() { Object.Destroy((Object)(object)MatInstance); } private float GetCurrentDragCoefficient(float velocityMS) { return AM.BDCC.Evaluate(velocityMS * 0.00291545f); } private Vector3 ApplyDrag(Vector3 hvelocity, float materialDensity, float time) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) float num = (float)Math.PI * Mathf.Pow(Dimensions.x * 0.5f, 2f); float magnitude = ((Vector3)(ref hvelocity)).magnitude; Vector3 normalized = ((Vector3)(ref hvelocity)).normalized; float currentDragCoefficient = GetCurrentDragCoefficient(((Vector3)(ref hvelocity)).magnitude); Vector3 val = -hvelocity * (materialDensity * 0.5f * currentDragCoefficient * num / Mass * magnitude); return normalized * Mathf.Clamp(magnitude - ((Vector3)(ref val)).magnitude * time, 0f, magnitude); } } public class TerribleRangefinder : MonoBehaviour { [Tooltip("Maximum value the rangefinder can calculate. Everything larger will use Inf String.")] public float MaxDisplayDistance; [Tooltip("Text that comes after the rangefinder output w/o leading space (you have to put it yourself).")] public string Suffix; [Tooltip("What the output will show if the distance is larger than the MaxValue. Does not include the Units text.")] public string MaxDistanceString; [Tooltip("Amount of decimal points.")] [Range(0f, 10f)] public int Precision; [Tooltip("What the raycast will be able to hit (and calculate distance off of).")] public LayerMask LayerMask; [Tooltip("Your Text Object.")] public Text DistanceDisplay; [Tooltip("Point from which rangefinding calculations happen.")] public Transform RangefinderPos; [Tooltip("OPTIONAL: PIPScope controller for color parity & rangefinding at the muzzle.")] public PIPScopeController ScopeController; [Tooltip("If PIPScope Controller is enabled, would you like to use the reticle's color as the Text color?")] public bool UseReticleColor; [Tooltip("If Scope Controller is set, would u like to use the mounted firearm's muzzle as the Rangefinder Pos?")] public bool UseMuzzlePos; [HideInInspector] public FVRFireArm Firearm; [HideInInspector] public int ColorProperty; [HideInInspector] public Material MatInstance; [HideInInspector] public bool ScopeAvailable; [HideInInspector] public float Distance; [HideInInspector] public float Timer; [HideInInspector] public Transform FallbackPos; public void Awake() { if ((Object)(object)ScopeController != (Object)null) { ScopeAvailable = true; } ColorProperty = Shader.PropertyToID("_Color"); MatInstance = Object.Instantiate(((Graphic)DistanceDisplay).material); ((Graphic)DistanceDisplay).material = MatInstance; FallbackPos = RangefinderPos; } public void OnDestroy() { Object.Destroy((Object)(object)MatInstance); } public void Update() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) if (!ScopeAvailable) { return; } if ((Object)(object)((FVRFireArmAttachmentInterface)ScopeController).Attachment != (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)ScopeController).Attachment.curMount != (Object)null && ((FVRFireArmAttachmentInterface)ScopeController).Attachment.curMount.Parent is FVRFireArm) { ref FVRFireArm firearm = ref Firearm; FVRPhysicalObject parent = ((FVRFireArmAttachmentInterface)ScopeController).Attachment.curMount.Parent; firearm = (FVRFireArm)(object)((parent is FVRFireArm) ? parent : null); } if (!UseMuzzlePos || (Object)(object)Firearm == (Object)null) { RangefinderPos = FallbackPos; return; } RangefinderPos.position = Firearm.MuzzlePos.position; RangefinderPos.rotation = Firearm.MuzzlePos.rotation; if (UseReticleColor) { MatInstance.SetColor(ColorProperty, ScopeController.PScope.reticleIllumination); } } public void FixedUpdate() { //IL_0007: 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_0020: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(RangefinderPos.position, RangefinderPos.forward, ref val, MaxDisplayDistance, LayerMask.op_Implicit(LayerMask))) { Distance = ((RaycastHit)(ref val)).distance; DistanceDisplay.text = Distance.ToString($"F{Precision}") + Suffix; Timer = 0f; } else { Timer += Time.fixedDeltaTime; Timer = Mathf.Clamp01(Timer); float num = Mathf.Lerp(Distance, MaxDisplayDistance + 1f, Timer); DistanceDisplay.text = ((num < MaxDisplayDistance) ? (num.ToString($"F{Precision}") + Suffix) : (MaxDistanceString ?? "")); } } } } namespace TerribleScripts.TerribleScripts.GunMods { public class PipeShotgun : FVRFireArm { } } namespace TerribleScripts.GunMods { public class LinearRevolver : FVRFireArm { } } namespace TerribleScripts.Animations { public class AnimPlayOnButtonPress : MonoBehaviour { [Tooltip("Put your animations in a sequential list; they will play on every press and loop back around to first position")] public List Animations; [Tooltip("Animation controller thingy on your object")] public Animation Animation; [Tooltip("Object you're pressing the buttons on")] public FVRInteractiveObject Object; [Tooltip("Whether the animation should reset on every button press. Leave true if using with fire selectors/other things")] public bool Reset = true; [Tooltip("Should the animation play a FireSelector sound when it starts?")] public bool PlaySound; [Tooltip("Which streamlined button should the animation play on?")] public TerribleScriptsBase.StreamlinedButton EnumButton = TerribleScriptsBase.StreamlinedButton.AX; [Tooltip("Which classic touchpad side should the animation play on?")] public TerribleScriptsBase.TouchpadVector EnumVector = TerribleScriptsBase.TouchpadVector.left; private int i; private FVRFireArm Firearm; private bool Button; private Vector2 Vector; public void Awake() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (Object is FVRFireArm) { ref FVRFireArm firearm = ref Firearm; FVRInteractiveObject obj = Object; firearm = (FVRFireArm)(object)((obj is FVRFireArm) ? obj : null); } switch (EnumVector) { case TerribleScriptsBase.TouchpadVector.up: Vector = Vector2.up; break; case TerribleScriptsBase.TouchpadVector.down: Vector = Vector2.down; break; case TerribleScriptsBase.TouchpadVector.left: Vector = Vector2.left; break; case TerribleScriptsBase.TouchpadVector.right: Vector = Vector2.right; break; } } public void PlayAnimation() { for (int i = 0; i < Animations.Count; i++) { if (!Reset && Animation.IsPlaying(Animations[i])) { return; } } Animation.Play(Animations[this.i]); this.i++; if (PlaySound && Object is FVRFireArm) { Firearm.PlayAudioEvent((FirearmAudioEventType)15, 1f); } if (this.i >= Animations.Count) { this.i = 0; } } public void Update() { //IL_007b: 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) if (!((Object)(object)Object.m_hand != (Object)null)) { return; } if (!Object.m_hand.IsInStreamlinedMode) { if (Object.m_hand.Input.TouchpadDown && ((Vector2)(ref Object.m_hand.Input.TouchpadAxes)).magnitude > 0.1f && Vector2.Angle(Object.m_hand.Input.TouchpadAxes, Vector) <= 45f) { PlayAnimation(); } return; } Button = ((EnumButton == TerribleScriptsBase.StreamlinedButton.AX) ? Object.m_hand.Input.AXButtonDown : Object.m_hand.Input.BYButtonDown); if (Button) { PlayAnimation(); } } } public class AnimPlayOnFire : MonoBehaviour { [Header("NOTE: i forgot the note that i was supposed to put here")] [Tooltip("Firearm to apply animations to")] public FVRFireArm Firearm; [Tooltip("Animation script thing with all the animations (should be applied to the object)")] public Animation Animation; [Tooltip("Animation to play on shot fired")] public string FireAnim; [Tooltip("True: Animation should reset on another shot during the already-playing animation runtime. Continues to play on false")] public bool Reset; public void Hook() { //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(OnShotFired); } public void Awake() { Hook(); } public void OnShotFired(FVRFireArm firearm) { if ((Object)(object)firearm == (Object)(object)Firearm && (Reset || !Animation.IsPlaying(FireAnim))) { Animation.Play(FireAnim); } } } public class AnimPlayOnMagInsertEject : MonoBehaviour { [Tooltip("yo ur firearm rr")] public FVRFireArm Firearm; [Tooltip(" the animation thing controller thing that go into the. firearm")] public Animation Animation; [Tooltip("Animation that plays when the magazine is inserted.")] public string InsertAnim; [Tooltip("animnaitnon that plays twhen the mag is eject ted")] public string EjectAnim; private bool MagIn; public void Update() { if (!MagIn && (Object)(object)Firearm.Magazine != (Object)null) { MagIn = true; Animation.Play(InsertAnim); } else if (MagIn && (Object)(object)Firearm.Magazine == (Object)null) { MagIn = false; Animation.Play(EjectAnim); } } } }