From 7e47edecbf8eca54ce8b48def172ccbf64e4a73e Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 14 Jun 2023 15:08:15 -0700 Subject: [PATCH 1/5] StarBuilder: use material instead of sharedMaterial --- NewHorizons/Builder/Body/StarBuilder.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 9a11ede9..5aa75ab4 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -351,7 +351,8 @@ namespace NewHorizons.Builder.Body { // It multiplies color by tint but wants something very bright idk controller._color = new Color(1, 1, 1); - controller.GetComponent().sharedMaterial.SetColor("_Color", controller._color); + // makes new material per flare, even tho they could probably all share one. oh well + controller.GetComponent().material.SetColor("_Color", controller._color); controller._tint = flareTint; } } From b99512a76a3ec6ddb72e38dc8bdc9cb593e594f8 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 14 Jun 2023 15:24:42 -0700 Subject: [PATCH 2/5] update nuget packages --- NewHorizons/NewHorizons.csproj | 2 +- SchemaExporter/SchemaExporter.csproj | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NewHorizons/NewHorizons.csproj b/NewHorizons/NewHorizons.csproj index 20cd9427..722d08c8 100644 --- a/NewHorizons/NewHorizons.csproj +++ b/NewHorizons/NewHorizons.csproj @@ -16,7 +16,7 @@ - + diff --git a/SchemaExporter/SchemaExporter.csproj b/SchemaExporter/SchemaExporter.csproj index 9f0d56c9..0c08c270 100644 --- a/SchemaExporter/SchemaExporter.csproj +++ b/SchemaExporter/SchemaExporter.csproj @@ -18,9 +18,9 @@ PreserveNewest - - - + + + From 047666aff233179b1a89e2bce4d39b2fef1bad12 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 14 Jun 2023 18:42:22 -0400 Subject: [PATCH 3/5] Share one material for all flares on a star --- NewHorizons/Builder/Body/StarBuilder.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 5aa75ab4..a48423ec 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -32,6 +32,7 @@ namespace NewHorizons.Builder.Body private static GameObject _supernovaPrefab; private static Material _mainSequenceMaterial; private static Material _giantMaterial; + private static Material _flareMaterial; private static bool _isInit; @@ -54,6 +55,11 @@ namespace NewHorizons.Builder.Body if (_supernovaPrefab == null) _supernovaPrefab = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/Supernova").InstantiateInactive().Rename("Prefab_Supernova").DontDestroyOnLoad(); if (_mainSequenceMaterial == null) _mainSequenceMaterial = new Material(SearchUtilities.Find("Sun_Body").GetComponent()._startSurfaceMaterial).DontDestroyOnLoad(); if (_giantMaterial == null) _giantMaterial = new Material(SearchUtilities.Find("Sun_Body").GetComponent()._endSurfaceMaterial).DontDestroyOnLoad(); + if (_flareMaterial == null) + { + _flareMaterial = new Material(_starSolarFlareEmitter.GetComponentInChildren().GetComponent().sharedMaterial).DontDestroyOnLoad(); + _flareMaterial.color = Color.white; + } } public static (GameObject, StarController, StarEvolutionController, Light) Make(GameObject planetGO, Sector sector, StarModule starModule, IModBehaviour mod, bool isStellarRemnant) @@ -347,12 +353,11 @@ namespace NewHorizons.Builder.Body var flareTint = starModule.tint.ToColor(); var emitter = solarFlareEmitter.GetComponent(); emitter.tint = flareTint; + var material = new Material(_flareMaterial); foreach (var controller in solarFlareEmitter.GetComponentsInChildren()) { - // It multiplies color by tint but wants something very bright idk + controller.GetComponent().sharedMaterial = material; controller._color = new Color(1, 1, 1); - // makes new material per flare, even tho they could probably all share one. oh well - controller.GetComponent().material.SetColor("_Color", controller._color); controller._tint = flareTint; } } From 29fec52e5834ffffb5526306bd421666bbc3e811 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 14 Jun 2023 18:45:07 -0400 Subject: [PATCH 4/5] Update manifest.json --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 3154f875..5499f8d1 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.11.1", + "version": "1.11.2", "owmlVersion": "2.9.0", "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ], From a705dbc4a8bd2a0a436c44eb2d717d6a97e30e23 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 14 Jun 2023 15:47:25 -0700 Subject: [PATCH 5/5] use Color.white here too --- 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 a48423ec..3b5abd0d 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -357,7 +357,7 @@ namespace NewHorizons.Builder.Body foreach (var controller in solarFlareEmitter.GetComponentsInChildren()) { controller.GetComponent().sharedMaterial = material; - controller._color = new Color(1, 1, 1); + controller._color = Color.white; controller._tint = flareTint; } }