This commit is contained in:
Nick 2023-08-24 12:27:07 -04:00
commit 845c788655
3 changed files with 16 additions and 6 deletions

View File

@ -382,7 +382,7 @@ namespace NewHorizons.Builder.Props
else if (component is NomaiInterfaceOrb orb) else if (component is NomaiInterfaceOrb orb)
{ {
// detect planet gravity // detect planet gravity
var gravityVolume = planetGO.GetAttachedOWRigidbody().GetAttachedGravityVolume(); var gravityVolume = planetGO.GetAttachedOWRigidbody()?.GetAttachedGravityVolume();
orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[] { }; orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[] { };
} }

View File

@ -29,13 +29,23 @@ namespace NewHorizons.Patches.WarpPatches
[HarmonyPatch(nameof(VesselWarpController.CheckSystemActivation))] [HarmonyPatch(nameof(VesselWarpController.CheckSystemActivation))]
public static void VesselWarpController_CheckSystemActivation(VesselWarpController __instance) 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)
{
var isBlackHoleOpen = __instance._sourceWarpPlatform.IsBlackHoleOpen();
var shouldBlackHoleBeOpen = __instance._hasPower && __instance._warpPlatformPowerSlot.IsActivated() && __instance._targetWarpPlatform != null;
if (isBlackHoleOpen && !shouldBlackHoleBeOpen)
{ {
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()))
__instance._sourceWarpPlatform.CloseBlackHole(); __instance._sourceWarpPlatform.CloseBlackHole();
} }
else if (!isBlackHoleOpen && shouldBlackHoleBeOpen)
{
__instance._sourceWarpPlatform.OpenBlackHole(__instance._targetWarpPlatform, true);
}
}
} }
[HarmonyPrefix] [HarmonyPrefix]

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book", "author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "1.14.6", "version": "1.14.7",
"owmlVersion": "2.9.3", "owmlVersion": "2.9.3",
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],