From 3e23e433f792a2b8349e0037e56f0574b876e27b Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 24 Aug 2023 12:35:32 -0400 Subject: [PATCH] Fix up comments --- .../Stars/SunLightEffectsController.cs | 2 +- .../Volumes/WaterCloakFixerVolume.cs | 18 +++++++++++++++--- NewHorizons/Handlers/PlayerSpawnHandler.cs | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Components/Stars/SunLightEffectsController.cs b/NewHorizons/Components/Stars/SunLightEffectsController.cs index fe6c3741..b4c42d03 100644 --- a/NewHorizons/Components/Stars/SunLightEffectsController.cs +++ b/NewHorizons/Components/Stars/SunLightEffectsController.cs @@ -201,7 +201,7 @@ namespace NewHorizons.Components.Stars transform.localPosition = Vector3.zero; // Some effects use Locator.GetSunTransform so hopefully its fine to change it - // Use the root transform of the star because that's the default behaviour, breaks SunProxy is not (potentially others) + // Use the root transform of the star because that's the default behaviour, breaks SunProxy if not (potentially others) Locator._sunTransform = star.transform; // TODO?: maybe also turn off star controller stuff (mainly proxy light) since idk if that can handle more than 1 being on diff --git a/NewHorizons/Components/Volumes/WaterCloakFixerVolume.cs b/NewHorizons/Components/Volumes/WaterCloakFixerVolume.cs index 06cbb8c9..d74aaa89 100644 --- a/NewHorizons/Components/Volumes/WaterCloakFixerVolume.cs +++ b/NewHorizons/Components/Volumes/WaterCloakFixerVolume.cs @@ -2,11 +2,23 @@ using UnityEngine; namespace NewHorizons.Components.Volumes { + /// + /// A cloak can interfere with the rendering of water + /// Water has a lower render queue and is transparent, so you can see the background black cloak over top of the water + /// We fix this by setting the water's render queue to that of the cloak + /// However, this means that when you are inside the water you will see through the cloak since it's not rendered on top + /// To fix that, we set the render queue back to normal when the player enters the water + /// Currently this doesnt nothing to fix probe camera pictures. If you are outside of the water, the probe will see the stars and through the cloak + /// Oh well + /// internal class WaterCloakFixerVolume : MonoBehaviour { public Material material; private OWTriggerVolume _volume; + public const int WATER_RENDER_QUEUE = 2990; + public const int CLOAK_RENDER_QUEUE = 3000; + public void Start() { _volume = GetComponent().GetOWTriggerVolume(); @@ -14,7 +26,7 @@ namespace NewHorizons.Components.Volumes _volume.OnEntry += WaterCloakFixerVolume_OnEntry; _volume.OnExit += WaterCloakFixerVolume_OnExit; - material.renderQueue = 3000; + material.renderQueue = CLOAK_RENDER_QUEUE; } public void OnDestroy() @@ -27,7 +39,7 @@ namespace NewHorizons.Components.Volumes { if (hitObj.CompareTag("PlayerDetector")) { - material.renderQueue = 2990; + material.renderQueue = WATER_RENDER_QUEUE; } } @@ -35,7 +47,7 @@ namespace NewHorizons.Components.Volumes { if (hitObj.CompareTag("PlayerDetector")) { - material.renderQueue = 3000; + material.renderQueue = CLOAK_RENDER_QUEUE; } } } diff --git a/NewHorizons/Handlers/PlayerSpawnHandler.cs b/NewHorizons/Handlers/PlayerSpawnHandler.cs index d81a3cd6..083eff3b 100644 --- a/NewHorizons/Handlers/PlayerSpawnHandler.cs +++ b/NewHorizons/Handlers/PlayerSpawnHandler.cs @@ -48,7 +48,7 @@ namespace NewHorizons.Handlers var cloak = GetDefaultSpawn()?.GetAttachedOWRigidbody()?.GetComponentInChildren(); if (cloak != null) { - // Ensures it has invoked everything and actually placed the player in the cloaking field + // Ensures it has invoked everything and actually placed the player in the cloaking field #671 cloak._firstUpdate = true; } }