From 7ca82f55468eefb16b8d6fd5887caa6e031ab634 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 20 Mar 2024 17:33:04 -0400 Subject: [PATCH 1/3] Fix HN map mode --- NewHorizons/Builder/ShipLog/MapModeBuilder.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index a36c6003..1ae836fa 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -30,7 +30,7 @@ namespace NewHorizons.Builder.ShipLog { if (body.Config.ShipLog == null) continue; - if (body.Config.ShipLog?.mapMode?.manualPosition == null) + if (body.Config.ShipLog?.mapMode != null && body.Config.ShipLog.mapMode.manualPosition == null) { flagAutoPositionUsed = true; } @@ -45,6 +45,12 @@ namespace NewHorizons.Builder.ShipLog } } + // If they're both false, just default to auto (this means that no planets even have ship log info) + if (!flagManualPositionUsed && !flagAutoPositionUsed) + { + flagAutoPositionUsed = true; + } + var isBaseSolarSystem = systemName == "SolarSystem"; // Default to MANUAL in Base Solar System (we can't automatically fix them so it might just break, but AUTO breaks even more!) From 03620d80b6023f65c67b9047f66a7745be39d5b5 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 20 Mar 2024 18:05:40 -0400 Subject: [PATCH 2/3] Make ship log null --- NewHorizons/Builder/ShipLog/MapModeBuilder.cs | 2 +- NewHorizons/External/Configs/PlanetConfig.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index 1ae836fa..15e34490 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -30,7 +30,7 @@ namespace NewHorizons.Builder.ShipLog { if (body.Config.ShipLog == null) continue; - if (body.Config.ShipLog?.mapMode != null && body.Config.ShipLog.mapMode.manualPosition == null) + if (body.Config.ShipLog.mapMode?.manualPosition == null) { flagAutoPositionUsed = true; } diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index 40a9f7f5..f29c511a 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -213,7 +213,6 @@ namespace NewHorizons.External.Configs // Always have to have a base module if (Base == null) Base = new BaseModule(); if (Orbit == null) Orbit = new OrbitModule(); - if (ShipLog == null) ShipLog = new ShipLogModule(); if (ReferenceFrame == null) ReferenceFrame = new ReferenceFrameModule(); } From a6e171682698e83aab7bcadf43b3fb19420ef883 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 21 Mar 2024 18:29:51 -0400 Subject: [PATCH 3/3] Fix subtitles size being 0 when width is smaller than original I noticed this on Hearth's Neighbor --- NewHorizons/Handlers/SubtitlesHandler.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/NewHorizons/Handlers/SubtitlesHandler.cs b/NewHorizons/Handlers/SubtitlesHandler.cs index 7207a8a5..d3fe3fb8 100644 --- a/NewHorizons/Handlers/SubtitlesHandler.cs +++ b/NewHorizons/Handlers/SubtitlesHandler.cs @@ -11,8 +11,8 @@ namespace NewHorizons.Handlers { class SubtitlesHandler : MonoBehaviour { - public static int SUBTITLE_HEIGHT = 97; - public static int SUBTITLE_WIDTH = 669; // nice + public static float SUBTITLE_HEIGHT = 97; + public static float SUBTITLE_WIDTH = 669; // nice public float fadeSpeed = 0.005f; public float fade = 1; @@ -45,7 +45,7 @@ namespace NewHorizons.Handlers if (eoteSprite != null) { // Don't make it appear first actually because we have mods to display! - possibleSubtitles.Add(eoteSprite); + possibleSubtitles.Add(eoteSprite); } eoteSubtitleHasBeenInserted = true; } @@ -67,7 +67,7 @@ namespace NewHorizons.Handlers CheckForEOTE(); // We add our subtitles as a child object so that their sizing doesnt shift the layout of the main menu - _subtitleDisplay = new GameObject().AddComponent(); + _subtitleDisplay = new GameObject("SubtitleDisplay").AddComponent(); _subtitleDisplay.transform.parent = transform; _subtitleDisplay.transform.localPosition = new Vector3(0, 0, 0); _subtitleDisplay.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); @@ -173,9 +173,12 @@ namespace NewHorizons.Handlers { subtitleIndex = (subtitleIndex + 1) % possibleSubtitles.Count; - _subtitleDisplay.sprite = possibleSubtitles[subtitleIndex]; - var ratio = SUBTITLE_WIDTH / _subtitleDisplay.sprite.texture.width; - _subtitleDisplay.rectTransform.sizeDelta = new Vector2(_subtitleDisplay.sprite.texture.width, _subtitleDisplay.sprite.texture.height) * ratio; + var subtitle = possibleSubtitles[subtitleIndex]; + _subtitleDisplay.sprite = subtitle; + var width = subtitle.texture.width; + var height = subtitle.texture.height; + var ratio = SUBTITLE_WIDTH / width; // one of these needs to be a float so that compiler doesn't think "oh 2 integers! let's round to nearest whole" + _subtitleDisplay.rectTransform.sizeDelta = new Vector2(width, height) * ratio; } } }