From 3339bddab24f6df666e3a7f93a0edd8ea6c09bb4 Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Tue, 8 Aug 2023 00:52:04 +0200 Subject: [PATCH 1/2] Move AltUnit class to a separate file --- .../MicroEngineer/Entries/BaseEntry.cs | 12 +----------- .../MicroEngineer/Utilities/AltUnit.cs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 MicroEngineerProject/MicroEngineer/Utilities/AltUnit.cs diff --git a/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs b/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs index 85f2151..2f71fb9 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs @@ -182,15 +182,5 @@ public virtual string UnitDisplay } public virtual void RefreshData() { } - } - - public class AltUnit - { - [JsonProperty] - public bool IsActive; - [JsonProperty] - public string Unit; - [JsonProperty] - public float Factor; - } + } } \ No newline at end of file diff --git a/MicroEngineerProject/MicroEngineer/Utilities/AltUnit.cs b/MicroEngineerProject/MicroEngineer/Utilities/AltUnit.cs new file mode 100644 index 0000000..a54d392 --- /dev/null +++ b/MicroEngineerProject/MicroEngineer/Utilities/AltUnit.cs @@ -0,0 +1,17 @@ +using Newtonsoft.Json; + +namespace MicroMod +{ + /// + /// An alternative unit, activated by double-clicking the entry + /// + public class AltUnit + { + [JsonProperty] + public bool IsActive; + [JsonProperty] + public string Unit; + [JsonProperty] + public float Factor; + } +} From ea554376be466885afecb2c00a54cfa52cc7e2f5 Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:41:00 +0200 Subject: [PATCH 2/2] Fix UniversalTime entries for KSP2 0.1.4 --- MicroEngineerProject/MicroEngineer.csproj | 4 ++-- MicroEngineerProject/MicroEngineer/Entries/ManeuverEntries.cs | 2 +- MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs | 3 ++- MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs | 2 +- MicroEngineerProject/MicroEngineer/Utilities/Utility.cs | 2 +- Staging/BepInEx/plugins/micro_engineer/swinfo.json | 4 ++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/MicroEngineerProject/MicroEngineer.csproj b/MicroEngineerProject/MicroEngineer.csproj index 5eae1eb..bf6669b 100644 --- a/MicroEngineerProject/MicroEngineer.csproj +++ b/MicroEngineerProject/MicroEngineer.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/MicroEngineerProject/MicroEngineer/Entries/ManeuverEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/ManeuverEntries.cs index a8dd85c..a97ff7e 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/ManeuverEntries.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/ManeuverEntries.cs @@ -133,7 +133,7 @@ public TimeToNode() public override void RefreshData() { List nodes = Utility.ActiveVessel?.SimulationObject?.FindComponent()?.GetNodes(); - EntryValue = nodes?.ElementAtOrDefault(base.SelectedNodeIndex)?.Time - GameManager.Instance.Game.UniverseModel.UniversalTime; + EntryValue = nodes?.ElementAtOrDefault(base.SelectedNodeIndex)?.Time - Utility.UniversalTime; } } diff --git a/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs index 0720d71..e9033d6 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs @@ -490,6 +490,7 @@ public SoiTransition() { Name = "SOI trans."; Description = "Shows the amount of time it will take to transition to another Sphere Of Influence."; + EntryType = EntryType.Time; Category = MicroEntryCategory.Orbital; IsDefault = false; BaseUnit = "s"; @@ -498,7 +499,7 @@ public SoiTransition() public override void RefreshData() { - EntryValue = Utility.ActiveVessel.Orbit.UniversalTimeAtSoiEncounter - GameManager.Instance.Game.UniverseModel.UniversalTime; + EntryValue = Utility.ActiveVessel.Orbit.UniversalTimeAtSoiEncounter - Utility.UniversalTime; } } } \ No newline at end of file diff --git a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs index 3b4d96d..20a256c 100644 --- a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs +++ b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs @@ -9,7 +9,7 @@ namespace MicroMod { - [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.3.0")] + [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.3.1")] [BepInDependency(SpaceWarpPlugin.ModGuid, SpaceWarpPlugin.ModVer)] public class MicroEngineerMod : BaseSpaceWarpPlugin { diff --git a/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs b/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs index 513e211..363edd7 100644 --- a/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs +++ b/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs @@ -23,7 +23,7 @@ public static class Utility public static GameStateConfiguration GameState; public static MessageCenter MessageCenter; public static VesselDeltaVComponent VesselDeltaVComponentOAB; - public static double UniversalTime => GameManager.Instance.Game.UniverseModel.UniversalTime; + public static double UniversalTime => GameManager.Instance.Game.UniverseModel.UniverseTime; /// /// Refreshes the ActiveVessel and CurrentManeuver diff --git a/Staging/BepInEx/plugins/micro_engineer/swinfo.json b/Staging/BepInEx/plugins/micro_engineer/swinfo.json index 5f1e493..89e7ca1 100644 --- a/Staging/BepInEx/plugins/micro_engineer/swinfo.json +++ b/Staging/BepInEx/plugins/micro_engineer/swinfo.json @@ -5,7 +5,7 @@ "name": "Micro Engineer", "description": "Get in-flight and VAB information about your current vessel", "source": "https://github.com/Micrologist/MicroEngineer", - "version": "1.3.0", + "version": "1.3.1", "version_check": "https://raw.githubusercontent.com/Micrologist/MicroEngineer/main/Staging/BepInEx/plugins/micro_engineer/swinfo.json", "dependencies": [ { @@ -24,7 +24,7 @@ } ], "ksp2_version": { - "min": "0.1.0", + "min": "0.1.4", "max": "*" } }