diff --git a/Content.Shared/CombatMode/SharedCombatModeSystem.cs b/Content.Shared/CombatMode/SharedCombatModeSystem.cs index 134fae45867..b3b8d5f8409 100644 --- a/Content.Shared/CombatMode/SharedCombatModeSystem.cs +++ b/Content.Shared/CombatMode/SharedCombatModeSystem.cs @@ -35,7 +35,7 @@ private void OnShutdown(EntityUid uid, CombatModeComponent component, ComponentS { _actionsSystem.RemoveAction(uid, component.CombatToggleActionEntity); - SetMouseRotatorComponents(uid, false); + SetMouseRotatorComponents(uid, false, component); } private void OnActionPerform(EntityUid uid, CombatModeComponent component, ToggleCombatActionEvent args) @@ -87,16 +87,16 @@ public virtual void SetInCombatMode(EntityUid entity, bool value, CombatModeComp if (!component.ToggleMouseRotator || IsNpc(entity) && !_mind.TryGetMind(entity, out _, out _)) return; - SetMouseRotatorComponents(entity, value); + SetMouseRotatorComponents(entity, value, component); } - private void SetMouseRotatorComponents(EntityUid uid, bool value) + private void SetMouseRotatorComponents(EntityUid uid, bool value, CombatModeComponent? comp = null) { if (value) { // Corvax-Next-NoScope-Start var rot = EnsureComp(uid); - if (TryComp(uid, out var comp) && comp.SmoothRotation) // no idea under which (intended) circumstances this can fail (if any), so i'll avoid Comp<>(). + if (TryComp(uid, out var combatComp) && combatComp.SmoothRotation) // no idea under which (intended) circumstances this can fail (if any), so i'll avoid Comp<>(). { rot.AngleTolerance = Angle.FromDegrees(1); // arbitrary rot.Simple4DirMode = false;