Fix map mode sunlight and water sunlight

This commit is contained in:
TerrificTrifid 2023-02-21 19:07:24 -06:00
parent b325f87f5f
commit 4d5404bc6d
2 changed files with 9 additions and 2 deletions

View File

@ -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<TessellatedSphereRenderer>();
TSR.tessellationMeshGroup = ScriptableObject.CreateInstance<MeshGroup>();
for (int i = 0; i < 16; i++)

View File

@ -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;
}
}