Stars changes 2 (#258)

The sequel
This commit is contained in:
Nick 2022-08-14 13:31:33 -04:00 committed by GitHub
commit c66ec69490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

View File

@ -67,6 +67,9 @@ namespace NewHorizons.Builder.Body
ambientLightGO.transform.localPosition = Vector3.zero;
ambientLightGO.name = "AmbientLight_Star";
Light ambientLight = ambientLightGO.GetComponent<Light>();
ambientLight.range = starModule.size * OuterRadiusRatio;
var heatVolume = Object.Instantiate(SearchUtilities.Find("Sun_Body/Sector_SUN/Volumes_SUN/HeatVolume"), starGO.transform);
heatVolume.transform.localPosition = Vector3.zero;
heatVolume.transform.localScale = Vector3.one;
@ -84,13 +87,11 @@ namespace NewHorizons.Builder.Body
var planetDestructionVolume = Object.Instantiate(deathVolume, starGO.transform);
planetDestructionVolume.transform.localPosition = Vector3.zero;
planetDestructionVolume.transform.localScale = Vector3.one;
planetDestructionVolume.GetComponent<SphereCollider>().radius = 0.75f;
planetDestructionVolume.GetComponent<SphereCollider>().radius = 0.8f;
planetDestructionVolume.GetComponent<DestructionVolume>()._onlyAffectsPlayerAndShip = false;
planetDestructionVolume.GetComponent<DestructionVolume>()._shrinkBodies = true;
planetDestructionVolume.name = "PlanetDestructionVolume";
Light ambientLight = ambientLightGO.GetComponent<Light>();
var sunLight = new GameObject("StarLight");
sunLight.transform.parent = starGO.transform;
sunLight.transform.localPosition = Vector3.zero;
@ -106,7 +107,7 @@ namespace NewHorizons.Builder.Body
if (starModule.lightTint != null) lightColour = starModule.lightTint.ToColor();
light.color = lightColour;
ambientLight.color = lightColour;
ambientLight.color = new Color(lightColour.r, lightColour.g, lightColour.b, lightColour.a == 0 ? 0.0001f : lightColour.a);
var faceActiveCamera = sunLight.AddComponent<FaceActiveCamera>();
faceActiveCamera.CopyPropertiesFrom(SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<FaceActiveCamera>());

View File

@ -39,6 +39,7 @@ namespace NewHorizons.Components.SizeControllers
private float _collapseTimer;
public float collapseTime = 10f; // seconds
public float supernovaTime = 45f; // seconds
public float lifespan = 22f; // minutes
public float supernovaSize = 50000f;
@ -152,7 +153,7 @@ namespace NewHorizons.Components.SizeControllers
var timeAfter = secondsElapsed - lifespanInSeconds;
if (timeAfter <= collapseTime)
Delay.RunWhen(() => Main.IsSystemReady, StartCollapse);
else if (timeAfter <= collapseTime + 45)
else if (timeAfter <= collapseTime + supernovaTime)
Delay.RunWhen(() => Main.IsSystemReady, StartSupernova);
else
Delay.RunWhen(() => Main.IsSystemReady, () => Delay.FireOnNextUpdate(() => DisableStar(true)));
@ -227,7 +228,7 @@ namespace NewHorizons.Components.SizeControllers
if (_planetDestructionVolume != null) _planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
if (Time.time > _supernovaStartTime + 45f)
if (Time.time > _supernovaStartTime + supernovaTime)
{
DisableStar();
}

View File

@ -53,7 +53,7 @@ namespace NewHorizons.External.Modules.VariableSize
public float solarLuminosity = 1f;
/// <summary>
/// Radius of the supernova.
/// Radius of the supernova. Any planets within 80% of this will be destroyed.
/// </summary>
[DefaultValue(50000f)]
[Range(0f, double.MaxValue)]

View File

@ -386,9 +386,17 @@ namespace NewHorizons
var playerLight = playerBody.AddComponent<Light>();
playerLight.innerSpotAngle = 0;
playerLight.spotAngle = 179;
playerLight.range = 0.5f;
playerLight.range = 1;
playerLight.intensity = 0.001f;
//Do the same for map
var solarSystemRoot = SearchUtilities.Find("SolarSystemRoot");
var ssrLight = solarSystemRoot.AddComponent<Light>();
ssrLight.innerSpotAngle = 0;
ssrLight.spotAngle = 179;
ssrLight.range = Main.FurthestOrbit * (4f/3f);
ssrLight.intensity = 0.001f;
try
{
Logger.Log($"Star system finished loading [{Instance.CurrentStarSystem}]");

View File

@ -2335,7 +2335,7 @@
},
"supernovaSize": {
"type": "number",
"description": "Radius of the supernova.",
"description": "Radius of the supernova. Any planets within 80% of this will be destroyed.",
"format": "float",
"default": 50000.0,
"minimum": 0.0