From fc6d5d8a749c1b76c604094ead6e2e95a755b70a Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 18 Aug 2022 14:50:48 -0400 Subject: [PATCH] Deprecate goSupernova --- NewHorizons/Builder/Body/StarBuilder.cs | 4 ++-- NewHorizons/External/Configs/PlanetConfig.cs | 7 +++++++ NewHorizons/External/Modules/VariableSize/StarModule.cs | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index fcc9f39b..5eeb9984 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -161,7 +161,7 @@ namespace NewHorizons.Builder.Body controller.StartColour = starModule.tint; controller.EndColour = starModule.endTint; controller.SupernovaColour = starModule.supernovaTint; - controller.WillExplode = starModule.goSupernova; + controller.WillExplode = starModule.stellarDeathType != StellarDeathType.None; controller.lifespan = starModule.lifespan; controller.normalRamp = !string.IsNullOrEmpty(starModule.starRampTexture) ? ImageUtilities.GetTexture(mod, starModule.starRampTexture) : ramp; controller._heatVolume = heatVolume.GetComponent(); @@ -217,7 +217,7 @@ namespace NewHorizons.Builder.Body controller.StartColour = starModule.tint; controller.EndColour = starModule.endTint; controller.SupernovaColour = starModule.supernovaTint; - controller.WillExplode = starModule.goSupernova; + controller.WillExplode = starModule.stellarDeathType != StellarDeathType.None; controller.lifespan = starModule.lifespan; controller.normalRamp = !string.IsNullOrEmpty(starModule.starRampTexture) ? ImageUtilities.GetTexture(mod, starModule.starRampTexture) : ramp; if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture)) diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index 0801d9e7..78024bab 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -351,6 +351,13 @@ namespace NewHorizons.External.Configs if (Props.signals == null) Props.signals = new SignalModule.SignalInfo[0]; Props.signals = Props.signals.Concat(Signal.signals).ToArray(); } + + // Star + if (Star != null) + { + if (!Star.goSupernova) Star.stellarDeathType = StellarDeathType.None; + } + // Signals no longer use two different variables for audio if (Props?.signals != null) { diff --git a/NewHorizons/External/Modules/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs index f4a4291d..558673e5 100644 --- a/NewHorizons/External/Modules/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; @@ -19,7 +20,7 @@ namespace NewHorizons.External.Modules.VariableSize /// /// Should this star explode at the end of its lifespan? /// - [DefaultValue(true)] public bool goSupernova = true; + [Obsolete("goSupernova is deprecated, please use stellarDeathType instead")] [DefaultValue(true)] public bool goSupernova = true; /// /// How long in minutes this star will last until it supernovas. @@ -103,6 +104,7 @@ namespace NewHorizons.External.Modules.VariableSize public enum StellarDeathType { [EnumMember(Value = @"default")] Default, + [EnumMember(Value = @"none")] None, [EnumMember(Value = @"planetaryNebula")] PlanetaryNebula, [EnumMember(Value = @"supernova")] Supernova }