From 3e63affd0f32c273f6dcff41863dca300dd8ae1c Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 21:05:01 -0400 Subject: [PATCH 01/11] Fix ambient light range for stars --- NewHorizons/Builder/Body/StarBuilder.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 000d6dcc..6dd05a5a 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -67,6 +67,9 @@ namespace NewHorizons.Builder.Body ambientLightGO.transform.localPosition = Vector3.zero; ambientLightGO.name = "AmbientLight_Star"; + Light ambientLight = ambientLightGO.GetComponent(); + 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; @@ -89,8 +92,6 @@ namespace NewHorizons.Builder.Body planetDestructionVolume.GetComponent()._shrinkBodies = true; planetDestructionVolume.name = "PlanetDestructionVolume"; - Light ambientLight = ambientLightGO.GetComponent(); - var sunLight = new GameObject("StarLight"); sunLight.transform.parent = starGO.transform; sunLight.transform.localPosition = Vector3.zero; From 1fedc6df47406296b15d124119d4df2b7a8e528f Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 22:22:19 -0400 Subject: [PATCH 02/11] Match with vanilla sun --- NewHorizons/Builder/Body/StarBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 6dd05a5a..b1a481ac 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -87,7 +87,7 @@ namespace NewHorizons.Builder.Body var planetDestructionVolume = Object.Instantiate(deathVolume, starGO.transform); planetDestructionVolume.transform.localPosition = Vector3.zero; planetDestructionVolume.transform.localScale = Vector3.one; - planetDestructionVolume.GetComponent().radius = 0.75f; + planetDestructionVolume.GetComponent().radius = 0.8f; planetDestructionVolume.GetComponent()._onlyAffectsPlayerAndShip = false; planetDestructionVolume.GetComponent()._shrinkBodies = true; planetDestructionVolume.name = "PlanetDestructionVolume"; From 1bfee609689009a267722a4e9fc67ac58f8f425e Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 22:31:26 -0400 Subject: [PATCH 03/11] Stop ambient light from turning into black sphere when alpha is at 0 --- NewHorizons/Builder/Body/StarBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index b1a481ac..65d84c1f 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -107,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.CopyPropertiesFrom(SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent()); From 2196794398821a2c51b2aad1d37a4105c465b092 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 22:33:29 -0400 Subject: [PATCH 04/11] Specify 2 the sequel --- NewHorizons/External/Modules/VariableSize/StarModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/Modules/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs index daffcfa2..560d34af 100644 --- a/NewHorizons/External/Modules/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -53,7 +53,7 @@ namespace NewHorizons.External.Modules.VariableSize public float solarLuminosity = 1f; /// - /// Radius of the supernova. + /// Radius of the supernova. Any planets within 80% of this will be destroyed. /// [DefaultValue(50000f)] [Range(0f, double.MaxValue)] From f11b31b24c422c7d724d6846d7a09a4226b186cd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 11 Aug 2022 02:37:02 +0000 Subject: [PATCH 05/11] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index fe3f88b1..7e36c1c6 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -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 From d08de220f567c90673b52e6bc7b7088be5b10fdd Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 22:41:20 -0400 Subject: [PATCH 06/11] Move 45 to field --- .../Components/SizeControllers/StarEvolutionController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 4f6dfa99..f3491024 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -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(); } From a94aadb8c83c26eab7468c53f4b74d9400a64674 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 22:49:26 -0400 Subject: [PATCH 07/11] Increase range --- NewHorizons/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index aeacc748..8320d3e5 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -386,7 +386,7 @@ namespace NewHorizons var playerLight = playerBody.AddComponent(); playerLight.innerSpotAngle = 0; playerLight.spotAngle = 179; - playerLight.range = 0.5f; + playerLight.range = 1; playerLight.intensity = 0.001f; try From 6b97841e193498e7eff25c0709b4f49d25c2fa91 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 23:03:02 -0400 Subject: [PATCH 08/11] Do it for map as well --- NewHorizons/Main.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 8320d3e5..452201fe 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -389,6 +389,14 @@ namespace NewHorizons playerLight.range = 1; playerLight.intensity = 0.001f; + //Do the same for map + var solarSystemRoot = SearchUtilities.Find("SolarSystemRoot"); + var ssrLight = solarSystemRoot.AddComponent(); + 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}]"); From cded51b41c61fe0c7118d3c8495d72f85b4dd309 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 12 Aug 2022 13:06:26 -0400 Subject: [PATCH 09/11] Animated nomai recorders - #255 Fixes #255 --- NewHorizons/Builder/Props/NomaiTextBuilder.cs | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index 77d9636e..8e7399d1 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -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().enabled = true; From c5176d70363ac2b8ae5afe8147d75d6efc4546a1 Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Fri, 12 Aug 2022 21:39:10 -0500 Subject: [PATCH 10/11] Fix default tornado type --- NewHorizons/External/Modules/PropModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 52ab42c6..70ebc244 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -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 /// /// What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction. /// - [DefaultValue("downwards")] public TornadoType type = TornadoType.Downwards; + [DefaultValue("upwards")] public TornadoType type = TornadoType.Upwards; /// /// Angular distance from the starting position that it will wander, in terms of the angle around the x-axis. From 70b114b39e91fcef02c501748fd0ecbc46be4390 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 13 Aug 2022 02:41:01 +0000 Subject: [PATCH 11/11] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 5cc6a168..2a36d134 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -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" ] },