diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 000d6dcc..65d84c1f 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; @@ -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().radius = 0.75f; + planetDestructionVolume.GetComponent().radius = 0.8f; planetDestructionVolume.GetComponent()._onlyAffectsPlayerAndShip = false; 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; @@ -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.CopyPropertiesFrom(SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent()); 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; 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(); } 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. 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)] diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index aafed90f..7b51f660 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -388,9 +388,17 @@ namespace NewHorizons var playerLight = playerBody.AddComponent(); 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(); + 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}]"); diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 5cc6a168..aecdc6be 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" ] }, @@ -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