Merge pull request #127 from xen-42/supernova2

Supernova2
This commit is contained in:
Nick 2022-05-17 17:36:12 -04:00 committed by GitHub
commit 222e23889e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 350 additions and 76 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

View File

@ -11,7 +11,7 @@ namespace NewHorizons.Builder.Atmosphere
public static void Make(GameObject planetGO, IPlanetConfig config, float sphereOfInfluence) public static void Make(GameObject planetGO, IPlanetConfig config, float sphereOfInfluence)
{ {
var innerRadius = config.Base.SurfaceSize; var innerRadius = config.Base.SurfaceSize;
var useMiniMap = config.Base.IsSatellite; var useMiniMap = !config.Base.IsSatellite;
GameObject volumesGO = new GameObject("Volumes"); GameObject volumesGO = new GameObject("Volumes");
volumesGO.SetActive(false); volumesGO.SetActive(false);

View File

@ -22,7 +22,7 @@ namespace NewHorizons.Builder.Body
private static readonly string _whiteHolePath = "TowerTwin_Body/Sector_TowerTwin/Sector_Tower_HGT/Interactables_Tower_HGT/Interactables_Tower_CT/Prefab_NOM_WarpTransmitter/WhiteHole/WhiteHoleSingularity"; private static readonly string _whiteHolePath = "TowerTwin_Body/Sector_TowerTwin/Sector_Tower_HGT/Interactables_Tower_HGT/Interactables_Tower_CT/Prefab_NOM_WarpTransmitter/WhiteHole/WhiteHoleSingularity";
public static void Make(GameObject gameObject, NewHorizonsBody body) public static void Make(GameObject planetGO, NewHorizonsBody body)
{ {
if (lavaMaterial == null) lavaMaterial = SearchUtilities.FindObjectOfTypeAndName<ProxyOrbiter>("VolcanicMoon_Body").transform.Find("LavaSphere").GetComponent<MeshRenderer>().material; if (lavaMaterial == null) lavaMaterial = SearchUtilities.FindObjectOfTypeAndName<ProxyOrbiter>("VolcanicMoon_Body").transform.Find("LavaSphere").GetComponent<MeshRenderer>().material;
@ -57,9 +57,7 @@ namespace NewHorizons.Builder.Body
} }
if (body.Config.Star != null) if (body.Config.Star != null)
{ {
var starGO = StarBuilder.MakeStarGraphics(newProxy, null, body.Config.Star); var starGO = StarBuilder.MakeStarProxy(planetGO, newProxy, body.Config.Star);
if (body.Config.Star.Curve != null) AddSizeController(starGO, body.Config.Star.Curve, body.Config.Star.Size);
if (realSize < body.Config.Star.Size) realSize = body.Config.Star.Size; if (realSize < body.Config.Star.Size) realSize = body.Config.Star.Size;
} }
@ -135,8 +133,6 @@ namespace NewHorizons.Builder.Body
var proxyController = newProxy.AddComponent<NHProxy>(); var proxyController = newProxy.AddComponent<NHProxy>();
proxyController.astroName = body.Config.Name; proxyController.astroName = body.Config.Name;
proxyController._realObjectDiameter = realSize; proxyController._realObjectDiameter = realSize;
proxyController.renderers = newProxy.GetComponentsInChildren<Renderer>();
proxyController.tessellatedRenderers = newProxy.GetComponentsInChildren<TessellatedRenderer>();
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -33,20 +33,23 @@ namespace NewHorizons.Builder.Body
sunAudio.name = "Audio_Star"; sunAudio.name = "Audio_Star";
GameObject sunAtmosphere = null;
if (starModule.HasAtmosphere) if (starModule.HasAtmosphere)
{ {
var sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), planetGO.transform); sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), starGO.transform);
sunAtmosphere.transform.position = planetGO.transform.position; sunAtmosphere.transform.position = planetGO.transform.position;
sunAtmosphere.transform.localScale = Vector3.one; sunAtmosphere.transform.localScale = Vector3.one * OuterRadiusRatio;
sunAtmosphere.name = "Atmosphere_Star"; sunAtmosphere.name = "Atmosphere_Star";
PlanetaryFogController fog = sunAtmosphere.transform.Find("FogSphere").GetComponent<PlanetaryFogController>(); PlanetaryFogController fog = sunAtmosphere.transform.Find("FogSphere").GetComponent<PlanetaryFogController>();
if (starModule.Tint != null) if (starModule.Tint != null)
{ {
fog.fogTint = starModule.Tint.ToColor(); fog.fogTint = starModule.Tint.ToColor();
sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one * (starModule.Size * OuterRadiusRatio); sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one;
foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>()) foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>())
{ {
lod.material.SetColor("_SkyColor", starModule.Tint.ToColor()); lod.material.SetColor("_SkyColor", starModule.Tint.ToColor());
lod.material.SetColor("_AtmosFar", starModule.Tint.ToColor());
lod.material.SetColor("_AtmosNear", starModule.Tint.ToColor());
lod.material.SetFloat("_InnerRadius", starModule.Size); lod.material.SetFloat("_InnerRadius", starModule.Size);
lod.material.SetFloat("_OuterRadius", starModule.Size * OuterRadiusRatio); lod.material.SetFloat("_OuterRadius", starModule.Size * OuterRadiusRatio);
} }
@ -54,12 +57,6 @@ namespace NewHorizons.Builder.Body
fog.transform.localScale = Vector3.one; fog.transform.localScale = Vector3.one;
fog.fogRadius = starModule.Size * OuterRadiusRatio; fog.fogRadius = starModule.Size * OuterRadiusRatio;
fog.lodFadeDistance = fog.fogRadius * (StarBuilder.OuterRadiusRatio - 1f); fog.lodFadeDistance = fog.fogRadius * (StarBuilder.OuterRadiusRatio - 1f);
if (starModule.Curve != null)
{
var controller = sunAtmosphere.AddComponent<StarAtmosphereSizeController>();
controller.scaleCurve = starModule.ToAnimationCurve();
controller.initialSize = starModule.Size;
}
} }
var ambientLightGO = GameObject.Instantiate(GameObject.Find("Sun_Body/AmbientLight_SUN"), starGO.transform); var ambientLightGO = GameObject.Instantiate(GameObject.Find("Sun_Body/AmbientLight_SUN"), starGO.transform);
@ -77,7 +74,7 @@ namespace NewHorizons.Builder.Body
deathVolume.transform.localScale = Vector3.one; deathVolume.transform.localScale = Vector3.one;
deathVolume.GetComponent<SphereCollider>().radius = 1f; deathVolume.GetComponent<SphereCollider>().radius = 1f;
deathVolume.GetComponent<DestructionVolume>()._onlyAffectsPlayerAndShip = false; deathVolume.GetComponent<DestructionVolume>()._onlyAffectsPlayerAndShip = false;
deathVolume.GetComponent<DestructionVolume>()._shrinkBodies = false; deathVolume.GetComponent<DestructionVolume>()._shrinkBodies = true;
deathVolume.name = "DestructionVolume"; deathVolume.name = "DestructionVolume";
Light ambientLight = ambientLightGO.GetComponent<Light>(); Light ambientLight = ambientLightGO.GetComponent<Light>();
@ -130,20 +127,47 @@ namespace NewHorizons.Builder.Body
starController.SunColor = lightColour; starController.SunColor = lightColour;
} }
if (starModule.Curve != null) var supernova = MakeSupernova(starGO, starModule);
{
var levelController = starGO.AddComponent<SandLevelController>(); var controller = starGO.AddComponent<StarEvolutionController>();
var curve = new AnimationCurve(); if(starModule.Curve != null) controller.scaleCurve = starModule.ToAnimationCurve();
foreach (var pair in starModule.Curve) controller.size = starModule.Size;
{ controller.atmosphere = sunAtmosphere;
curve.AddKey(new Keyframe(pair.Time, starModule.Size * pair.Value)); controller.supernova = supernova;
} controller.startColour = starModule.Tint;
levelController._scaleCurve = curve; controller.endColour = starModule.EndTint;
} controller.willExplode = starModule.GoSupernova;
// It fucking insists on this existing and its really annoying
var supernovaVolume = new GameObject("SupernovaVolumePlaceholder");
supernovaVolume.transform.SetParent(starGO.transform);
supernova._supernovaVolume = supernovaVolume.AddComponent<SupernovaDestructionVolume>();
var sphere = supernovaVolume.AddComponent<SphereShape>();
sphere.radius = 0f;
supernovaVolume.AddComponent<OWCollider>();
return starController; return starController;
} }
public static GameObject MakeStarProxy(GameObject planet, GameObject proxyGO, StarModule starModule)
{
var starGO = MakeStarGraphics(proxyGO, null, starModule);
var supernova = MakeSupernova(starGO, starModule);
var controller = starGO.AddComponent<StarEvolutionController>();
if (starModule.Curve != null) controller.scaleCurve = starModule.ToAnimationCurve();
controller.size = starModule.Size;
controller.supernova = supernova;
controller.startColour = starModule.Tint;
controller.endColour = starModule.EndTint;
controller.enabled = true;
planet.GetComponentInChildren<StarEvolutionController>().SetProxy(controller);
return proxyGO;
}
public static GameObject MakeStarGraphics(GameObject rootObject, Sector sector, StarModule starModule) public static GameObject MakeStarGraphics(GameObject rootObject, Sector sector, StarModule starModule)
{ {
if (_colorOverTime == null) _colorOverTime = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/StarColorOverTime.png"); if (_colorOverTime == null) _colorOverTime = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/StarColorOverTime.png");
@ -191,5 +215,34 @@ namespace NewHorizons.Builder.Body
return starGO; return starGO;
} }
private static SupernovaEffectController MakeSupernova(GameObject starGO, StarModule starModule)
{
var supernovaGO = GameObject.Find("Sun_Body/Sector_SUN/Effects_SUN/Supernova").InstantiateInactive();
supernovaGO.transform.SetParent(starGO.transform);
supernovaGO.transform.localPosition = Vector3.zero;
var supernova = supernovaGO.GetComponent<SupernovaEffectController>();
supernova._surface = starGO.GetComponentInChildren<TessellatedSphereRenderer>();
supernova._supernovaVolume = null;
if(starModule.SupernovaTint != null)
{
var colour = starModule.SupernovaTint.ToColor();
var supernovaMaterial = new Material(supernova._supernovaMaterial);
var ramp = ImageUtilities.LerpGreyscaleImage(ImageUtilities.GetTexture(Main.Instance, "AssetBundle/Effects_SUN_Supernova_d.png"), Color.white, colour);
supernovaMaterial.SetTexture("_ColorRamp", ramp);
supernova._supernovaMaterial = supernovaMaterial;
// Motes
var moteMaterial = supernova.GetComponentInChildren<ParticleSystemRenderer>().material;
moteMaterial.color = new Color(colour.r * 3f, colour.g * 3f, colour.b * 3f, moteMaterial.color.a);
}
supernovaGO.SetActive(true);
return supernova;
}
} }
} }

View File

@ -73,7 +73,7 @@ namespace NewHorizons.Builder.Orbital
binary.FakeMassBody = PlanetCreationHandler.GenerateBody(new NewHorizonsBody(fakeMassConfig, mod)); binary.FakeMassBody = PlanetCreationHandler.GenerateBody(new NewHorizonsBody(fakeMassConfig, mod));
} }
private static float GetGravitationalMass(IPlanetConfig config) private static float GetGravitationalMass(IPlanetConfig config)
{ {
var surfaceAcceleration = config.Base.SurfaceGravity; var surfaceAcceleration = config.Base.SurfaceGravity;

View File

@ -107,17 +107,17 @@ namespace NewHorizons.Builder.ShipLog
ShipLogAstroObject astroObject = gameObject.AddComponent<ShipLogAstroObject>(); ShipLogAstroObject astroObject = gameObject.AddComponent<ShipLogAstroObject>();
astroObject._id = ShipLogHandler.GetAstroObjectId(body); astroObject._id = ShipLogHandler.GetAstroObjectId(body);
Texture2D image; Texture2D image = null;
Texture2D outline; Texture2D outline = null;
string imagePath = body.Config.ShipLog?.mapMode?.revealedSprite; string imagePath = body.Config.ShipLog?.mapMode?.revealedSprite;
string outlinePath = body.Config.ShipLog?.mapMode?.outlineSprite; string outlinePath = body.Config.ShipLog?.mapMode?.outlineSprite;
if (imagePath != null) image = ImageUtilities.GetTexture(body.Mod, imagePath); if (imagePath != null) image = ImageUtilities.GetTexture(body.Mod, imagePath);
else image = AutoGenerateMapModePicture(body); if (image == null) image = AutoGenerateMapModePicture(body);
if (outlinePath != null) outline = ImageUtilities.GetTexture(body.Mod, outlinePath); if (outlinePath != null) outline = ImageUtilities.GetTexture(body.Mod, outlinePath);
else outline = ImageUtilities.MakeOutline(image, Color.white, 10); if (outline == null) outline = ImageUtilities.MakeOutline(image, Color.white, 10);
astroObject._imageObj = CreateImage(gameObject, image, body.Config.Name + " Revealed", layer); astroObject._imageObj = CreateImage(gameObject, image, body.Config.Name + " Revealed", layer);
astroObject._outlineObj = CreateImage(gameObject, outline, body.Config.Name + " Outline", layer); astroObject._outlineObj = CreateImage(gameObject, outline, body.Config.Name + " Outline", layer);

View File

@ -1,4 +1,5 @@
using NewHorizons.Utility; using NewHorizons.Components.SizeControllers;
using NewHorizons.Utility;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -7,8 +8,29 @@ namespace NewHorizons.Components
public class NHProxy : ProxyPlanet public class NHProxy : ProxyPlanet
{ {
public string astroName; public string astroName;
public Renderer[] renderers;
public TessellatedRenderer[] tessellatedRenderers; private GameObject _star;
private Renderer[] _starRenderers;
private TessellatedRenderer[] _starTessellatedRenderers;
public override void Awake()
{
base.Awake();
// The star part cant be disabled like the rest and we have to manually disable the renderers
// Else it can stop the supernova effect mid way through
_star = GetComponentInChildren<StarEvolutionController>()?.gameObject;
if(_star != null)
{
_starRenderers = _star.GetComponentsInChildren<Renderer>();
_starTessellatedRenderers = _star.GetComponentsInChildren<TessellatedRenderer>();
}
// Start off
_outOfRange = false;
ToggleRendering(false);
}
public override void Initialize() public override void Initialize()
{ {
@ -34,10 +56,25 @@ namespace NewHorizons.Components
public override void ToggleRendering(bool on) public override void ToggleRendering(bool on)
{ {
base.ToggleRendering(on); base.ToggleRendering(on);
foreach (Transform child in transform) foreach (Transform child in transform)
{ {
if (child.gameObject == _star) continue;
child.gameObject.SetActive(on); child.gameObject.SetActive(on);
} }
if(_star != null)
{
foreach (var renderer in _starRenderers)
{
renderer.enabled = on;
}
foreach (var renderer in _starTessellatedRenderers)
{
renderer.enabled = on;
}
}
} }
} }
} }

View File

@ -10,13 +10,21 @@ namespace NewHorizons.Components.SizeControllers
public class SizeController : MonoBehaviour public class SizeController : MonoBehaviour
{ {
public AnimationCurve scaleCurve; public AnimationCurve scaleCurve;
public float CurrentScale { get; private set; } public float CurrentScale { get; protected set; }
public float size = 1f; public float size = 1f;
protected void FixedUpdate() protected void FixedUpdate()
{ {
CurrentScale = scaleCurve.Evaluate(TimeLoop.GetMinutesElapsed()) * size; if(scaleCurve != null)
base.transform.localScale = new Vector3(CurrentScale, CurrentScale, CurrentScale); {
CurrentScale = scaleCurve.Evaluate(TimeLoop.GetMinutesElapsed()) * size;
}
else
{
CurrentScale = size;
}
base.transform.localScale = Vector3.one * CurrentScale;
} }
} }
} }

View File

@ -1,35 +0,0 @@
using NewHorizons.Builder.Body;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components.SizeControllers
{
public class StarAtmosphereSizeController : SizeController
{
private PlanetaryFogController fog;
public float initialSize;
private MeshRenderer[] atmosphereRenderers;
void Awake()
{
fog = GetComponentInChildren<PlanetaryFogController>();
atmosphereRenderers = transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>();
}
protected new void FixedUpdate()
{
base.FixedUpdate();
fog.fogRadius = initialSize * CurrentScale * StarBuilder.OuterRadiusRatio;
fog.lodFadeDistance = initialSize * CurrentScale * (StarBuilder.OuterRadiusRatio - 1f);
foreach (var lod in atmosphereRenderers)
{
lod.material.SetFloat("_InnerRadius", initialSize * CurrentScale);
lod.material.SetFloat("_OuterRadius", initialSize * CurrentScale * StarBuilder.OuterRadiusRatio);
}
}
}
}

View File

@ -0,0 +1,200 @@
using NewHorizons.Builder.Body;
using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components.SizeControllers
{
public class StarEvolutionController : SizeController
{
public GameObject atmosphere;
public SupernovaEffectController supernova;
public bool willExplode;
public MColor startColour { get; set; }
public MColor endColour { get; set; }
private Color _startColour;
private Color _endColour;
private PlanetaryFogController _fog;
private MeshRenderer[] _atmosphereRenderers;
private HeatHazardVolume _heatVolume;
private DestructionVolume _destructionVolume;
private bool _isCollapsing;
private float _collapseStartSize;
private float _collapseTimer;
public float collapseTime = 5f; // seconds
public float lifespan = 22f; // minutes
private float _age;
private bool _isSupernova;
private float _supernovaStartTime;
private Material _collapseStartSurfaceMaterial;
private Material _collapseEndSurfaceMaterial;
private Material _startSurfaceMaterial;
private Material _endSurfaceMaterial;
private StarEvolutionController _proxy;
void Awake()
{
var sun = GameObject.FindObjectOfType<SunController>();
_collapseStartSurfaceMaterial = new Material(sun._collapseStartSurfaceMaterial);
_collapseEndSurfaceMaterial = new Material(sun._collapseEndSurfaceMaterial);
_startSurfaceMaterial = new Material(sun._startSurfaceMaterial);
_endSurfaceMaterial = new Material(sun._endSurfaceMaterial);
// Copy over the material that was set in star builder
_collapseStartSurfaceMaterial.SetTexture("_ColorRamp", supernova._surface.sharedMaterial.GetTexture("_ColorRamp"));
_collapseEndSurfaceMaterial.SetTexture("_ColorRamp", supernova._surface.sharedMaterial.GetTexture("_ColorRamp"));
_startSurfaceMaterial.SetTexture("_ColorRamp", supernova._surface.sharedMaterial.GetTexture("_ColorRamp"));
_endSurfaceMaterial.SetTexture("_ColorRamp", supernova._surface.sharedMaterial.GetTexture("_ColorRamp"));
if (startColour == null)
{
_startColour = _startSurfaceMaterial.color;
}
else
{
_startColour = startColour.ToColor();
_startSurfaceMaterial.color = _startColour;
}
if (endColour == null)
{
_endColour = _startColour;
_endSurfaceMaterial.color = _startColour;
}
else
{
_endColour = endColour.ToColor();
_endSurfaceMaterial.color = _endColour;
}
_heatVolume = GetComponentInChildren<HeatHazardVolume>();
_destructionVolume = GetComponentInChildren<DestructionVolume>();
if (atmosphere != null)
{
_fog = atmosphere?.GetComponentInChildren<PlanetaryFogController>();
_atmosphereRenderers = atmosphere?.transform?.Find("AtmoSphere")?.GetComponentsInChildren<MeshRenderer>();
}
if (willExplode) GlobalMessenger.AddListener("TriggerSupernova", Die);
}
public void OnDestroy()
{
if (willExplode) GlobalMessenger.RemoveListener("TriggerSupernova", Die);
}
public void SetProxy(StarEvolutionController proxy)
{
_proxy = proxy;
_proxy.supernova.SetIsProxy(true);
}
public void Die()
{
_isCollapsing = true;
_collapseStartSize = CurrentScale;
_collapseTimer = 0f;
if (_proxy != null) _proxy.Die();
}
protected new void FixedUpdate()
{
_age += Time.deltaTime;
var ageValue = _age / (lifespan * 60f);
// If we've gone supernova and its been 45 seconds that means it has faded out and is gone
// The 45 is from the animation curve used for the supernova alpha
if (_isSupernova)
{
// Reset the scale back to normal bc now its just the supernova scaling itself + destruction and heat volumes
transform.localScale = Vector3.one;
// Make the destruction volume scale slightly smaller so you really have to be in the supernova to die
if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
if (Time.time > _supernovaStartTime + 45f)
{
// Just turn off the star entirely
base.gameObject.SetActive(false);
}
return;
}
Color currentColour;
if (!_isCollapsing)
{
base.FixedUpdate();
currentColour = Color.Lerp(_startColour, _endColour, ageValue);
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, ageValue);
}
else
{
// When its collapsing we directly take over the scale
var t = _collapseTimer / collapseTime;
CurrentScale = Mathf.Lerp(_collapseStartSize, 0, t);
transform.localScale = Vector3.one * CurrentScale;
_collapseTimer += Time.deltaTime;
currentColour = Color.Lerp(_endColour, Color.white, t);
supernova._surface._materials[0].Lerp(_collapseStartSurfaceMaterial, _collapseEndSurfaceMaterial, t);
// After the collapse is done we go supernova
if (_collapseTimer > collapseTime)
{
supernova.enabled = true;
_isSupernova = true;
_supernovaStartTime = Time.time;
atmosphere.SetActive(false);
_destructionVolume._deathType = DeathType.Supernova;
return;
}
}
// This is just all the scales stuff for the atmosphere effects
if (_fog != null)
{
_fog.fogRadius = CurrentScale * StarBuilder.OuterRadiusRatio;
_fog.lodFadeDistance = CurrentScale * StarBuilder.OuterRadiusRatio / 3f;
// The colour thing goes over one
var max = Math.Max(currentColour.g, Math.Max(currentColour.b, currentColour.r));
var fogColour = currentColour / max / 1.5f;
fogColour.a = 1f;
_fog.fogTint = fogColour;
_fog._fogTint = fogColour;
}
if (_atmosphereRenderers != null && _atmosphereRenderers.Count() > 0)
{
foreach (var lod in _atmosphereRenderers)
{
lod.material.SetFloat("_InnerRadius", CurrentScale);
lod.material.SetFloat("_OuterRadius", CurrentScale * StarBuilder.OuterRadiusRatio);
lod.material.SetColor("_AtmosFar", currentColour);
lod.material.SetColor("_AtmosNear", currentColour);
lod.material.SetColor("_SkyColor", currentColour);
}
}
}
}
}

View File

@ -11,9 +11,12 @@ namespace NewHorizons.External.VariableSize
{ {
public float Size { get; set; } = 2000f; public float Size { get; set; } = 2000f;
public MColor Tint { get; set; } public MColor Tint { get; set; }
public MColor EndTint { get; set; }
public MColor SupernovaTint { get; set; }
public MColor SolarFlareTint { get; set; } public MColor SolarFlareTint { get; set; }
public MColor LightTint { get; set; } public MColor LightTint { get; set; }
public float SolarLuminosity { get; set; } = 1f; public float SolarLuminosity { get; set; } = 1f;
public bool HasAtmosphere { get; set; } = true; public bool HasAtmosphere { get; set; } = true;
public bool GoSupernova { get; set; } = true;
} }
} }

View File

@ -20,9 +20,12 @@ namespace NewHorizons.External.VariableSize
public AnimationCurve ToAnimationCurve(float size = 1f) public AnimationCurve ToAnimationCurve(float size = 1f)
{ {
var curve = new AnimationCurve(); var curve = new AnimationCurve();
foreach (var pair in this.Curve) if(Curve != null)
{ {
curve.AddKey(new Keyframe(pair.Time, size * pair.Value)); foreach (var pair in this.Curve)
{
curve.AddKey(new Keyframe(pair.Time, size * pair.Value));
}
} }
return curve; return curve;
} }

View File

@ -3,7 +3,7 @@
"author": "xen, Bwc9876, & Book", "author": "xen, Bwc9876, & Book",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "0.17.0", "version": "0.18.0",
"owmlVersion": "2.1.0", "owmlVersion": "2.1.0",
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.AutoResume", "PacificEngine.OW_Randomizer" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.AutoResume", "PacificEngine.OW_Randomizer" ],
"pathsToPreserve": [ "planets", "systems", "translations" ] "pathsToPreserve": [ "planets", "systems", "translations" ]

View File

@ -596,6 +596,10 @@
"$ref": "#/$defs/color", "$ref": "#/$defs/color",
"description": "Colour of the star." "description": "Colour of the star."
}, },
"endTint": {
"$ref": "#/$defs/color",
"description": "Colour of the star at the end of its life."
},
"solarFlareTint": { "solarFlareTint": {
"$ref": "#/$defs/color", "$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." "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."
@ -618,6 +622,11 @@
"curve": { "curve": {
"$ref": "#/$defs/curve", "$ref": "#/$defs/curve",
"description": "Allows the star to shrink/grow over time." "description": "Allows the star to shrink/grow over time."
},
"goSupernova": {
"type": "boolean",
"default": true,
"description": "Should this star explode after 22 minutes?"
} }
} }
}, },