|
13 | 13 | using KSP.Sim; |
14 | 14 | using KSP.UI.Flight; |
15 | 15 | using static KSP.Rendering.Planets.PQSData; |
16 | | -using static VehiclePhysics.EnergyProvider; |
17 | | -using KSP.Modding; |
18 | 16 |
|
19 | 17 | namespace MicroMod |
20 | 18 | { |
@@ -436,6 +434,8 @@ private void FillSurface(int _ = 0) |
436 | 434 | DrawSectionHeader("Surface", ref popoutSur, activeVessel.mainBody.bodyName); |
437 | 435 |
|
438 | 436 | DrawEntry("Situation", SituationToString(activeVessel.Situation)); |
| 437 | + DrawEntry("Latitude", $"{DegreesToDMS(activeVessel.Latitude)}", activeVessel.Latitude < 0 ? "S" : "N"); |
| 438 | + DrawEntry("Longitude", $"{DegreesToDMS(activeVessel.Longitude)}", activeVessel.Longitude < 0 ? "W" : "E"); |
439 | 439 | DrawEntry("Biome", BiomeToString(activeVessel.SimulationObject.Telemetry.SurfaceBiome)); |
440 | 440 | DrawEntry("Alt. MSL", MetersToDistanceString(activeVessel.AltitudeFromSeaLevel), "m"); |
441 | 441 | DrawEntry("Alt. AGL", MetersToDistanceString(activeVessel.AltitudeFromScenery), "m"); |
@@ -687,6 +687,18 @@ private string BiomeToString(BiomeSurfaceData biome) |
687 | 687 | return result.Substring(0, 1).ToUpper() + result.Substring(1); |
688 | 688 | } |
689 | 689 |
|
| 690 | + private string DegreesToDMS(double degreeD) |
| 691 | + { |
| 692 | + var ts = TimeSpan.FromHours(Math.Abs(degreeD)); |
| 693 | + int degrees = (int)Math.Floor(ts.TotalHours); |
| 694 | + int minutes = ts.Minutes; |
| 695 | + int seconds = ts.Seconds; |
| 696 | + |
| 697 | + string result = $"{degrees:N0}<color={unitColorHex}>°</color> {minutes:00}<color={unitColorHex}>'</color> {seconds:00}<color={unitColorHex}>\"</color>"; |
| 698 | + |
| 699 | + return result; |
| 700 | + } |
| 701 | + |
690 | 702 | private void CloseWindow() |
691 | 703 | { |
692 | 704 | GameObject.Find("BTN-MicroEngineerBtn")?.GetComponent<UIValue_WriteBool_Toggle>()?.SetValue(false); |
|
0 commit comments