From 19c5daaba62c82fc394930d346db144d2776899c Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 24 Jul 2022 21:11:14 -0700 Subject: [PATCH 1/6] make fog fix better --- NewHorizons/Patches/PlayerFogWarpDetectorPatches.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/NewHorizons/Patches/PlayerFogWarpDetectorPatches.cs b/NewHorizons/Patches/PlayerFogWarpDetectorPatches.cs index 852a5236..00348490 100644 --- a/NewHorizons/Patches/PlayerFogWarpDetectorPatches.cs +++ b/NewHorizons/Patches/PlayerFogWarpDetectorPatches.cs @@ -1,5 +1,4 @@ using HarmonyLib; -using UnityEngine; namespace NewHorizons.Patches { @@ -9,24 +8,22 @@ namespace NewHorizons.Patches // Morbius moment: they only let fog go away if there is a fog controller on the planet near you // However you can leave these volumes with fog on your screen, or have fog applied by a bramble node on a fogless planet - [HarmonyPrefix] + [HarmonyPostfix] [HarmonyPatch(typeof(PlayerFogWarpDetector), nameof(PlayerFogWarpDetector.LateUpdate))] - public static bool PlayerFogWarpDetector_LateUpdate(PlayerFogWarpDetector __instance) + public static void PlayerFogWarpDetector_LateUpdate(PlayerFogWarpDetector __instance) { if (PlanetaryFogController.GetActiveFogSphere() == null) { - float num = __instance._targetFogFraction; + __instance._fogFraction = 0; if (__instance._playerEffectBubbleController != null) { - __instance._playerEffectBubbleController.SetFogFade(0, __instance._fogColor); + __instance._playerEffectBubbleController.SetFogFade(__instance._fogFraction, __instance._fogColor); } if (__instance._shipLandingCamEffectBubbleController != null) { - __instance._shipLandingCamEffectBubbleController.SetFogFade(0, __instance._fogColor); + __instance._shipLandingCamEffectBubbleController.SetFogFade(__instance._fogFraction, __instance._fogColor); } - return false; } - return true; } } } From a119afcfce91c057c8597040f47464d0556a37d7 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 24 Jul 2022 21:32:42 -0700 Subject: [PATCH 2/6] check null fog man --- NewHorizons/Builder/Atmosphere/FogBuilder.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Atmosphere/FogBuilder.cs b/NewHorizons/Builder/Atmosphere/FogBuilder.cs index 4de64a9e..34d62f95 100644 --- a/NewHorizons/Builder/Atmosphere/FogBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/FogBuilder.cs @@ -44,9 +44,12 @@ namespace NewHorizons.Builder.Atmosphere var colorRampTexture = atmo.fogTint == null ? _ramp : ImageUtilities.TintImage(_ramp, atmo.fogTint.ToColor()); PFC.fogColorRampTexture = colorRampTexture; PFC.fogColorRampIntensity = 1f; - PFC.fogTint = atmo.fogTint.ToColor(); + if (atmo.fogTint != null) + { + PFC.fogTint = atmo.fogTint.ToColor(); - MR.material.SetColor(Tint, atmo.fogTint.ToColor()); + MR.material.SetColor(Tint, atmo.fogTint.ToColor()); + } MR.material.SetFloat(Radius, atmo.fogSize); MR.material.SetFloat(Density, atmo.fogDensity); MR.material.SetFloat(DensityExponent, 1); From 70a54f95880e3d5969074c9d8b55baa5e9e88890 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 25 Jul 2022 09:05:28 -0400 Subject: [PATCH 3/6] Fix the weird heightmap destroying bug --- NewHorizons/Builder/Body/Geometry/CubeSphere.cs | 3 ++- NewHorizons/Utility/CoordinateUtilities.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Body/Geometry/CubeSphere.cs b/NewHorizons/Builder/Body/Geometry/CubeSphere.cs index be055ece..0e417314 100644 --- a/NewHorizons/Builder/Body/Geometry/CubeSphere.cs +++ b/NewHorizons/Builder/Body/Geometry/CubeSphere.cs @@ -132,7 +132,8 @@ namespace NewHorizons.Builder.Body.Geometry float sampleX = heightMap.width * longitude / 360f; float sampleY = heightMap.height * latitude / 180f; - if (sampleX > heightMap.width) sampleX -= heightMap.width; // TODO: find out if this actually does anything + if (sampleX > heightMap.width) sampleX -= heightMap.width; + if (sampleX < 0) sampleX += heightMap.width; float relativeHeight = heightMap.GetPixel((int)sampleX, (int)sampleY).r; diff --git a/NewHorizons/Utility/CoordinateUtilities.cs b/NewHorizons/Utility/CoordinateUtilities.cs index 530e9a83..62d98eb9 100644 --- a/NewHorizons/Utility/CoordinateUtilities.cs +++ b/NewHorizons/Utility/CoordinateUtilities.cs @@ -28,7 +28,7 @@ namespace NewHorizons.Utility var longitude = Mathf.Rad2Deg * Mathf.Atan2(y, x); // phi - float latitude = (Mathf.Rad2Deg * Mathf.Acos(z / dist)); + float latitude = Mathf.Rad2Deg * Mathf.Acos(z / dist); return new Vector3(longitude, latitude, dist); } From 0a3876ecbda4f65397e7385064723d5c6c694af1 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 25 Jul 2022 09:10:55 -0400 Subject: [PATCH 4/6] Bump version number --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 4625e5f4..84ebc6f8 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, clay, MegaPiggy, John, Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.4.0", + "version": "1.4.1", "owmlVersion": "2.5.2", "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ], "pathsToPreserve": [ "planets", "systems", "translations" ] From 8a6a0041eddcc00480ea500deef388dfa72d28df Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 25 Jul 2022 09:11:38 -0400 Subject: [PATCH 5/6] Update manifest.json --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 4625e5f4..84ebc6f8 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, clay, MegaPiggy, John, Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.4.0", + "version": "1.4.1", "owmlVersion": "2.5.2", "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ], "pathsToPreserve": [ "planets", "systems", "translations" ] From 380884f57b5a11f82d11eb0d579e29a203d5cf40 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 25 Jul 2022 12:00:02 -0400 Subject: [PATCH 6/6] Update manifest.json --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 84ebc6f8..d81d1e22 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, clay, MegaPiggy, John, Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.4.1", + "version": "1.4.2", "owmlVersion": "2.5.2", "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ], "pathsToPreserve": [ "planets", "systems", "translations" ]