diff --git a/NewHorizons/Assets/DefaultMapModeStar.png b/NewHorizons/Assets/DefaultMapModeStar.png index 7bc0ac1b..bdcedc5b 100644 Binary files a/NewHorizons/Assets/DefaultMapModeStar.png and b/NewHorizons/Assets/DefaultMapModeStar.png differ diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index 15e34490..60e0e879 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -148,6 +148,7 @@ namespace NewHorizons.Builder.ShipLog astroObject._imageObj = CreateImage(gameObject, image, body.Config.name + " Revealed", layer); astroObject._outlineObj = CreateImage(gameObject, outline, body.Config.name + " Outline", layer); + if (ShipLogHandler.BodyHasEntries(body)) { Image revealedImage = astroObject._imageObj.GetComponent(); @@ -162,6 +163,12 @@ namespace NewHorizons.Builder.ShipLog Rect imageRect = astroObject._imageObj.GetComponent().rect; astroObject._unviewedObj.transform.localPosition = new Vector3(imageRect.width / 2 + unviewedIconOffset, imageRect.height / 2 + unviewedIconOffset, 0); + + // Set all icons inactive, they will be conditionally activated when the map mode is opened for the first time + astroObject._unviewedObj.SetActive(false); + astroObject._imageObj.SetActive(false); + astroObject._outlineObj.SetActive(false); + return astroObject; } #endregion diff --git a/NewHorizons/Patches/ShipLogPatches/ShipLogAstroObjectPatches.cs b/NewHorizons/Patches/ShipLogPatches/ShipLogAstroObjectPatches.cs index ba3c0e33..abfc67a8 100644 --- a/NewHorizons/Patches/ShipLogPatches/ShipLogAstroObjectPatches.cs +++ b/NewHorizons/Patches/ShipLogPatches/ShipLogAstroObjectPatches.cs @@ -25,9 +25,32 @@ namespace NewHorizons.Patches.ShipLogPatches } } + [HarmonyPrefix] + [HarmonyPatch(nameof(ShipLogAstroObject.UpdateState))] + public static bool ShipLogAstroObject_UpdateState_Pre(ShipLogAstroObject __instance) + { + // Custom astro objects might have no entries, in this case they will be permanently hidden + // Just treat it as if it were revealed + if (__instance._entries.Count == 0) + { + __instance._state = ShipLogEntry.State.Explored; + __instance._imageObj.SetActive(true); + __instance._outlineObj?.SetActive(false); + if (__instance._image != null) + { + __instance.SetMaterialGreyscale(false); + __instance._image.color = Color.white; + } + + return false; + } + + return true; + } + [HarmonyPostfix] [HarmonyPatch(nameof(ShipLogAstroObject.UpdateState))] - public static void ShipLogAstroObject_UpdateState(ShipLogAstroObject __instance) + public static void ShipLogAstroObject_UpdateState_Post(ShipLogAstroObject __instance) { Transform detailsParent = __instance.transform.Find("Details"); if (detailsParent != null)