From 9b8eb15f3671d792c440b66960ca8b264d34279d Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 17:23:09 -0500 Subject: [PATCH 01/20] tell user that they can input seconds in the simulation datetime since DateTime can ofc handle seconds --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index b9357c520e..5b84f1cb49 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -130,7 +130,7 @@ public static void DrawSimulationConfigure(int windowID) _UTString = GUILayout.TextField(_UTString, GUILayout.Width(110)); _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the amount of time entered onto the field. Otherwise the date and time will be set to entered value.")); GUILayout.EndHorizontal(); - GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\" or \"1960-12-31 23:59\""); + GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\" or \"1960-12-31 23:59:59\""); GUILayout.Space(4); if (ModUtils.IsTestFlightInstalled || ModUtils.IsTestLiteInstalled) From 0c55816c2d3852e2491119f258a748c76be6213b Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 17:50:33 -0500 Subject: [PATCH 02/20] avoid timewarp kraken --- Source/RP0/UI/KCT/GUI_Simulation.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 5b84f1cb49..56cad7c1b4 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -238,7 +238,10 @@ private static void StartSim(SimulationParams simParams) double currentUT = Planetarium.GetUniversalTime(); double ut = 0; - if (!string.IsNullOrWhiteSpace(_UTString) && !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut)) + // if string is not empty and ((string has HH:mm but no YYYY-MM-DD) or (string fails TryParseTimeString)), then output failure + if (!string.IsNullOrWhiteSpace(_UTString) && + (_UTString.Contains(":") && !System.Text.RegularExpressions.Regex.IsMatch(_UTString, @"^\d{4}-\d{2}-\d{2}")) || + !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut)) { var message = new ScreenMessage("Please enter a valid time value.", 6f, ScreenMessageStyle.UPPER_CENTER); ScreenMessages.PostScreenMessage(message); From a5c237b02467416f63e891dc74f31ef1a476193b Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:00:53 -0500 Subject: [PATCH 03/20] also remind users of allowing time in seconds who would use this? --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 56cad7c1b4..e391560b5b 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -130,7 +130,7 @@ public static void DrawSimulationConfigure(int windowID) _UTString = GUILayout.TextField(_UTString, GUILayout.Width(110)); _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the amount of time entered onto the field. Otherwise the date and time will be set to entered value.")); GUILayout.EndHorizontal(); - GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\" or \"1960-12-31 23:59:59\""); + GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\", \"1960-12-31 23:59:59\", or \"61883248319\"."); GUILayout.Space(4); if (ModUtils.IsTestFlightInstalled || ModUtils.IsTestLiteInstalled) From c59a7b523b75a04ce03d7f70b44340aa26be98c4 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:07:41 -0500 Subject: [PATCH 04/20] Update GUI_Simulation.cs --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index e391560b5b..95bebad36d 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -130,7 +130,7 @@ public static void DrawSimulationConfigure(int windowID) _UTString = GUILayout.TextField(_UTString, GUILayout.Width(110)); _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the amount of time entered onto the field. Otherwise the date and time will be set to entered value.")); GUILayout.EndHorizontal(); - GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\", \"1960-12-31 23:59:59\", or \"61883248319\"."); + GUILayout.Label("Accepts values with formats \"1y 2d 3h 4m 5s\", \"1960-12-31 23:59:59\", or \"61883248319\"."); GUILayout.Space(4); if (ModUtils.IsTestFlightInstalled || ModUtils.IsTestLiteInstalled) From d6279f28e7609357999af73cb7483d2ac70441ab Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:47:06 -0500 Subject: [PATCH 05/20] Update GUI_Simulation.cs --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 95bebad36d..d0f2baefbf 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -135,7 +135,7 @@ public static void DrawSimulationConfigure(int windowID) if (ModUtils.IsTestFlightInstalled || ModUtils.IsTestLiteInstalled) { - simParams.DisableFailures = !GUILayout.Toggle(!simParams.DisableFailures, " Enable Part Failures"); + simParams.DisableFailures = !GUILayout.Toggle(!simParams.DisableFailures, " Enable Part Failures with TestFlight or TestLite"); GUILayout.Space(4); } From 0d6a4e8a4ef03f96b7446083c21d4618f1cf6344 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 19:18:21 -0500 Subject: [PATCH 06/20] prevent user from inputting exact date and time when "From Now" is selected --- Source/RP0/UI/KCT/GUI_Simulation.cs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index d0f2baefbf..507efa690b 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -130,7 +130,14 @@ public static void DrawSimulationConfigure(int windowID) _UTString = GUILayout.TextField(_UTString, GUILayout.Width(110)); _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the amount of time entered onto the field. Otherwise the date and time will be set to entered value.")); GUILayout.EndHorizontal(); - GUILayout.Label("Accepts values with formats \"1y 2d 3h 4m 5s\", \"1960-12-31 23:59:59\", or \"61883248319\"."); + if (_fromCurrentUT) + { + GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\" or \"31719845\"."); + } + else + { + GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\", \"1960-12-31 23:59:59\", or \"31719845\"."); + } GUILayout.Space(4); if (ModUtils.IsTestFlightInstalled || ModUtils.IsTestLiteInstalled) @@ -238,16 +245,21 @@ private static void StartSim(SimulationParams simParams) double currentUT = Planetarium.GetUniversalTime(); double ut = 0; - // if string is not empty and ((string has HH:mm but no YYYY-MM-DD) or (string fails TryParseTimeString)), then output failure - if (!string.IsNullOrWhiteSpace(_UTString) && - (_UTString.Contains(":") && !System.Text.RegularExpressions.Regex.IsMatch(_UTString, @"^\d{4}-\d{2}-\d{2}")) || - !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut)) + if (_fromCurrentUT && (_UTString.Contains("-") || _UTString.Contains(":"))) // prevent the user from doing 1960-12-31, accidentally selecting "From Now", and then warping 1960 years forward + { + var message = new ScreenMessage("Value must be of format \"1y 2d 3h 4m 5s\" or \"31719845\" when \"From Now\" is selected.", 6f, ScreenMessageStyle.UPPER_CENTER); + ScreenMessages.PostScreenMessage(message); + return; + } + else if (!string.IsNullOrWhiteSpace(_UTString) && + (_UTString.Contains(":") && !System.Text.RegularExpressions.Regex.IsMatch(_UTString, @"^\d{4}-\d{2}-\d{2}")) || + !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut)) // if string is not empty and ((string has HH:mm but no YYYY-MM-DD) or (string fails TryParseTimeString)), then output failure { var message = new ScreenMessage("Please enter a valid time value.", 6f, ScreenMessageStyle.UPPER_CENTER); ScreenMessages.PostScreenMessage(message); return; } - + simParams.DelayMoveSeconds = 0; if (_fromCurrentUT) { From 038d09ec72d74bb6a0e62ab3576a8119527d628c Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Mon, 3 Feb 2025 19:21:04 -0500 Subject: [PATCH 07/20] Update GUI_Simulation.cs --- Source/RP0/UI/KCT/GUI_Simulation.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 507efa690b..2a2a8bbfd7 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -259,7 +259,6 @@ private static void StartSim(SimulationParams simParams) ScreenMessages.PostScreenMessage(message); return; } - simParams.DelayMoveSeconds = 0; if (_fromCurrentUT) { From e07b26b307827749e1a05af5520919545d3f65f5 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Wed, 5 Feb 2025 18:26:47 -0500 Subject: [PATCH 08/20] add small buffer to default sim orbit altitude especially a problem with principia --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 2a2a8bbfd7..489a4647af 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -324,7 +324,7 @@ private static double EnsureSafeMaxAltitude(double altitudeMeters, CelestialBody private static double GetDefaultAltitudeForBody(CelestialBody body) { - return body.atmosphere ? body.atmosphereDepth + 20000 : 20000; + return body.atmosphere ? body.atmosphereDepth + 20010 : 20000; } } } From f9ce41ff462538b538dd7a01bafee7bbf6d9fe9b Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:42:46 -0500 Subject: [PATCH 09/20] add mean anomaly and argument of periapsis to simulation gui is that some good code siimav? ill be stealing that, thank you very much --- Source/RP0/UI/KCT/GUI_Simulation.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 489a4647af..c776ba7bf3 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -10,7 +10,7 @@ public static partial class KCT_GUI private static Rect _simulationConfigPosition = new Rect((Screen.width / 2) - 150, (Screen.height / 4), 300, 1); private static Vector2 _bodyChooserScrollPos; - private static string _sOrbitAlt = "", _sOrbitPe = "", _sOrbitAp = "", _sOrbitInc = "", _sOrbitLAN = "", _UTString = "", _sDelay = "0"; + private static string _sOrbitAlt = "", _sOrbitPe = "", _sOrbitAp = "", _sOrbitInc = "", _sOrbitLAN = "", _sOrbitMNA = "", _sOrbitArgPE = "", _UTString = "", _sDelay = "0"; private static bool _fromCurrentUT = true; private static bool _circOrbit = true; @@ -122,6 +122,16 @@ public static void DrawSimulationConfigure(int windowID) GUILayout.Label("LAN: "); _sOrbitLAN = GUILayout.TextField(_sOrbitLAN, GUILayout.Width(50)); GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Mean Anomaly: "); + _sOrbitMNA = GUILayout.TextField(_sOrbitMNA, GUILayout.Width(50)); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Argument of Periapsis: "); + _sOrbitArgPE = GUILayout.TextField(_sOrbitArgPE, GUILayout.Width(50)); + GUILayout.EndHorizontal(); } GUILayout.Space(4); @@ -241,6 +251,16 @@ private static void StartSim(SimulationParams simParams) simParams.SimLAN = 0; else simParams.SimLAN %= 360; + + if (!double.TryParse(_sOrbitMNA, out simParams.SimMNA)) + simParams.SimMNA = Math.PI; // this will set it at apoapsis, good for safety + else + simParams.SimMNA %= 2 * Math.PI; + + if (!double.TryParse(_sOrbitArgPE, out simParams.SimArgPE)) + simParams.SimArgPE = 0; + else + simParams.SimArgPE %= 360; } double currentUT = Planetarium.GetUniversalTime(); From 2b962c0aa94557970726e1105b5da25d872e42e6 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:43:29 -0500 Subject: [PATCH 10/20] Update SimulationParams.cs --- Source/RP0/SpaceCenter/SimulationParams.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/SpaceCenter/SimulationParams.cs b/Source/RP0/SpaceCenter/SimulationParams.cs index 90bd01764f..53b67bd095 100644 --- a/Source/RP0/SpaceCenter/SimulationParams.cs +++ b/Source/RP0/SpaceCenter/SimulationParams.cs @@ -32,7 +32,7 @@ public CelestialBody SimulationBody public bool SimulateInOrbit, DisableFailures; public bool IsVesselMoved; [Persistent] - public double SimulationUT, SimOrbitAltitude, SimOrbitPe, SimOrbitAp, SimInclination, SimLAN; + public double SimulationUT, SimOrbitAltitude, SimOrbitPe, SimOrbitAp, SimInclination, SimLAN, SimMNA, SimArgPE; [Persistent] public int DelayMoveSeconds; From ff3550022d330b154e8b55a46b7933948f146156 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:47:23 -0500 Subject: [PATCH 11/20] Update SpaceCenterManagement.cs --- Source/RP0/SpaceCenter/SpaceCenterManagement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/RP0/SpaceCenter/SpaceCenterManagement.cs b/Source/RP0/SpaceCenter/SpaceCenterManagement.cs index ea25e9820b..2bd5b5581c 100644 --- a/Source/RP0/SpaceCenter/SpaceCenterManagement.cs +++ b/Source/RP0/SpaceCenter/SpaceCenterManagement.cs @@ -1301,7 +1301,7 @@ private static IEnumerator SetSimOrbit(SimulationParams simParams) double sma = simParams.SimOrbitAltitude + body.Radius; double ecc = 0.0000001; // Just a really smol value to prevent Ap and Pe from flickering around RP0Debug.Log($"Moving vessel to orbit. {body.bodyName}:{simParams.SimOrbitAltitude}:{simParams.SimInclination}"); - FlightGlobals.fetch.SetShipOrbit(body.flightGlobalsIndex, ecc, sma, simParams.SimInclination, simParams.SimLAN, 0.0, 0.0, 0.0); + FlightGlobals.fetch.SetShipOrbit(body.flightGlobalsIndex, ecc, sma, simParams.SimInclination, simParams.SimLAN, simParams.SimMNA, simParams.SimArgPe, 0.0); // selBodyIndex, ecc, sma, inc, LAN, mna, argPe, ObT FloatingOrigin.ResetTerrainShaderOffset(); } else @@ -1311,7 +1311,7 @@ private static IEnumerator SetSimOrbit(SimulationParams simParams) double sma = (ra + rp) / 2; double ecc = (ra - rp) / (ra + rp); RP0Debug.Log($"Moving vessel to orbit. {body.bodyName}:{simParams.SimOrbitPe}/{simParams.SimOrbitAp}:{simParams.SimInclination}"); - FlightGlobals.fetch.SetShipOrbit(body.flightGlobalsIndex, ecc, sma, simParams.SimInclination, simParams.SimLAN, Math.PI, 0.0, 0.0); + FlightGlobals.fetch.SetShipOrbit(body.flightGlobalsIndex, ecc, sma, simParams.SimInclination, simParams.SimLAN, simParams.SimMNA, simParams.SimArgPe, 0.0); // selBodyIndex, ecc, sma, inc, LAN, mna, argPe, ObT FloatingOrigin.ResetTerrainShaderOffset(); } } From f479adba35ac69bdf90e8470bf9e0a6db1202d2b Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:47:32 -0500 Subject: [PATCH 12/20] Update SimulationParams.cs --- Source/RP0/SpaceCenter/SimulationParams.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/SpaceCenter/SimulationParams.cs b/Source/RP0/SpaceCenter/SimulationParams.cs index 53b67bd095..91d5916083 100644 --- a/Source/RP0/SpaceCenter/SimulationParams.cs +++ b/Source/RP0/SpaceCenter/SimulationParams.cs @@ -32,7 +32,7 @@ public CelestialBody SimulationBody public bool SimulateInOrbit, DisableFailures; public bool IsVesselMoved; [Persistent] - public double SimulationUT, SimOrbitAltitude, SimOrbitPe, SimOrbitAp, SimInclination, SimLAN, SimMNA, SimArgPE; + public double SimulationUT, SimOrbitAltitude, SimOrbitPe, SimOrbitAp, SimInclination, SimLAN, SimMNA, SimArgPe; [Persistent] public int DelayMoveSeconds; From c1811f19648d221353584121d3091b5aaa6a662f Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:48:32 -0500 Subject: [PATCH 13/20] change ArgPE to ArgPe its argPe in the docs so this is a little better --- Source/RP0/UI/KCT/GUI_Simulation.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index c776ba7bf3..d6f373c6fd 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -10,7 +10,7 @@ public static partial class KCT_GUI private static Rect _simulationConfigPosition = new Rect((Screen.width / 2) - 150, (Screen.height / 4), 300, 1); private static Vector2 _bodyChooserScrollPos; - private static string _sOrbitAlt = "", _sOrbitPe = "", _sOrbitAp = "", _sOrbitInc = "", _sOrbitLAN = "", _sOrbitMNA = "", _sOrbitArgPE = "", _UTString = "", _sDelay = "0"; + private static string _sOrbitAlt = "", _sOrbitPe = "", _sOrbitAp = "", _sOrbitInc = "", _sOrbitLAN = "", _sOrbitMNA = "", _sOrbitArgPe = "", _UTString = "", _sDelay = "0"; private static bool _fromCurrentUT = true; private static bool _circOrbit = true; @@ -130,7 +130,7 @@ public static void DrawSimulationConfigure(int windowID) GUILayout.BeginHorizontal(); GUILayout.Label("Argument of Periapsis: "); - _sOrbitArgPE = GUILayout.TextField(_sOrbitArgPE, GUILayout.Width(50)); + _sOrbitArgPe = GUILayout.TextField(_sOrbitArgPe, GUILayout.Width(50)); GUILayout.EndHorizontal(); } @@ -257,10 +257,10 @@ private static void StartSim(SimulationParams simParams) else simParams.SimMNA %= 2 * Math.PI; - if (!double.TryParse(_sOrbitArgPE, out simParams.SimArgPE)) - simParams.SimArgPE = 0; + if (!double.TryParse(_sOrbitArgPe, out simParams.SimArgPe)) + simParams.SimArgPe = 0; else - simParams.SimArgPE %= 360; + simParams.SimArgPe %= 360; } double currentUT = Planetarium.GetUniversalTime(); From 8bcc2e0bfa3b42d12fda384768543ba4525f94b2 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Thu, 6 Feb 2025 20:52:21 -0500 Subject: [PATCH 14/20] misc changes --- Source/RP0/UI/KCT/GUI_Simulation.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index d6f373c6fd..0142a0798b 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -79,7 +79,7 @@ public static void DrawSimulationConfigure(int windowID) } if (simParams.SimulationBody != Planetarium.fetch.Home || simParams.SimulateInOrbit) { - _circOrbit = GUILayout.Toggle(_circOrbit, "Circular"); + _circOrbit = GUILayout.Toggle(_circOrbit, " Circular"); if (_circOrbit) { GUILayout.BeginHorizontal(); @@ -114,22 +114,22 @@ public static void DrawSimulationConfigure(int windowID) GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Inclination: "); + GUILayout.Label("Inclination (degrees): "); _sOrbitInc = GUILayout.TextField(_sOrbitInc, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("LAN: "); + GUILayout.Label("LAN (degrees): "); _sOrbitLAN = GUILayout.TextField(_sOrbitLAN, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Mean Anomaly: "); + GUILayout.Label("Mean Anomaly (radians): "); _sOrbitMNA = GUILayout.TextField(_sOrbitMNA, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Argument of Periapsis: "); + GUILayout.Label("Argument of Periapsis (degrees): "); _sOrbitArgPe = GUILayout.TextField(_sOrbitArgPe, GUILayout.Width(50)); GUILayout.EndHorizontal(); } @@ -142,17 +142,17 @@ public static void DrawSimulationConfigure(int windowID) GUILayout.EndHorizontal(); if (_fromCurrentUT) { - GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\" or \"31719845\"."); + GUILayout.Label("Valid formats: \"1y 2d 3h 4m 5s\" and \"31719845\"."); } else { - GUILayout.Label("Accepts values with format \"1y 2d 3h 4m 5s\", \"1960-12-31 23:59:59\", or \"31719845\"."); + GUILayout.Label("Valid formats: \"1y 2d 3h 4m 5s\", \"31719845\", and \"1960-12-31 23:59:59\"."); } GUILayout.Space(4); if (ModUtils.IsTestFlightInstalled || ModUtils.IsTestLiteInstalled) { - simParams.DisableFailures = !GUILayout.Toggle(!simParams.DisableFailures, " Enable Part Failures with TestFlight or TestLite"); + simParams.DisableFailures = !GUILayout.Toggle(!simParams.DisableFailures, " Enable Part Failures (TestFlight or TestLite)"); GUILayout.Space(4); } From ef2bf58074eb718150a21e891af44661b2e03dd8 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Thu, 6 Feb 2025 21:12:22 -0500 Subject: [PATCH 15/20] fix logic previously, it was doing: if (!whitespace and (contains ":" and does not have date format)) OR fails parse now its doing: if !whitespace and ((contains ":" and does not have date format) OR fails parse) this should correctly allow for whitespaces --- Source/RP0/UI/KCT/GUI_Simulation.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 0142a0798b..18c9ba6ed8 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -272,8 +272,8 @@ private static void StartSim(SimulationParams simParams) return; } else if (!string.IsNullOrWhiteSpace(_UTString) && - (_UTString.Contains(":") && !System.Text.RegularExpressions.Regex.IsMatch(_UTString, @"^\d{4}-\d{2}-\d{2}")) || - !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut)) // if string is not empty and ((string has HH:mm but no YYYY-MM-DD) or (string fails TryParseTimeString)), then output failure + ((_UTString.Contains(":") && !System.Text.RegularExpressions.Regex.IsMatch(_UTString, @"^\d{4}-\d{2}-\d{2}")) || + !ROUtils.DTUtils.TryParseTimeString(_UTString, isTimespan: !_fromCurrentUT, out ut))) // if string is not empty and ((string has HH:mm but no YYYY-MM-DD) or (string fails TryParseTimeString)), then output failure { var message = new ScreenMessage("Please enter a valid time value.", 6f, ScreenMessageStyle.UPPER_CENTER); ScreenMessages.PostScreenMessage(message); From 69ebcd84a386b77bb66f120d6c23e6c454dfe1a0 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Thu, 6 Feb 2025 21:48:15 -0500 Subject: [PATCH 16/20] cut tip text down, as it was overrunning the box --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 18c9ba6ed8..e420bc4903 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -138,7 +138,7 @@ public static void DrawSimulationConfigure(int windowID) GUILayout.BeginHorizontal(); GUILayout.Label("Time: "); _UTString = GUILayout.TextField(_UTString, GUILayout.Width(110)); - _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the amount of time entered onto the field. Otherwise the date and time will be set to entered value.")); + _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the entered value. Otherwise the date and time will be set to the entered value.")); GUILayout.EndHorizontal(); if (_fromCurrentUT) { From 55d2e382ea3e08a9ff67faccd2d9bb3ea111178d Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Thu, 6 Feb 2025 21:52:22 -0500 Subject: [PATCH 17/20] change default height above atmosphere orbit to be 5000 instead of 20000 if we already tell the user what the minimum value is, then we dont need to set them so high above the atmosphere, as this could just be confusing. 5000 is more than high enough to counteract principia shenanigans, while still allowing the user to be in a low orbit by default --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index e420bc4903..fbfbf499c6 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -344,7 +344,7 @@ private static double EnsureSafeMaxAltitude(double altitudeMeters, CelestialBody private static double GetDefaultAltitudeForBody(CelestialBody body) { - return body.atmosphere ? body.atmosphereDepth + 20010 : 20000; + return body.atmosphere ? body.atmosphereDepth + 5000 : 20000; } } } From d58bb4cbe8b683bca65029999dab9a695e269f9c Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Thu, 6 Feb 2025 21:55:21 -0500 Subject: [PATCH 18/20] change position of "(s)" in delay, add "km" to min and max --- Source/RP0/UI/KCT/GUI_Simulation.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index fbfbf499c6..da5d30c512 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -87,8 +87,8 @@ public static void DrawSimulationConfigure(int windowID) _sOrbitAlt = GUILayout.TextField(_sOrbitAlt, GUILayout.Width(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); - GUILayout.Label("Min: " + simParams.SimulationBody.atmosphereDepth / 1000); - GUILayout.Label("Max: " + Math.Floor((simParams.SimulationBody.sphereOfInfluence - simParams.SimulationBody.Radius) / 1000)); + GUILayout.Label("Min: " + simParams.SimulationBody.atmosphereDepth / 1000 + "km"); + GUILayout.Label("Max: " + Math.Floor((simParams.SimulationBody.sphereOfInfluence - simParams.SimulationBody.Radius) / 1000) + "km"); GUILayout.EndHorizontal(); } else @@ -109,7 +109,7 @@ public static void DrawSimulationConfigure(int windowID) if (simParams.SimulateInOrbit) { GUILayout.BeginHorizontal(); - GUILayout.Label("Delay: (s)"); + GUILayout.Label("Delay (s): "); _sDelay = GUILayout.TextField(_sDelay, 3, GUILayout.Width(40)); GUILayout.EndHorizontal(); From 96e6fb5587d30c543a76daad0155ab040f12db23 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Thu, 6 Feb 2025 23:17:56 -0500 Subject: [PATCH 19/20] increase width of info box? does this even work? --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index da5d30c512..74f96b8b34 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -138,7 +138,7 @@ public static void DrawSimulationConfigure(int windowID) GUILayout.BeginHorizontal(); GUILayout.Label("Time: "); _UTString = GUILayout.TextField(_UTString, GUILayout.Width(110)); - _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the entered value. Otherwise the date and time will be set to the entered value.")); + _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the entered value. Otherwise the date and time will be set to the entered value."), GUILayout.Width(300)); GUILayout.EndHorizontal(); if (_fromCurrentUT) { From 590a229a2c524eb4f6984078c8e247616f853120 Mon Sep 17 00:00:00 2001 From: Clayell <125416952+Clayell@users.noreply.github.com> Date: Thu, 6 Feb 2025 23:52:43 -0500 Subject: [PATCH 20/20] revert previous change just increases the size of the simulation config box, not the tooltip --- Source/RP0/UI/KCT/GUI_Simulation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RP0/UI/KCT/GUI_Simulation.cs b/Source/RP0/UI/KCT/GUI_Simulation.cs index 74f96b8b34..da5d30c512 100644 --- a/Source/RP0/UI/KCT/GUI_Simulation.cs +++ b/Source/RP0/UI/KCT/GUI_Simulation.cs @@ -138,7 +138,7 @@ public static void DrawSimulationConfigure(int windowID) GUILayout.BeginHorizontal(); GUILayout.Label("Time: "); _UTString = GUILayout.TextField(_UTString, GUILayout.Width(110)); - _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the entered value. Otherwise the date and time will be set to the entered value."), GUILayout.Width(300)); + _fromCurrentUT = GUILayout.Toggle(_fromCurrentUT, new GUIContent(" From Now", "If selected the game will warp forwards by the entered value. Otherwise the date and time will be set to the entered value.")); GUILayout.EndHorizontal(); if (_fromCurrentUT) {