diff --git a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs index 30580fc..92c080f 100644 --- a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs +++ b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs @@ -19,14 +19,15 @@ public class MicroEngineerMod : BaseSpaceWarpPlugin public override void OnInitialized() { Instance = this; + GUID = Info.Metadata.GUID; + + BackwardCompatibilityInitializations(); Styles.Initialize(); MessageManager.Instance.SubscribeToMessages(); - BackwardCompatibilityInitializations(); - // Register Flight and OAB buttons Appbar.RegisterAppButton( "Micro Engineer", @@ -47,22 +48,22 @@ public override void OnInitialized() { UI.Instance.ShowGuiOAB = isOpen; Manager.Instance.Windows.FindAll(w => w is EntryWindow).Cast().ToList().Find(w => w.MainWindow == MainWindow.StageInfoOAB).IsEditorActive = isOpen; - GameObject.Find("BTN - MicroEngineerOAB")?.GetComponent()?.SetValue(isOpen); + GameObject.Find("BTN-MicroEngineerOAB")?.GetComponent()?.SetValue(isOpen); }); } private void BackwardCompatibilityInitializations() { - // Preserve backward compatibility with SpaceWarp 1.0.1 - if (Utility.IsModOlderThan("SpaceWarp", 1, 1, 0)) + // Preserve backward compatibility with SpaceWarp 1.1.x + if (Utility.IsModOlderThan("SpaceWarp", 1, 2, 0)) { - Logger.LogInfo("Space Warp older version detected. Loading old Styles."); - Styles.SetStylesForOldSpaceWarpSkin(); + Logger.LogInfo("Older Space Warp version detected. Setting mod GUID to \"micro_engineer\"."); + GUID = "micro_engineer"; } else - Logger.LogInfo("Space Warp new version detected. Loading new Styles."); + Logger.LogInfo("New Space Warp version detected. No backward compatibility needed."); } - + public void Update() { Manager.Instance.Update(); diff --git a/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs b/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs index 7a7cdb2..2a76bf9 100644 --- a/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs +++ b/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs @@ -288,7 +288,7 @@ internal static (int major, int minor, int patch)? GetModVersion(string modId) if (versionNumbers.Length == 3) int.TryParse(versionNumbers[2], out patchVersion); - Logger.LogInfo($"Space Warp version {majorVersion}.{minorVersion}.{patchVersion} detected."); + Logger.LogInfo($"{modId} version {majorVersion}.{minorVersion}.{patchVersion} detected."); return (majorVersion, minorVersion, patchVersion); } diff --git a/Staging/BepInEx/plugins/micro_engineer/swinfo.json b/Staging/BepInEx/plugins/micro_engineer/swinfo.json index 3940bd7..4c1b58f 100644 --- a/Staging/BepInEx/plugins/micro_engineer/swinfo.json +++ b/Staging/BepInEx/plugins/micro_engineer/swinfo.json @@ -1,16 +1,17 @@ { + "spec": "1.2", "mod_id": "micro_engineer", "author": "Micrologist, Falki", "name": "Micro Engineer", "description": "Get in-flight and VAB information about your current vessel", "source": "https://github.com/Micrologist/MicroEngineer", - "version": "1.0.3", + "version": "1.1.0", "version_check": "https://raw.githubusercontent.com/Micrologist/MicroEngineer/main/Staging/BepInEx/plugins/micro_engineer/swinfo.json", "dependencies": [ { "id": "SpaceWarp", "version": { - "min": "1.0.1", + "min": "1.1.0", "max": "*" } }