From b7a9ff162d092adab895d7406b9d2953dffcc521 Mon Sep 17 00:00:00 2001 From: RedFoxIV <38788538+RedFoxIV@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:42:33 +0300 Subject: [PATCH] mom get the camera --- Content.Shared/CombatMode/CombatModeComponent.cs | 13 +++++++++++++ Content.Shared/CombatMode/SharedCombatModeSystem.cs | 7 ++++++- .../MouseRotator/MouseRotatorComponent.cs | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Content.Shared/CombatMode/CombatModeComponent.cs b/Content.Shared/CombatMode/CombatModeComponent.cs index 124a682d5c..6a19acb00b 100644 --- a/Content.Shared/CombatMode/CombatModeComponent.cs +++ b/Content.Shared/CombatMode/CombatModeComponent.cs @@ -48,5 +48,18 @@ public sealed partial class CombatModeComponent : Component /// [DataField, AutoNetworkedField] public bool ToggleMouseRotator = true; + + + /// + /// If true, sets to 1 degree and + /// to false when the owner enters combatmode. This is currently being tested as of 06.12.24, + /// so a simple bool switch should suffice. + /// Leaving AutoNetworking just in case shitmins need to disable it for someone. Will only take effect when re-enabling combat mode. + /// + /// + /// No effect if is false. + /// + [DataField, AutoNetworkedField] + public bool smoothRotation = true; } } diff --git a/Content.Shared/CombatMode/SharedCombatModeSystem.cs b/Content.Shared/CombatMode/SharedCombatModeSystem.cs index 60d1362bb0..26cf79de3c 100644 --- a/Content.Shared/CombatMode/SharedCombatModeSystem.cs +++ b/Content.Shared/CombatMode/SharedCombatModeSystem.cs @@ -92,7 +92,12 @@ private void SetMouseRotatorComponents(EntityUid uid, bool value) { if (value) { - EnsureComp(uid); + 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<>(). + { + rot.AngleTolerance = Angle.FromDegrees(1); // arbitrary + rot.Simple4DirMode = false; + } EnsureComp(uid); } else diff --git a/Content.Shared/MouseRotator/MouseRotatorComponent.cs b/Content.Shared/MouseRotator/MouseRotatorComponent.cs index 2844b3cb8b..39b82a0405 100644 --- a/Content.Shared/MouseRotator/MouseRotatorComponent.cs +++ b/Content.Shared/MouseRotator/MouseRotatorComponent.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using Robust.Shared.GameStates; using Robust.Shared.Serialization;