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 1/4] 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; From 55a3447a18950535492548336563fc908436adf1 Mon Sep 17 00:00:00 2001 From: RedFoxIV <38788538+RedFoxIV@users.noreply.github.com> Date: Fri, 6 Dec 2024 20:05:26 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D1=81=20=D0=B7=D0=B0=D0=B3=D0=BB=D0=B0?= =?UTF-8?q?=D0=B2=D0=BD=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Shared/CombatMode/CombatModeComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/CombatMode/CombatModeComponent.cs b/Content.Shared/CombatMode/CombatModeComponent.cs index 6a19acb00b..88a2d3b713 100644 --- a/Content.Shared/CombatMode/CombatModeComponent.cs +++ b/Content.Shared/CombatMode/CombatModeComponent.cs @@ -60,6 +60,6 @@ public sealed partial class CombatModeComponent : Component /// No effect if is false. /// [DataField, AutoNetworkedField] - public bool smoothRotation = true; + public bool SmoothRotation = true; } } From b56129d6b92025430f799b1150754201f08b4bb8 Mon Sep 17 00:00:00 2001 From: RedFoxIV <38788538+RedFoxIV@users.noreply.github.com> Date: Fri, 6 Dec 2024 20:29:31 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=BA=D1=80=D0=B8=D1=87=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Shared/CombatMode/SharedCombatModeSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/CombatMode/SharedCombatModeSystem.cs b/Content.Shared/CombatMode/SharedCombatModeSystem.cs index 26cf79de3c..bb2e93d734 100644 --- a/Content.Shared/CombatMode/SharedCombatModeSystem.cs +++ b/Content.Shared/CombatMode/SharedCombatModeSystem.cs @@ -93,7 +93,7 @@ private void SetMouseRotatorComponents(EntityUid uid, bool value) if (value) { 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 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; From 52ed4f9657c1f045c7e48f6b6891586587bc11d3 Mon Sep 17 00:00:00 2001 From: RedFoxIV <38788538+RedFoxIV@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:00:42 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=BC=D0=B0=D1=80=D0=BA,=20=D1=8F=20=D0=BC?= =?UTF-8?q?=D0=B0=D1=80=D0=BA=D0=B8=20=D1=81=D0=B2=D0=BE=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=87=D1=83=D0=B2=D1=81=D1=82=D0=B2=D1=83=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Shared/CombatMode/CombatModeComponent.cs | 3 ++- Content.Shared/CombatMode/SharedCombatModeSystem.cs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Content.Shared/CombatMode/CombatModeComponent.cs b/Content.Shared/CombatMode/CombatModeComponent.cs index 88a2d3b713..8e8ffbc53b 100644 --- a/Content.Shared/CombatMode/CombatModeComponent.cs +++ b/Content.Shared/CombatMode/CombatModeComponent.cs @@ -49,7 +49,7 @@ public sealed partial class CombatModeComponent : Component [DataField, AutoNetworkedField] public bool ToggleMouseRotator = true; - + // WD EDIT START /// /// If true, sets to 1 degree and /// to false when the owner enters combatmode. This is currently being tested as of 06.12.24, @@ -61,5 +61,6 @@ public sealed partial class CombatModeComponent : Component /// [DataField, AutoNetworkedField] public bool SmoothRotation = true; + // WD EDIT END } } diff --git a/Content.Shared/CombatMode/SharedCombatModeSystem.cs b/Content.Shared/CombatMode/SharedCombatModeSystem.cs index bb2e93d734..60b31a00a2 100644 --- a/Content.Shared/CombatMode/SharedCombatModeSystem.cs +++ b/Content.Shared/CombatMode/SharedCombatModeSystem.cs @@ -93,11 +93,13 @@ private void SetMouseRotatorComponents(EntityUid uid, bool value) if (value) { var rot = EnsureComp(uid); + // WD EDIT START 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; } + // WD EDIT END EnsureComp(uid); } else