From 4d5404bc6d0d72a03b1b29539632c224cb04ed50 Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Tue, 21 Feb 2023 19:07:24 -0600 Subject: [PATCH] Fix map mode sunlight and water sunlight --- NewHorizons/Builder/Body/WaterBuilder.cs | 5 ++++- NewHorizons/Components/Stars/SunLightEffectsController.cs | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Body/WaterBuilder.cs b/NewHorizons/Builder/Body/WaterBuilder.cs index 0d178a92..857358e5 100644 --- a/NewHorizons/Builder/Body/WaterBuilder.cs +++ b/NewHorizons/Builder/Body/WaterBuilder.cs @@ -47,10 +47,13 @@ namespace NewHorizons.Builder.Body GameObject waterGO = new GameObject("Water"); waterGO.SetActive(false); - waterGO.layer = 15; waterGO.transform.parent = sector?.transform ?? planetGO.transform; waterGO.transform.localScale = new Vector3(waterSize, waterSize, waterSize); + // Don't ignore sun when not under clouds + waterGO.layer = 0; + Delay.FireOnNextUpdate(() => { if (planetGO.FindChild("Sector/SunOverride") != null) waterGO.layer = 15; }); + TessellatedSphereRenderer TSR = waterGO.AddComponent(); TSR.tessellationMeshGroup = ScriptableObject.CreateInstance(); for (int i = 0; i < 16; i++) diff --git a/NewHorizons/Components/Stars/SunLightEffectsController.cs b/NewHorizons/Components/Stars/SunLightEffectsController.cs index c5260e54..3b1a8f1a 100644 --- a/NewHorizons/Components/Stars/SunLightEffectsController.cs +++ b/NewHorizons/Components/Stars/SunLightEffectsController.cs @@ -89,10 +89,12 @@ namespace NewHorizons.Components.Stars { origin = Locator.GetActiveCamera().transform.position; - // Keep all star lights on in map foreach (var light in _lights) { + // Keep all star lights on in map light.enabled = true; + // Fixes everything transparent breaking due to directional + if (light.type == LightType.Directional) light.type = LightType.Point; } } else @@ -110,6 +112,8 @@ namespace NewHorizons.Components.Stars { light.enabled = false; } + // Revert map fix + if (light.type == LightType.Point) light.type = LightType.Directional; } }