From b0eac14fe3403fc5bbec25f81e94e5bee4436d99 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 24 Aug 2023 12:20:10 -0400 Subject: [PATCH 1/2] Fix issues in Intervention (null vessel blackhole, missing null check in detail orb fix) --- NewHorizons/Builder/Props/DetailBuilder.cs | 2 +- .../WarpPatches/VesselWarpControllerPatches.cs | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index eeef8d1b..6d4e634e 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -374,7 +374,7 @@ namespace NewHorizons.Builder.Props else if (component is NomaiInterfaceOrb orb) { // detect planet gravity - var gravityVolume = planetGO.GetAttachedOWRigidbody().GetAttachedGravityVolume(); + var gravityVolume = planetGO.GetAttachedOWRigidbody()?.GetAttachedGravityVolume(); orb.GetComponent()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[] { }; } diff --git a/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs b/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs index 4676edd4..8089ac89 100644 --- a/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs +++ b/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs @@ -29,12 +29,22 @@ namespace NewHorizons.Patches.WarpPatches [HarmonyPatch(nameof(VesselWarpController.CheckSystemActivation))] public static void VesselWarpController_CheckSystemActivation(VesselWarpController __instance) { - if (Locator.GetEyeStateManager() == null && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse") + // Base method only manages the state of the source warp platform blackhole if the EyeStateManager isn't null + // However we place the vessel into other systems, so we want to handle the state in those locations as well + // For some reason the blackhole can also just be null in which case we ignore all this. Happens in Intervention 1.0.3 + if (Locator.GetEyeStateManager() == null && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse" && __instance._sourceWarpPlatform._blackHole != null) { - if (!__instance._sourceWarpPlatform.IsBlackHoleOpen() && __instance._hasPower && __instance._warpPlatformPowerSlot.IsActivated() && __instance._targetWarpPlatform != null) - __instance._sourceWarpPlatform.OpenBlackHole(__instance._targetWarpPlatform, true); - else if (__instance._sourceWarpPlatform.IsBlackHoleOpen() && (!__instance._hasPower || !__instance._warpPlatformPowerSlot.IsActivated())) + var isBlackHoleOpen = __instance._sourceWarpPlatform.IsBlackHoleOpen(); + var shouldBlackHoleBeOpen = __instance._hasPower && __instance._warpPlatformPowerSlot.IsActivated() && __instance._targetWarpPlatform != null; + + if (isBlackHoleOpen && !shouldBlackHoleBeOpen) + { __instance._sourceWarpPlatform.CloseBlackHole(); + } + else if (!isBlackHoleOpen && shouldBlackHoleBeOpen) + { + __instance._sourceWarpPlatform.OpenBlackHole(__instance._targetWarpPlatform, true); + } } } From 0c727fe7ea2cc49da531625eac9c712718f6c2bd Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 24 Aug 2023 12:20:38 -0400 Subject: [PATCH 2/2] Update manifest.json --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 762b1c52..38deebd8 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.14.6", + "version": "1.14.7", "owmlVersion": "2.9.3", "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],