From f89ac343b93de2a31a6a2ec740bca2372d700bc3 Mon Sep 17 00:00:00 2001 From: Peter Taylor Date: Fri, 12 Sep 2025 12:05:35 +0100 Subject: [PATCH 1/3] amended GUI - added large step (90 deg) buttons --- SmartSASMod/GUI.cs | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/SmartSASMod/GUI.cs b/SmartSASMod/GUI.cs index d78896a..fa59ed1 100644 --- a/SmartSASMod/GUI.cs +++ b/SmartSASMod/GUI.cs @@ -30,28 +30,47 @@ public static void SpawnGUI() Vector2Int pos = SettingsManager.settings.windowPosition; Window window = Builder.CreateWindow(holder.transform, MainWindowID, 360, 290, pos.x, pos.y, true, true, 0.95f, "Smart SAS"); - window.gameObject.GetComponent().OnDropAction += () => + window.CreateLayoutGroup(SFS.UI.ModGUI.Type.Vertical, UnityEngine.TextAnchor.MiddleCenter,10f); + window.gameObject.GetComponent().OnDropAction += () => { SettingsManager.settings.windowPosition = Vector2Int.RoundToInt(window.Position); SettingsManager.Save(); }; - buttons = new Dictionary - { - {DirectionMode.Prograde, Builder.CreateButton(window, 160, 50, -85, -25, () => ToggleDirection(DirectionMode.Prograde), "Prograde")}, - {DirectionMode.Target, Builder.CreateButton(window, 160, 50, 85, -25, () => ToggleDirection(DirectionMode.Target), "Target")}, - {DirectionMode.Surface, Builder.CreateButton(window, 160, 50, -85, -80, () => ToggleDirection(DirectionMode.Surface), "Surface")}, - {DirectionMode.None, Builder.CreateButton(window, 160, 50, 85, -80, () => ToggleDirection(DirectionMode.None), "None")} - }; + buttons = new Dictionary(); + + SFS.UI.ModGUI.Container buttonsTop_Container = SFS.UI.ModGUI.Builder.CreateContainer(window); + buttonsTop_Container.CreateLayoutGroup(SFS.UI.ModGUI.Type.Horizontal, UnityEngine.TextAnchor.MiddleCenter,5f); + buttons.Add(DirectionMode.Prograde, Builder.CreateButton(buttonsTop_Container, 160, 50, 0,0, () => ToggleDirection(DirectionMode.Prograde), "Prograde")); + buttons.Add(DirectionMode.Target, Builder.CreateButton(buttonsTop_Container, 160, 50, 0, 0, () => ToggleDirection(DirectionMode.Target), "Target")); + + SFS.UI.ModGUI.Container buttonsBottom_Container = SFS.UI.ModGUI.Builder.CreateContainer(window); + buttonsBottom_Container.CreateLayoutGroup(SFS.UI.ModGUI.Type.Horizontal, UnityEngine.TextAnchor.MiddleCenter,5f); + buttons.Add(DirectionMode.Surface, Builder.CreateButton(buttonsBottom_Container, 160, 50, 0, 0, () => ToggleDirection(DirectionMode.Surface), "Surface")); + buttons.Add(DirectionMode.None, Builder.CreateButton(buttonsBottom_Container, 160, 50, 0, 0, () => ToggleDirection(DirectionMode.None), "None")); Builder.CreateLabel(window, 180, 50, 0, -145, "Angle Offset"); - angleInput = Builder.CreateTextInput(window, 110, 50, 0, -200, "0.00"); +//~ angleInput = Builder.CreateTextInput(window, 110, 50, 0, -200, "0.00"); +//~ angleInput.field.onEndEdit.AddListener(VerifyOffsetInput); + +//~ Builder.CreateButton(window, 50, 50, -140, -200, () => AddOffsetValue(-10), "<<"); +//~ Builder.CreateButton(window, 50, 50, -85, -200, () => AddOffsetValue(-1), "<"); +//~ Builder.CreateButton(window, 50, 50, 140, -200, () => AddOffsetValue(10), ">>"); +//~ Builder.CreateButton(window, 50, 50, 85, -200, () => AddOffsetValue(1), ">"); + + SFS.UI.ModGUI.Container offset_Container = SFS.UI.ModGUI.Builder.CreateContainer(window); + offset_Container.CreateLayoutGroup(SFS.UI.ModGUI.Type.Horizontal, UnityEngine.TextAnchor.MiddleCenter,5f); + + Builder.CreateButton(offset_Container, 40, 30, 0, 0, () => AddOffsetValue(-90), "<<<"); + Builder.CreateButton(offset_Container, 30, 30, 0, 0, () => AddOffsetValue(-10), "<<"); + Builder.CreateButton(offset_Container, 30, 30, 0, 0, () => AddOffsetValue(-1), "<"); + + angleInput = Builder.CreateTextInput(offset_Container, 110, 50, 0, 0, "0.00"); angleInput.field.onEndEdit.AddListener(VerifyOffsetInput); - Builder.CreateButton(window, 50, 50, -140, -200, () => AddOffsetValue(-10), "<<"); - Builder.CreateButton(window, 50, 50, -85, -200, () => AddOffsetValue(-1), "<"); - Builder.CreateButton(window, 50, 50, 140, -200, () => AddOffsetValue(10), ">>"); - Builder.CreateButton(window, 50, 50, 85, -200, () => AddOffsetValue(1), ">"); + Builder.CreateButton(offset_Container, 30, 30, 0, 0, () => AddOffsetValue(1), ">"); + Builder.CreateButton(offset_Container, 30, 30, 0, 0, () => AddOffsetValue(10), ">>"); + Builder.CreateButton(offset_Container, 40, 30, 0, 0, () => AddOffsetValue(90), ">>>"); window.gameObject.transform.localScale = new Vector3(SettingsManager.settings.windowScale, SettingsManager.settings.windowScale, 1f); From 16cfcb297b63e86c07832d95df3bb65bb66c6750 Mon Sep 17 00:00:00 2001 From: Peter Taylor Date: Fri, 12 Sep 2025 18:57:16 +0100 Subject: [PATCH 2/3] Amended ANAIS targeting to include final approach velocity arrows --- SmartSASMod/Patches.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SmartSASMod/Patches.cs b/SmartSASMod/Patches.cs index a77ce94..7df3796 100644 --- a/SmartSASMod/Patches.cs +++ b/SmartSASMod/Patches.cs @@ -34,11 +34,11 @@ float TargetRotationToTorque(float targetAngle) float mass = __instance.rb2d.mass; if (mass > 200f) torque /= Mathf.Pow(mass / 200f, 0.35f); - + float maxAcceleration = torque * Mathf.Rad2Deg / mass; float stoppingTime = Mathf.Abs(angularVelocity / maxAcceleration); float currentTime = Mathf.Abs(deltaAngle / angularVelocity); - + if (stoppingTime > currentTime) { return Mathf.Sign(angularVelocity); @@ -68,7 +68,7 @@ float TargetRotationToTorque(float targetAngle) SelectableObject target = __instance == rocket ? Map.navigation.target : sas.Target; // Keeps the last selected target if the sas comp.'s rocket isn't the currently controlled rocket. if (Main.ANAISTraverse is Traverse traverse && __instance == rocket) { - if (traverse.Field("_navState").GetValue().ToString() == "ANAIS_TRANSFER_PLANNED") + if (traverse.Field("_navState").GetValue().ToString() != "DEFAULT") { Double2 dv = traverse.Field("_relativeVelocity").Value; targetRotation = GUI.NormaliseAngle((float)Math.Atan2(dv.y, dv.x) * Mathf.Rad2Deg); From 442754fe62a924b9764c2f9ea3c39ef426025eed Mon Sep 17 00:00:00 2001 From: Peter Taylor Date: Fri, 10 Oct 2025 10:25:27 +0100 Subject: [PATCH 3/3] renamed to indicate this a forked version --- SmartSASMod/Main.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SmartSASMod/Main.cs b/SmartSASMod/Main.cs index 3baf0be..63912a2 100644 --- a/SmartSASMod/Main.cs +++ b/SmartSASMod/Main.cs @@ -12,15 +12,15 @@ namespace SmartSASMod { public class Main : Mod { - public override string ModNameID => "smartsas"; - public override string DisplayName => "Smart SAS"; - public override string Author => "Astro The Rabbit"; + public override string ModNameID => "smartsasdarth"; + public override string DisplayName => "Smart SAS (Darthan Fork)"; + public override string Author => "Astro The Rabbit, Darthan184"; public override string MinimumGameVersionNecessary => "1.5.10.2"; - public override string ModVersion => "1.7"; + public override string ModVersion => "1.7-Darthan184-1"; public override string Description => "Adds a variety of control options for the stability assist system (SAS)."; public override Dictionary Dependencies { get; } = new Dictionary { { "UITools", "1.1.5" } }; - public Dictionary UpdatableFiles => new Dictionary() { { "https://github.com/AstroTheRabbit/Smart-SAS-Mod-SFS/releases/latest/download/SmartSASMod.dll", new FolderPath(ModFolder).ExtendToFile("SmartSASMod.dll") } }; +//~ public Dictionary UpdatableFiles => new Dictionary() { { "https://github.com/AstroTheRabbit/Smart-SAS-Mod-SFS/releases/latest/download/SmartSASMod.dll", new FolderPath(ModFolder).ExtendToFile("SmartSASMod.dll") } }; public static Mod mod; public static FolderPath modFolder; @@ -44,7 +44,7 @@ public override void Load() Assembly ANAISAssembly = Loader.main.GetLoadedMods().First(mod => mod.ModNameID == "ANAIS").GetType().Assembly; Type velocityArrowPatch = ANAISAssembly.GetTypes().First(type => type.Name == "VelocityArrowDrawer_OnLocationChange_Patch"); ANAISTraverse = Traverse.Create(velocityArrowPatch); - } + } catch { Debug.Log("Smart SAS: ANAIS is not installed/active.");