mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix the what bug again (#723)
## Bug fixes - Log an error when trying to orbit a body that doesn't have a gravity volume.
This commit is contained in:
commit
f082d2de81
@ -143,13 +143,15 @@ namespace NewHorizons.Builder.General
|
|||||||
// It's a planet
|
// It's a planet
|
||||||
if (binaryFocalPoint.Primary != null && binaryFocalPoint.Secondary != null)
|
if (binaryFocalPoint.Primary != null && binaryFocalPoint.Secondary != null)
|
||||||
{
|
{
|
||||||
forceDetector._detectableFields = new ForceVolume[] { parentGravityVolume };
|
if (!parentGravityVolume) NHLogger.LogError($"{astroObject?.name} trying to orbit {primaryBody?.name}, which has no gravity volume!");
|
||||||
|
forceDetector._detectableFields = parentGravityVolume ? new ForceVolume[] { parentGravityVolume } : new ForceVolume[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forceDetector._detectableFields = new ForceVolume[] { parentGravityVolume };
|
if (!parentGravityVolume) NHLogger.LogError($"{astroObject?.name} trying to orbit {primaryBody?.name}, which has no gravity volume!");
|
||||||
|
forceDetector._detectableFields = parentGravityVolume ? new ForceVolume[] { parentGravityVolume } : new ForceVolume[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +166,7 @@ namespace NewHorizons.Builder.General
|
|||||||
var primaryGV = primary.GetGravityVolume();
|
var primaryGV = primary.GetGravityVolume();
|
||||||
var secondaryGV = secondary.GetGravityVolume();
|
var secondaryGV = secondary.GetGravityVolume();
|
||||||
|
|
||||||
if (primaryGV._falloffType != secondaryGV._falloffType)
|
if (primaryGV && secondaryGV && primaryGV._falloffType != secondaryGV._falloffType)
|
||||||
{
|
{
|
||||||
NHLogger.LogError($"Binaries must have the same gravity falloff! {primaryGV._falloffType} != {secondaryGV._falloffType}");
|
NHLogger.LogError($"Binaries must have the same gravity falloff! {primaryGV._falloffType} != {secondaryGV._falloffType}");
|
||||||
return;
|
return;
|
||||||
@ -173,12 +175,14 @@ namespace NewHorizons.Builder.General
|
|||||||
var pointForceDetector = point.GetAttachedOWRigidbody().GetAttachedForceDetector();
|
var pointForceDetector = point.GetAttachedOWRigidbody().GetAttachedForceDetector();
|
||||||
|
|
||||||
// Set detectable fields
|
// Set detectable fields
|
||||||
primaryCFD._detectableFields = new ForceVolume[] { secondaryGV };
|
if (!secondaryGV) NHLogger.LogError($"{point.PrimaryName} trying to orbit {point.SecondaryName}, which has no gravity volume!");
|
||||||
|
primaryCFD._detectableFields = secondaryGV ? new ForceVolume[] { secondaryGV } : new ForceVolume[0];
|
||||||
primaryCFD._inheritDetector = pointForceDetector;
|
primaryCFD._inheritDetector = pointForceDetector;
|
||||||
primaryCFD._activeInheritedDetector = pointForceDetector;
|
primaryCFD._activeInheritedDetector = pointForceDetector;
|
||||||
primaryCFD._inheritElement0 = false;
|
primaryCFD._inheritElement0 = false;
|
||||||
|
|
||||||
secondaryCFD._detectableFields = new ForceVolume[] { primaryGV };
|
if (!primaryGV) NHLogger.LogError($"{point.SecondaryName} trying to orbit {point.PrimaryName}, which has no gravity volume!");
|
||||||
|
secondaryCFD._detectableFields = primaryGV ? new ForceVolume[] { primaryGV } : new ForceVolume[0];
|
||||||
secondaryCFD._inheritDetector = pointForceDetector;
|
secondaryCFD._inheritDetector = pointForceDetector;
|
||||||
secondaryCFD._activeInheritedDetector = pointForceDetector;
|
secondaryCFD._activeInheritedDetector = pointForceDetector;
|
||||||
secondaryCFD._inheritElement0 = false;
|
secondaryCFD._inheritElement0 = false;
|
||||||
|
|||||||
@ -382,8 +382,9 @@ namespace NewHorizons.Builder.Props
|
|||||||
else if (component is NomaiInterfaceOrb orb)
|
else if (component is NomaiInterfaceOrb orb)
|
||||||
{
|
{
|
||||||
// detect planet gravity
|
// detect planet gravity
|
||||||
|
// somehow Intervention has GetAttachedOWRigidbody as null sometimes, idk why
|
||||||
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[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (component is VisionTorchItem torchItem)
|
else if (component is VisionTorchItem torchItem)
|
||||||
|
|||||||
@ -137,7 +137,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
orbBody._lastVelocity = velocity;
|
orbBody._lastVelocity = velocity;
|
||||||
orbBody._currentVelocity = velocity;
|
orbBody._currentVelocity = velocity;
|
||||||
|
|
||||||
orb.GetComponent<ConstantForceDetector>()._detectableFields = new ForceVolume[] { planetGO.GetComponentInChildren<GravityVolume>() };
|
// detect planet gravity
|
||||||
|
// somehow Intervention has GetAttachedOWRigidbody as null sometimes, idk why
|
||||||
|
var gravityVolume = planetGO.GetAttachedOWRigidbody()?.GetAttachedGravityVolume();
|
||||||
|
orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[0];
|
||||||
|
|
||||||
Delay.RunWhenAndInNUpdates(() =>
|
Delay.RunWhenAndInNUpdates(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,9 +15,8 @@
|
|||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HarmonyX" Version="2.10.1" />
|
|
||||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.457" />
|
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.457" />
|
||||||
<PackageReference Include="OWML" Version="2.9.3" />
|
<PackageReference Include="OWML" Version="2.9.7" />
|
||||||
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
|
|
||||||
namespace NewHorizons.Patches.PlayerPatches
|
namespace NewHorizons.Patches.DetectorPatches
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(HazardDetector))]
|
[HarmonyPatch(typeof(HazardDetector))]
|
||||||
public static class PlayerHazardDetectorPatches
|
public static class PlayerHazardDetectorPatches
|
||||||
@ -4,8 +4,8 @@
|
|||||||
"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.16.3",
|
"version": "1.16.4",
|
||||||
"owmlVersion": "2.9.3",
|
"owmlVersion": "2.9.7",
|
||||||
"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" ],
|
||||||
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user