Also check if the planet is destroyed before trying to make the map mode object

This commit is contained in:
xen-42 2024-12-17 20:37:52 -05:00
parent 33b95fea83
commit 087e3d691e

View File

@ -50,7 +50,7 @@ namespace NewHorizons.Builder.ShipLog
Material greyScaleMaterial = SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/TimberHearth/Sprite").GetComponent<Image>().material; Material greyScaleMaterial = SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/TimberHearth/Sprite").GetComponent<Image>().material;
List<NewHorizonsBody> bodies = Main.BodyDict[systemName].Where( List<NewHorizonsBody> bodies = Main.BodyDict[systemName].Where(
b => !(b.Config.ShipLog?.mapMode?.remove ?? false) && !b.Config.isQuantumState b => !(b.Config.ShipLog?.mapMode?.remove ?? false) && !b.Config.isQuantumState && !b.Config.destroy
).ToList(); ).ToList();
bool flagManualPositionUsed = systemName == "SolarSystem"; bool flagManualPositionUsed = systemName == "SolarSystem";
bool flagAutoPositionUsed = false; bool flagAutoPositionUsed = false;
@ -157,6 +157,12 @@ namespace NewHorizons.Builder.ShipLog
private static ShipLogAstroObject AddShipLogAstroObject(GameObject gameObject, NewHorizonsBody body, Material greyScaleMaterial, int layer) private static ShipLogAstroObject AddShipLogAstroObject(GameObject gameObject, NewHorizonsBody body, Material greyScaleMaterial, int layer)
{ {
if (body.Object == null)
{
NHLogger.LogError($"Tried to make ship logs for planet with null Object: [{body?.Config?.name}]");
return null;
}
const float unviewedIconOffset = 15; const float unviewedIconOffset = 15;
NHLogger.LogVerbose($"Adding ship log astro object for {body.Config.name}"); NHLogger.LogVerbose($"Adding ship log astro object for {body.Config.name}");