mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix issues in Intervention (null vessel blackhole, missing null check in detail orb fix)
This commit is contained in:
parent
f1292cbfe9
commit
b0eac14fe3
@ -374,7 +374,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[] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,12 +29,22 @@ 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)
|
||||||
{
|
{
|
||||||
if (!__instance._sourceWarpPlatform.IsBlackHoleOpen() && __instance._hasPower && __instance._warpPlatformPowerSlot.IsActivated() && __instance._targetWarpPlatform != null)
|
var isBlackHoleOpen = __instance._sourceWarpPlatform.IsBlackHoleOpen();
|
||||||
__instance._sourceWarpPlatform.OpenBlackHole(__instance._targetWarpPlatform, true);
|
var shouldBlackHoleBeOpen = __instance._hasPower && __instance._warpPlatformPowerSlot.IsActivated() && __instance._targetWarpPlatform != null;
|
||||||
else if (__instance._sourceWarpPlatform.IsBlackHoleOpen() && (!__instance._hasPower || !__instance._warpPlatformPowerSlot.IsActivated()))
|
|
||||||
|
if (isBlackHoleOpen && !shouldBlackHoleBeOpen)
|
||||||
|
{
|
||||||
__instance._sourceWarpPlatform.CloseBlackHole();
|
__instance._sourceWarpPlatform.CloseBlackHole();
|
||||||
|
}
|
||||||
|
else if (!isBlackHoleOpen && shouldBlackHoleBeOpen)
|
||||||
|
{
|
||||||
|
__instance._sourceWarpPlatform.OpenBlackHole(__instance._targetWarpPlatform, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user