diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index a844ea64..c79ec35b 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -123,7 +123,7 @@ namespace NewHorizons.Builder.Body var supernova = MakeSupernova(starGO, starModule); var controller = starGO.AddComponent(); - if(starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve(); + if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve(); controller.size = starModule.Size; controller.atmosphere = sunAtmosphere; controller.supernova = supernova; @@ -178,9 +178,17 @@ namespace NewHorizons.Builder.Body solarFlareEmitter.transform.localScale = Vector3.one; solarFlareEmitter.name = "SolarFlareEmitter"; - if (starModule.SolarFlareTint != null) + if (starModule.Tint != null) { - solarFlareEmitter.GetComponent().tint = starModule.SolarFlareTint.ToColor(); + var flareTint = starModule.Tint.ToColor(); + var emitter = solarFlareEmitter.GetComponent(); + emitter.tint = flareTint; + foreach (var controller in solarFlareEmitter.GetComponentsInChildren()) + { + // It multiplies color by tint but wants something very bright idk + controller._color = new Color(20, 20, 20); + controller._tint = flareTint; + } } starGO.transform.position = rootObject.transform.position; @@ -226,7 +234,7 @@ namespace NewHorizons.Builder.Body supernova._surface = starGO.GetComponentInChildren(); supernova._supernovaVolume = null; - if(starModule.SupernovaTint != null) + if (starModule.SupernovaTint != null) { var colour = starModule.SupernovaTint.ToColor(); diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 431d7dfe..25b18414 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -24,6 +24,7 @@ namespace NewHorizons.Components.SizeControllers private MeshRenderer[] _atmosphereRenderers; private HeatHazardVolume _heatVolume; private DestructionVolume _destructionVolume; + private SolarFlareEmitter _flareEmitter; private bool _isCollapsing; private float _collapseStartSize; @@ -91,10 +92,12 @@ namespace NewHorizons.Components.SizeControllers if (willExplode) GlobalMessenger.AddListener("TriggerSupernova", Die); - if(scaleCurve != null) + if (scaleCurve != null) { maxScale = scaleCurve.keys.Select(x => x.value).Max() * size; } + + _flareEmitter = GetComponentInChildren(); } public void OnDestroy() @@ -147,7 +150,7 @@ namespace NewHorizons.Components.SizeControllers if (!_isCollapsing) { base.FixedUpdate(); - + // Only do colour transition stuff if they set an end colour if (endColour != null) { @@ -161,6 +164,8 @@ namespace NewHorizons.Components.SizeControllers { currentColour = _startColour; } + + if (_flareEmitter != null) _flareEmitter._tint = currentColour; } else { diff --git a/NewHorizons/External/Modules/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs index 28a4045a..f75b6374 100644 --- a/NewHorizons/External/Modules/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -8,7 +8,6 @@ namespace NewHorizons.External.Modules.VariableSize public MColor Tint { get; set; } public MColor EndTint { get; set; } public MColor SupernovaTint { get; set; } - public MColor SolarFlareTint { get; set; } public MColor LightTint { get; set; } public float SolarLuminosity { get; set; } = 1f; public bool HasAtmosphere { get; set; } = true; diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index c91284c3..d2e433bf 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -600,10 +600,6 @@ "$ref": "#/$defs/color", "description": "Colour of the star at the end of its life." }, - "solarFlareTint": { - "$ref": "#/$defs/color", - "description": "Colour of the solar flares. The shader is a bit weird so the value you put won't exactly reflect what you see. Try experimenting with different colours to see what works." - }, "lightTint": { "$ref": "#/$defs/color", "description": "Colour of the light given off."