Merge branch 'dev' into custom-credits

This commit is contained in:
Nick 2022-08-14 14:29:37 -04:00
commit eab4d3838b
7 changed files with 34 additions and 39 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

@ -408,35 +408,23 @@ namespace NewHorizons.Builder.Props
case PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder:
case PropModule.NomaiTextInfo.NomaiTextType.Recorder:
{
var recorderObject = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder ? _preCrashRecorderPrefab : _recorderPrefab).InstantiateInactive();
var prefab = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder ? _preCrashRecorderPrefab : _recorderPrefab);
var detailInfo = new PropModule.DetailInfo {
parentPath = info.parentPath,
rotation = info.rotation,
position = info.position
};
var recorderObject = DetailBuilder.MakeDetail(planetGO, sector, prefab, detailInfo);
recorderObject.SetActive(false);
if (!string.IsNullOrEmpty(info.rename))
{
recorderObject.name = info.rename;
}
recorderObject.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))
{
var newParent = planetGO.transform.Find(info.parentPath);
if (newParent != null)
{
recorderObject.transform.parent = newParent;
}
else
{
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
}
}
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
if (info.rotation != null)
{
recorderObject.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(info.rotation));
}
else
if (info.rotation == null)
{
var up = recorderObject.transform.position - planetGO.transform.position;
recorderObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * recorderObject.transform.rotation;
@ -451,9 +439,6 @@ namespace NewHorizons.Builder.Props
nomaiText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
AddTranslation(xmlPath);
// Make sure the recorder model is loaded
StreamingHandler.SetUpStreaming(recorderObject, sector);
recorderObject.SetActive(true);
recorderObject.transform.Find("InteractSphere").gameObject.GetComponent<SphereShape>().enabled = true;

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

@ -271,9 +271,9 @@ namespace NewHorizons.External.Modules
[JsonConverter(typeof(StringEnumConverter))]
public enum TornadoType
{
[EnumMember(Value = @"downwards")] Downwards = 0,
[EnumMember(Value = @"upwards")] Upwards = 0,
[EnumMember(Value = @"upwards")] Upwards = 1,
[EnumMember(Value = @"downwards")] Downwards = 1,
[EnumMember(Value = @"hurricane")] Hurricane = 2
}
@ -303,7 +303,7 @@ namespace NewHorizons.External.Modules
/// <summary>
/// What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction.
/// </summary>
[DefaultValue("downwards")] public TornadoType type = TornadoType.Downwards;
[DefaultValue("upwards")] public TornadoType type = TornadoType.Upwards;
/// <summary>
/// Angular distance from the starting position that it will wander, in terms of the angle around the x-axis.

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

@ -388,9 +388,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

@ -1634,7 +1634,7 @@
},
"type": {
"description": "What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction.",
"default": "downwards",
"default": "upwards",
"$ref": "#/definitions/TornadoType"
},
"wanderDegreesX": {
@ -1665,13 +1665,13 @@
"type": "string",
"description": "",
"x-enumNames": [
"Downwards",
"Upwards",
"Downwards",
"Hurricane"
],
"enum": [
"downwards",
"upwards",
"downwards",
"hurricane"
]
},
@ -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