Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Vonsant committed Jan 1, 2025
1 parent 19c520b commit d4af53e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Content.Shared/CombatMode/SharedCombatModeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<MouseRotatorComponent>(uid);
if (TryComp<CombatModeComponent>(uid, out var comp) && comp.SmoothRotation) // no idea under which (intended) circumstances this can fail (if any), so i'll avoid Comp<>().
if (TryComp<CombatModeComponent>(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;
Expand Down

0 comments on commit d4af53e

Please sign in to comment.