// Token: 0x06000BB7 RID: 2999 RVA: 0x00032F0C File Offset: 0x0003110C
        private void FixedUpdate()
        {
            if (!NetworkServer.active)
            {
                return;
            }
            if (!this.owner)
            {
                UnityEngine.Object.Destroy(base.gameObject);
                return;
            }
            InputBankTest component = this.owner.GetComponent <InputBankTest>();
            Vector3       vector    = component ? component.aimDirection : base.transform.forward;

            if (this.target)
            {
                vector = (this.target.transform.position - base.transform.position).normalized;
            }
            base.transform.forward = Vector3.RotateTowards(base.transform.forward, vector, 0.017453292f * this.turnSpeed * Time.fixedDeltaTime, 0f);
            Vector3 vector2 = this.owner.transform.position + base.transform.rotation * this.localOffset;

            base.transform.position = Vector3.SmoothDamp(base.transform.position, vector2, ref this.velocity, this.positionSmoothTime, float.PositiveInfinity, Time.fixedDeltaTime);
            this.fireTimer         -= Time.fixedDeltaTime;
            this.timeoutTimer      -= Time.fixedDeltaTime;
            if (this.fireTimer <= 0f)
            {
                this.target    = this.FindTarget();
                this.fireTimer = this.interval;
            }
            if (this.target && this.WillHit(this.target))
            {
                Vector3 normalized = (this.target.transform.position - base.transform.position).normalized;
                this.Fire(base.transform.position, normalized);
                this.ammo--;
                this.target       = null;
                this.timeoutTimer = this.timeout;
            }
            if (this.ammo <= 0 || this.timeoutTimer <= 0f)
            {
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
Exemple #2
0
        // Token: 0x06000EBA RID: 3770 RVA: 0x0004190C File Offset: 0x0003FB0C
        private void ScheduleIntensityCalculation(GameObject targetBodyObject)
        {
            if (!targetBodyObject)
            {
                return;
            }
            ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(TeamIndex.Monster);
            int count = teamMembers.Count;

            this.EnsureEnemyBufferSize(count);
            int num  = 0;
            int i    = 0;
            int num2 = count;

            while (i < num2)
            {
                TeamComponent teamComponent = teamMembers[i];
                InputBankTest component     = teamComponent.GetComponent <InputBankTest>();
                CharacterBody component2    = teamComponent.GetComponent <CharacterBody>();
                if (component)
                {
                    this.enemyInfoBuffer[num++] = new MusicController.EnemyInfo
                    {
                        aimRay      = new Ray(component.aimOrigin, component.aimDirection),
                        threatScore = (component2.master ? component2.GetNormalizedThreatValue() : 0f)
                    };
                }
                i++;
            }
            this.calculateIntensityJob = new MusicController.CalculateIntensityJob
            {
                enemyInfoBuffer = this.enemyInfoBuffer,
                elementCount    = num,
                targetPosition  = targetBodyObject.transform.position,
                nearDistance    = 20f,
                farDistance     = 75f
            };
            this.calculateIntensityJobHandle = this.calculateIntensityJob.Schedule(num, 32, default(JobHandle));
        }
        // Token: 0x06000BF4 RID: 3060 RVA: 0x0003A450 File Offset: 0x00038650
        private void Update()
        {
            if (Time.deltaTime == 0f)
            {
                return;
            }
            if (this.target != this.previousTarget)
            {
                this.previousTarget = this.target;
                Action <CameraRigController, GameObject> action = CameraRigController.onCameraTargetChanged;
                if (action != null)
                {
                    action(this, this.target);
                }
            }
            this.lerpCameraTime   += Time.deltaTime * this.lerpCameraTimeScale;
            this.firstPersonTarget = null;
            float num = this.baseFov;

            this.sceneCam.rect = this.viewport;
            Player      player      = null;
            UserProfile userProfile = null;
            bool        flag        = false;

            if (this.viewer && this.viewer.localUser != null)
            {
                player      = this.viewer.localUser.inputPlayer;
                userProfile = this.viewer.localUser.userProfile;
                flag        = this.viewer.localUser.isUIFocused;
            }
            if (this.cameraMode == CameraRigController.CameraMode.SpectateUser && player != null)
            {
                if (player.GetButtonDown("PrimarySkill"))
                {
                    this.target = CameraRigController.GetNextSpectateGameObject(this.viewer, this.target);
                }
                if (player.GetButtonDown("SecondarySkill"))
                {
                    this.target = CameraRigController.GetPreviousSpectateGameObject(this.viewer, this.target);
                }
            }
            LocalUser     localUserViewer = this.localUserViewer;
            MPEventSystem mpeventSystem   = (localUserViewer != null) ? localUserViewer.eventSystem : null;
            float         num14;
            float         num15;

            if ((!mpeventSystem || !mpeventSystem.isCursorVisible) && player != null && userProfile != null && !flag && this.overrideCam == null)
            {
                float   mouseLookSensitivity = userProfile.mouseLookSensitivity;
                float   num2 = userProfile.stickLookSensitivity * CameraRigController.aimStickGlobalScale.value * 45f;
                Vector2 vector = new Vector2(player.GetAxisRaw(2), player.GetAxisRaw(3));
                Vector2 vector2 = new Vector2(player.GetAxisRaw(16), player.GetAxisRaw(17));
                CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector.x, userProfile.mouseLookInvertX);
                CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector.y, userProfile.mouseLookInvertY);
                CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector2.x, userProfile.stickLookInvertX);
                CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector2.y, userProfile.stickLookInvertY);
                float magnitude = vector2.magnitude;
                float num3      = magnitude;
                this.aimStickPostSmoothing = Vector2.zero;
                this.aimStickPostDualZone  = Vector2.zero;
                this.aimStickPostExponent  = Vector2.zero;
                if (CameraRigController.aimStickDualZoneSmoothing.value != 0f)
                {
                    float maxDelta = Time.deltaTime / CameraRigController.aimStickDualZoneSmoothing.value;
                    num3 = Mathf.Min(Mathf.MoveTowards(this.stickAimPreviousAcceleratedMagnitude, magnitude, maxDelta), magnitude);
                    this.stickAimPreviousAcceleratedMagnitude = num3;
                    this.aimStickPostSmoothing = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero);
                }
                float num4  = num3;
                float value = CameraRigController.aimStickDualZoneSlope.value;
                float num5;
                if (num4 <= CameraRigController.aimStickDualZoneThreshold.value)
                {
                    num5 = 0f;
                }
                else
                {
                    num5 = 1f - value;
                }
                num3 = value * num4 + num5;
                this.aimStickPostDualZone = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero);
                num3 = Mathf.Pow(num3, CameraRigController.aimStickExponent.value);
                this.aimStickPostExponent = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero);
                if (magnitude != 0f)
                {
                    vector2 *= num3 / magnitude;
                }
                if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic && this.targetBody && !this.targetBody.isSprinting)
                {
                    AimAssistTarget exists     = null;
                    AimAssistTarget exists2    = null;
                    float           value2     = CameraRigController.aimStickAssistMinSize.value;
                    float           num6       = value2 * CameraRigController.aimStickAssistMaxSize.value;
                    float           value3     = CameraRigController.aimStickAssistMaxSlowdownScale.value;
                    float           value4     = CameraRigController.aimStickAssistMinSlowdownScale.value;
                    float           num7       = 0f;
                    float           value5     = 0f;
                    float           num8       = 0f;
                    Vector2         v          = Vector2.zero;
                    Vector2         zero       = Vector2.zero;
                    Vector2         normalized = vector2.normalized;
                    Vector2         vector3    = new Vector2(0.5f, 0.5f);
                    for (int i = 0; i < AimAssistTarget.instancesList.Count; i++)
                    {
                        AimAssistTarget aimAssistTarget = AimAssistTarget.instancesList[i];
                        if (aimAssistTarget.teamComponent.teamIndex != this.targetTeamIndex)
                        {
                            Vector3 vector4 = this.sceneCam.WorldToViewportPoint(aimAssistTarget.point0.position);
                            Vector3 vector5 = this.sceneCam.WorldToViewportPoint(aimAssistTarget.point1.position);
                            float   num9    = Mathf.Lerp(vector4.z, vector5.z, 0.5f);
                            if (num9 > 3f)
                            {
                                float   num10   = 1f / num9;
                                Vector2 vector6 = Util.ClosestPointOnLine(vector4, vector5, vector3) - vector3;
                                float   num11   = Mathf.Clamp01(Util.Remap(vector6.magnitude, value2 * aimAssistTarget.assistScale * num10, num6 * aimAssistTarget.assistScale * num10, 1f, 0f));
                                float   num12   = Mathf.Clamp01(Vector3.Dot(vector6, vector2.normalized));
                                float   num13   = num12 * num11;
                                if (num7 < num11)
                                {
                                    num7    = num11;
                                    exists2 = aimAssistTarget;
                                }
                                if (num13 > num8)
                                {
                                    num7   = num11;
                                    value5 = num12;
                                    exists = aimAssistTarget;
                                    v      = vector6;
                                }
                            }
                        }
                    }
                    Vector2 vector7 = vector2;
                    if (exists2)
                    {
                        float magnitude2 = vector2.magnitude;
                        float d          = Mathf.Clamp01(Util.Remap(1f - num7, 0f, 1f, value3, value4));
                        vector7 *= d;
                    }
                    if (exists)
                    {
                        vector7 = Vector3.RotateTowards(vector7, v, Util.Remap(value5, 1f, 0f, CameraRigController.aimStickAssistMaxDelta.value, CameraRigController.aimStickAssistMinDelta.value), 0f);
                    }
                    vector2 = vector7;
                }
                num14 = vector.x * mouseLookSensitivity * userProfile.mouseLookScaleX + vector2.x * num2 * userProfile.stickLookScaleX * Time.deltaTime;
                num15 = vector.y * mouseLookSensitivity * userProfile.mouseLookScaleY + vector2.y * num2 * userProfile.stickLookScaleY * Time.deltaTime;
            }
            else
            {
                num14 = 0f;
                num15 = 0f;
            }
            NetworkUser         networkUser         = Util.LookUpBodyNetworkUser(this.target);
            NetworkedViewAngles networkedViewAngles = null;

            if (networkUser)
            {
                networkedViewAngles = networkUser.GetComponent <NetworkedViewAngles>();
            }
            this.targetTeamIndex = TeamIndex.None;
            bool flag2 = false;

            if (this.target)
            {
                this.targetBody = this.target.GetComponent <CharacterBody>();
                flag2           = this.targetBody.isSprinting;
                TeamComponent component = this.target.GetComponent <TeamComponent>();
                if (component)
                {
                    this.targetTeamIndex = component.teamIndex;
                }
                this.targetParams = this.target.GetComponent <CameraTargetParams>();
            }
            Vector3 vector8 = this.desiredCameraState.position;

            if (this.targetParams)
            {
                Vector3 position            = this.target.transform.position;
                Vector3 cameraPivotPosition = this.targetParams.cameraPivotPosition;
                if (this.targetParams.dontRaycastToPivot)
                {
                    vector8 = cameraPivotPosition;
                }
                else
                {
                    Vector3 direction = cameraPivotPosition - position;
                    Ray     ray       = new Ray(position, direction);
                    float   distance  = this.Raycast(ray, direction.magnitude, this.targetParams.cameraParams.wallCushion);
                    vector8 = ray.GetPoint(distance);
                }
            }
            if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic || this.cameraMode == CameraRigController.CameraMode.SpectateUser)
            {
                float   min = -89.9f;
                float   max = 89.9f;
                Vector3 idealLocalCameraPos = new Vector3(0f, 0f, 0f);
                float   wallCushion         = 0.1f;
                Vector2 vector9             = Vector2.zero;
                if (this.targetParams)
                {
                    min = this.targetParams.cameraParams.minPitch;
                    max = this.targetParams.cameraParams.maxPitch;
                    idealLocalCameraPos = this.targetParams.idealLocalCameraPos;
                    wallCushion         = this.targetParams.cameraParams.wallCushion;
                    vector9             = this.targetParams.recoil;
                    if (this.targetParams.aimMode == CameraTargetParams.AimType.FirstPerson)
                    {
                        this.firstPersonTarget = this.target;
                    }
                    if (this.targetParams.fovOverride >= 0f)
                    {
                        num    = this.targetParams.fovOverride;
                        num14 *= num / this.baseFov;
                        num15 *= num / this.baseFov;
                    }
                    if (this.targetBody && flag2)
                    {
                        num14 *= 0.5f;
                        num15 *= 0.5f;
                    }
                }
                if (this.sprintingParticleSystem)
                {
                    ParticleSystem.MainModule main = this.sprintingParticleSystem.main;
                    if (flag2)
                    {
                        main.loop = true;
                        if (!this.sprintingParticleSystem.isPlaying)
                        {
                            this.sprintingParticleSystem.Play();
                        }
                    }
                    else
                    {
                        main.loop = false;
                    }
                }
                if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic)
                {
                    float num16 = this.pitch - num15;
                    float num17 = this.yaw + num14;
                    num16     += vector9.y;
                    num17     += vector9.x;
                    this.pitch = Mathf.Clamp(num16, min, max);
                    this.yaw   = Mathf.Repeat(num17, 360f);
                }
                else if (this.cameraMode == CameraRigController.CameraMode.SpectateUser && this.target)
                {
                    if (networkedViewAngles)
                    {
                        this.SetPitchYaw(networkedViewAngles.viewAngles);
                    }
                    else
                    {
                        InputBankTest component2 = this.target.GetComponent <InputBankTest>();
                        if (component2)
                        {
                            this.SetPitchYawFromLookVector(component2.aimDirection);
                        }
                    }
                }
                this.desiredCameraState.rotation = Quaternion.Euler(this.pitch, this.yaw, 0f);
                Vector3 direction2 = vector8 + this.desiredCameraState.rotation * idealLocalCameraPos - vector8;
                float   num18      = direction2.magnitude;
                float   num19      = (1f + this.pitch / -90f) * 0.5f;
                num18 *= Mathf.Sqrt(1f - num19);
                if (num18 < 0.25f)
                {
                    num18 = 0.25f;
                }
                float a = this.Raycast(new Ray(vector8, direction2), num18, wallCushion);
                this.currentCameraDistance       = Mathf.Min(a, Mathf.SmoothDamp(this.currentCameraDistance, a, ref this.cameraDistanceVelocity, 0.5f));
                this.desiredCameraState.position = vector8 + direction2.normalized * this.currentCameraDistance;
                this.pitch -= vector9.y;
                this.yaw   -= vector9.x;
                if (networkedViewAngles && networkedViewAngles.hasEffectiveAuthority)
                {
                    networkedViewAngles.viewAngles = new PitchYawPair(this.pitch, this.yaw);
                }
            }
            if (this.targetBody)
            {
                num *= (this.targetBody.isSprinting ? 1.3f : 1f);
            }
            this.desiredCameraState.fov = Mathf.SmoothDamp(this.desiredCameraState.fov, num, ref this.fovVelocity, 0.2f, float.PositiveInfinity, Time.deltaTime);
            if (this.hud)
            {
                CharacterMaster targetMaster = this.targetBody ? this.targetBody.master : null;
                this.hud.targetMaster = targetMaster;
            }
            this.UpdateCrosshair(vector8);
            CameraState cameraState = this.desiredCameraState;

            if (this.overrideCam != null)
            {
                if ((UnityEngine.Object) this.overrideCam)
                {
                    cameraState = this.overrideCam.GetCameraState(this);
                }
                this.overrideCam = null;
            }
            if (this.lerpCameraTime >= 1f)
            {
                this.currentCameraState = cameraState;
            }
            else
            {
                this.currentCameraState = CameraState.Lerp(ref this.lerpCameraState, ref cameraState, CameraRigController.RemapLerpTime(this.lerpCameraTime));
            }
            this.SetCameraState(this.currentCameraState);
        }
Exemple #4
0
        public void Awake() {
            R2API.Utils.CommandHelper.AddToConsoleWhenReady();
            double RT_timer = 0.0;
            double RT_animationCancelDelay = 0.15;
            bool RT_isSprinting = false;
            bool RT_animationCancel = false;
            bool RT_walkToggle = false;

            SetupConfiguration();

            // MUL-T
            RT_RegisterSprintDisable("EntityStates.Toolbot.ToolbotDualWield");
            RT_RegisterSprintDisable("EntityStates.Toolbot.ToolbotDualWieldBase");
            RT_RegisterSprintDisable("EntityStates.Toolbot.ToolbotDualWieldStart");
            RT_RegisterSprintDisable("EntityStates.Toolbot.FireNailgun");
            RT_RegisterSprintDisable("EntityStates.Toolbot.AimStunDrone");
            RT_RegisterAnimationDelay("EntityStates.Toolbot.FireGrenadeLauncher");

            // Artificer
            RT_RegisterSprintDisable("EntityStates.Mage.Weapon.Flamethrower");
            RT_RegisterSprintDisable("EntityStates.Mage.Weapon.PrepWall");
            RT_RegisterAnimationDelay("EntityStates.Mage.Weapon.FireFireBolt");
            RT_RegisterAnimationDelay("EntityStates.Mage.Weapon.FireLaserbolt");

            // Bandit
            RT_RegisterSprintDisable("EntityStates.Bandit2.Weapon.BasePrepSidearmRevolverState");
            RT_RegisterSprintDisable("EntityStates.Bandit2.Weapon.PrepSidearmResetRevolver");
            RT_RegisterSprintDisable("EntityStates.Bandit2.Weapon.PrepSidearmSkullRevolver");
            RT_RegisterAnimationDelay("EntityStates.Bandit2.Weapon.Bandit2FirePrimaryBase");
            RT_RegisterAnimationDelay("EntityStates.Bandit2.Weapon.FireShotgun2");
            RT_RegisterAnimationDelay("EntityStates.Bandit2.Weapon.Bandit2FireRifle");

            // Engineer
            RT_RegisterSprintDisable("EntityStates.Engi.EngiMissilePainter.Paint");
            RT_RegisterAnimationDelay("EntityStates.Engi.EngiWeapon.FireMines");
            RT_RegisterAnimationDelay("EntityStates.Engi.EngiWeapon.FireSeekerGrenades");

            // Rex
            RT_RegisterSprintDisable("EntityStates.Treebot.Weapon.AimMortar");
            RT_RegisterSprintDisable("EntityStates.Treebot.Weapon.AimMortar2");
            RT_RegisterSprintDisable("EntityStates.Treebot.Weapon.AimMortarRain");
            RT_RegisterAnimationDelay("EntityStates.Treebot.Weapon.FireSyringe");

            // Captain
            RT_RegisterSprintDisable("EntityStates.Captain.Weapon.SetupAirstrike");
            RT_RegisterSprintDisable("EntityStates.Captain.Weapon.SetupAirstrikeAlt");
            RT_RegisterSprintDisable("EntityStates.Captain.Weapon.SetupSupplyDrop");

            // Acrid
            RT_RegisterAnimationDelay("EntityStates.Croco.Slash");

            // Commando
            RT_RegisterAnimationDelay("EntityStates.Commando.CommandoWeapon.FirePistol2");

            // Loader
            RT_RegisterAnimationDelay("EntityStates.Loader.SwingComboFist");

            // On.RoR2.CharacterBody.OnSkillActivated += (orig, self, GenericSkill) => { 
            //     orig(self, GenericSkill); 
            //     Debug.Log( 
            //             GenericSkill.skillDef.skillName  + " | "          // FireFirebolt
            //         + GenericSkill + " | "                                  // MageBody(Clone) (RoR2.GenericSkill)
            //         + GenericSkill.characterBody + " | "                // MageBody(Clone) (RoR2.CharacterBody)
            //         + GenericSkill.characterBody.name + " | "           // MageBody(Clone)
            //         + GenericSkill.characterBody.master + " | "         // CommandoMaster(Clone) (RoR2.CharacterMaster)
            //         + GenericSkill.characterBody.masterObject + " | "   // CommandoMaster(Clone) (UnityEngine.GameObject)           
            //         );
            // }; 

            On.RoR2.PlayerCharacterMasterController.FixedUpdate += delegate (On.RoR2.PlayerCharacterMasterController.orig_FixedUpdate orig, RoR2.PlayerCharacterMasterController self) {
                orig.Invoke(self);
                if (RT_enabled) {
                    RoR2.InputBankTest instanceFieldBodyInputs = self.GetInstanceField<RoR2.InputBankTest>("bodyInputs");
                    if (instanceFieldBodyInputs) {
                        if (self.networkUser && self.networkUser.localUser != null && !self.networkUser.localUser.isUIFocused) {
                            RoR2.CharacterBody instanceFieldBody = self.GetInstanceField<RoR2.CharacterBody>("body");
                            if (instanceFieldBody) {
                                Player inputPlayer = self.networkUser.localUser.inputPlayer;
                                RT_isSprinting = instanceFieldBody.isSprinting;
                                // Periodic sprint checker
                                if (!RT_isSprinting) {
                                    RT_timer += (double)Time.deltaTime;
                                    if (RT_timer >= 0.05) {
                                        if (!RT_animationCancel) {
                                            RT_timer = 0 - SprintDelayTime(instanceFieldBody);
                                        }
                                        if (RT_timer >= 0) {
                                            RT_isSprinting = !ShouldSprintBeDisabledOnThisBody(instanceFieldBody);
                                            RT_animationCancel = false;
                                            RT_timer = 0;
                                        }
                                    }
                                } else { RT_timer = 0; }

                                // Walk Toggle logic
                                if (!HoldSprintToWalk.Value && inputPlayer.GetButtonDown("Sprint") && !ShouldSprintBeDisabledOnThisBody(instanceFieldBody)) {
                                    RT_walkToggle = !RT_walkToggle;
                                } else if (inputPlayer.GetButton("Sprint")) {
                                    if (RT_isSprinting && HoldSprintToWalk.Value) RT_isSprinting = false;
                                    if (!RT_isSprinting && ShouldSprintBeDisabledOnThisBody(instanceFieldBody)) RT_isSprinting = true;
                                    RT_timer = 0;
                                }


                                // Animation cancelling logic.
                                if (!RT_animationCancel && RT_timer < -(RT_animationCancelDelay)
                                    && !inputPlayer.GetButton("PrimarySkill") && !inputPlayer.GetButton("SecondarySkill")
                                    && !inputPlayer.GetButton("SpecialSkill") && !inputPlayer.GetButton("UtilitySkill")) {
                                    RT_timer = -(RT_animationCancelDelay);
                                    RT_animationCancel = true;
                                }

                                // Angle check disables sprinting if the movement angle is too large
                                if (RT_isSprinting && !SprintInAnyDirection.Value) {
                                    Vector3 aimDirection = instanceFieldBodyInputs.aimDirection;
                                    aimDirection.y = 0f;
                                    aimDirection.Normalize();
                                    Vector3 moveVector = instanceFieldBodyInputs.moveVector;
                                    moveVector.y = 0f;
                                    moveVector.Normalize();
                                    if ((instanceFieldBody.bodyFlags & CharacterBody.BodyFlags.SprintAnyDirection) == CharacterBody.BodyFlags.None && (Vector3.Dot(aimDirection, moveVector) < self.GetFieldValue<float>("sprintMinAimMoveDot"))) {
                                        RT_isSprinting = false;
                                    }
                                }

                                if (HoldSprintToWalk.Value && RT_walkToggle) RT_walkToggle = false;
                                if (!RT_walkToggle) instanceFieldBodyInputs.sprint.PushState(RT_isSprinting);
                            } // End of if (instanceFieldBody)
                        } // End of if (networkUser) check
                    } // End of if (instanceFieldBodyInputs)
                } // End of "RT_enabled"
            }; // End of FixedUpdate

            // Custom FOV
            On.RoR2.CameraRigController.Update += (orig, self) => {
                orig(self);
                if (RTAutoSprintEx.RT_visuals) {
                    if (CustomFOV.Value >= 1 && CustomFOV.Value <= 180) self.baseFov = CustomFOV.Value;
                    else Logger.LogWarning("CustomFOV value out of range!");
                }
            };

            // Sprinting Crosshair
            IL.RoR2.UI.CrosshairManager.UpdateCrosshair += (il) => {
                if (RTAutoSprintEx.RT_visuals) {
                    ILCursor c = new ILCursor(il);
                    if (DisableSprintingCrosshair.Value) {
                        Logger.LogInfo("Disabling sprinting crosshair:");
                        try {
                            c.Index = 0;
                            c.GotoNext(
                                MoveType.After,
                                x => x.MatchCallvirt<CharacterBody>("get_isSprinting")
                            );
                            c.Emit(OpCodes.Ldc_I4, 0);
                            c.Emit(OpCodes.And);
                        } catch (Exception ex) { Debug.LogError(ex); }
                    }
                }
            };

            //Sprinting FOV change
            IL.RoR2.CameraRigController.Update += (il) => {
                if (RTAutoSprintEx.RT_visuals) {
                    ILCursor c = new ILCursor(il);
                    if (SprintFOVMultiplier.Value >= 0.1 && SprintFOVMultiplier.Value <= 2.0) {
                        Logger.LogInfo("Modifying Sprint FOV Multiplier:");
                        try {
                            c.Index = 0;
                            c.GotoNext(
                                x => x.MatchLdloc(0),
                                x => x.MatchLdarg(0),
                                x => x.MatchLdfld<RoR2.CameraRigController>("targetBody"),
                                x => x.MatchCallvirt<RoR2.CharacterBody>("get_isSprinting")
                            );
                            c.Index += 7;
                            c.Next.Operand = (float)SprintFOVMultiplier.Value;
                        } catch (Exception ex) { Debug.LogError(ex); }
                    } else Logger.LogWarning("SprintFOVMultiplier value out of range!");
                    // Disable Speedlines
                    if (DisableSpeedlines.Value) {
                        Logger.LogInfo("Disabling Speedlines:");
                        try {
                            c.Index = 0;
                            c.GotoNext(
                                x => x.MatchLdarg(0),
                                x => x.MatchLdfld<RoR2.CameraRigController>("sprintingParticleSystem"),
                                x => x.MatchCallvirt<UnityEngine.ParticleSystem>("get_isPlaying")
                            );
                            c.RemoveRange(3);
                            c.Emit(OpCodes.Ldc_I4, 1);
                        } catch (Exception ex) { Debug.LogError(ex); }
                    }
                }
                Logger.LogInfo("CameraRigController.Update IL edits done.");
            };
        } // End of Awake