From 43c3392466cf1e9a5e6512624382fc906e8bd5d7 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 22 Jul 2023 00:13:39 -0400 Subject: [PATCH] Set locator sun transform to the active sun --- NewHorizons/Components/Stars/SunLightEffectsController.cs | 3 +++ NewHorizons/Handlers/PlanetCreationHandler.cs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Components/Stars/SunLightEffectsController.cs b/NewHorizons/Components/Stars/SunLightEffectsController.cs index 22bde0f2..8c3798bf 100644 --- a/NewHorizons/Components/Stars/SunLightEffectsController.cs +++ b/NewHorizons/Components/Stars/SunLightEffectsController.cs @@ -192,6 +192,9 @@ namespace NewHorizons.Components.Stars // For the param thing to work it wants this to be on the star idk transform.parent = star.transform; transform.localPosition = Vector3.zero; + + // Some effects use Locator.GetSunTransform so hopefully its fine to change it + Locator._sunTransform = transform; } } } diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 983c8e98..38958aa2 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -644,7 +644,10 @@ namespace NewHorizons.Handlers if (!string.IsNullOrEmpty(body.Config.Atmosphere?.clouds?.texturePath)) { CloudsBuilder.Make(go, sector, body.Config.Atmosphere, willHaveCloak, body.Mod); - if (body.Config.Atmosphere.clouds.cloudsPrefab != External.Modules.CloudPrefabType.Transparent) SunOverrideBuilder.Make(go, sector, body.Config.Atmosphere, body.Config.Water, surfaceSize); + if (body.Config.Atmosphere.clouds.cloudsPrefab != External.Modules.CloudPrefabType.Transparent) + { + SunOverrideBuilder.Make(go, sector, body.Config.Atmosphere, body.Config.Water, surfaceSize); + } } if (body.Config.Atmosphere.hasRain || body.Config.Atmosphere.hasSnow)