From 563370119a1810a3498a3b9ec0abbb5d19e2b19f Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 7 Feb 2024 11:19:22 -0500 Subject: [PATCH 1/3] Requires DLC check was NREing --- NewHorizons/External/NewHorizonBody.cs | 19 ++++++++++++++----- NewHorizons/manifest.json | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/NewHorizons/External/NewHorizonBody.cs b/NewHorizons/External/NewHorizonBody.cs index 6fe60823..6779e526 100644 --- a/NewHorizons/External/NewHorizonBody.cs +++ b/NewHorizons/External/NewHorizonBody.cs @@ -28,11 +28,20 @@ namespace NewHorizons.External public bool RequiresDLC() { - var detailPaths = Config.Props.details.Select(x => x.path); - return Config.Cloak != null - || Config.Props?.rafts != null - || Config.Props?.slideShows != null - || detailPaths.Any(x => x.StartsWith("RingWorld_Body") || x.StartsWith("DreamWorld_Body")); + try + { + var detailPaths = Config?.Props?.details?.Select(x => x.path) ?? Array.Empty(); + return Config?.Cloak != null + || Config?.Props?.rafts != null + || Config?.Props?.slideShows != null + || detailPaths.Any(x => x.StartsWith("RingWorld_Body") || x.StartsWith("DreamWorld_Body")); + } + catch + { + NHLogger.LogWarning($"Failed to check if {Mod.ModHelper.Manifest.Name} requires the DLC"); + return false; + } + } #region Cache diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index c7f6ccf1..ec47461c 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.18.5", + "version": "1.18.6", "owmlVersion": "2.9.8", "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ], From 804ef01808a37612b8805b1dbc313a85d931f818 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 7 Feb 2024 11:29:00 -0500 Subject: [PATCH 2/3] Log error if addon manifest couldn't load (improper formatting) --- NewHorizons/Main.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index ee07514f..551297d2 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -735,6 +735,12 @@ namespace NewHorizons var addonConfig = mod.ModHelper.Storage.Load(file, false); + if (addonConfig == null) + { + NHLogger.LogError($"Addon manifest for {mod.ModHelper.Manifest.Name} could not load, check your JSON"); + return; + } + if (addonConfig.achievements != null) { AchievementHandler.RegisterAddon(addonConfig, mod as ModBehaviour); From e5c8ed9255565f5d1741939feea8642d2777112f Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 7 Feb 2024 11:33:20 -0500 Subject: [PATCH 3/3] If the EntitlementsManager isn't ready default to owning it --- NewHorizons/Main.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 551297d2..c65ad1be 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -110,7 +110,12 @@ namespace NewHorizons public StarSystemEvent OnStarSystemLoaded = new(); public StarSystemEvent OnPlanetLoaded = new(); - public static bool HasDLC { get => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned; } + /// + /// Depending on platform, the AsyncOwnershipStatus might not be ready by the time we go to check it. + /// If that happens, I guess we just have to assume they do own the DLC. + /// Better to false positive than false negative and annoy people every time they launch the game when they do own the DLC + /// + public static bool HasDLC { get => EntitlementsManager.IsDlcOwned() != EntitlementsManager.AsyncOwnershipStatus.NotOwned; } public static StarSystemConfig GetCurrentSystemConfig => SystemDict[Instance.CurrentStarSystem].Config;