From 6b27384a4149ecd8c7e6cc35b99bc62fd2c56577 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 21 Jul 2023 22:28:10 -0400 Subject: [PATCH] Fix supernova proxy rendering when it shouldnt --- NewHorizons/Components/NHProxy.cs | 1 + .../SizeControllers/StarEvolutionController.cs | 14 ++++++++++++-- .../Components/Stars/StellarDeathController.cs | 5 ++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Components/NHProxy.cs b/NewHorizons/Components/NHProxy.cs index 9aabe150..16eab817 100644 --- a/NewHorizons/Components/NHProxy.cs +++ b/NewHorizons/Components/NHProxy.cs @@ -5,6 +5,7 @@ using NewHorizons.Utility.OuterWilds; using System.Collections.Generic; using System.Linq; using UnityEngine; + namespace NewHorizons.Components { public class NHProxy : ProxyPlanet diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 5550daa4..f67bc42f 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -364,7 +364,10 @@ namespace NewHorizons.Components.SizeControllers _surface._materials[0].CopyPropertiesFromMaterial(_collapseStartSurfaceMaterial); if (oneShotSource != null && !PlayerState.IsSleepingAtCampfire() && !PlayerState.InDreamWorld()) oneShotSource.PlayOneShot(AudioType.Sun_Collapse); - if (_proxy != null) _proxy.StartCollapse(); + if (_proxy != null) + { + _proxy.StartCollapse(); + } } public void StopCollapse() @@ -396,7 +399,14 @@ namespace NewHorizons.Components.SizeControllers if (planetDestructionVolume != null) planetDestructionVolume._deathType = DeathType.Supernova; if (oneShotSource != null && !PlayerState.IsSleepingAtCampfire() && !PlayerState.InDreamWorld()) oneShotSource.PlayOneShot(AudioType.Sun_Explosion); - if (_proxy != null) _proxy.StartSupernova(); + if (_proxy != null) + { + _proxy.StartSupernova(); + + // When the supernova starts some effects start on, we have to refresh their states + var nhproxy = _proxy.GetComponentInParent(); + nhproxy.ToggleRendering(!nhproxy._outOfRange); + } } public void StopSupernova() diff --git a/NewHorizons/Components/Stars/StellarDeathController.cs b/NewHorizons/Components/Stars/StellarDeathController.cs index f3ea24ac..33e913e4 100644 --- a/NewHorizons/Components/Stars/StellarDeathController.cs +++ b/NewHorizons/Components/Stars/StellarDeathController.cs @@ -98,7 +98,10 @@ namespace NewHorizons.Components.Stars public void SetParticlesVisibility(bool visible) { - foreach (var particleRenderer in _cachedParticleRenderers) particleRenderer.enabled = visible; + foreach (var particleRenderer in _cachedParticleRenderers) + { + particleRenderer.enabled = visible; + } } public void SetRenderingEnabled(bool renderingEnabled)