fix solar flare tinting base game sun (#606)

<!-- A new module or something else important -->
## Major features
-

<!-- A new parameter added to a module, or API feature -->
## Minor features
-

<!-- Some improvement that requires no action on the part of add-on
creators i.e., improved star graphics -->
## Improvements
-

<!-- Be sure to reference the existing issue if it exists -->
## Bug fixes
- Fix solar system sun solar flares becoming white sometimes (resolves
#605)
This commit is contained in:
Nick 2023-06-14 18:52:39 -04:00 committed by GitHub
commit 3fc0f5e059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 8 deletions

View File

@ -32,6 +32,7 @@ namespace NewHorizons.Builder.Body
private static GameObject _supernovaPrefab; private static GameObject _supernovaPrefab;
private static Material _mainSequenceMaterial; private static Material _mainSequenceMaterial;
private static Material _giantMaterial; private static Material _giantMaterial;
private static Material _flareMaterial;
private static bool _isInit; 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 (_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<SunController>()._startSurfaceMaterial).DontDestroyOnLoad(); if (_mainSequenceMaterial == null) _mainSequenceMaterial = new Material(SearchUtilities.Find("Sun_Body").GetComponent<SunController>()._startSurfaceMaterial).DontDestroyOnLoad();
if (_giantMaterial == null) _giantMaterial = new Material(SearchUtilities.Find("Sun_Body").GetComponent<SunController>()._endSurfaceMaterial).DontDestroyOnLoad(); if (_giantMaterial == null) _giantMaterial = new Material(SearchUtilities.Find("Sun_Body").GetComponent<SunController>()._endSurfaceMaterial).DontDestroyOnLoad();
if (_flareMaterial == null)
{
_flareMaterial = new Material(_starSolarFlareEmitter.GetComponentInChildren<SolarFlareController>().GetComponent<MeshRenderer>().sharedMaterial).DontDestroyOnLoad();
_flareMaterial.color = Color.white;
}
} }
public static (GameObject, StarController, StarEvolutionController, Light) Make(GameObject planetGO, Sector sector, StarModule starModule, IModBehaviour mod, bool isStellarRemnant) public static (GameObject, StarController, StarEvolutionController, Light) Make(GameObject planetGO, Sector sector, StarModule starModule, IModBehaviour mod, bool isStellarRemnant)
@ -347,11 +353,11 @@ namespace NewHorizons.Builder.Body
var flareTint = starModule.tint.ToColor(); var flareTint = starModule.tint.ToColor();
var emitter = solarFlareEmitter.GetComponent<SolarFlareEmitter>(); var emitter = solarFlareEmitter.GetComponent<SolarFlareEmitter>();
emitter.tint = flareTint; emitter.tint = flareTint;
var material = new Material(_flareMaterial);
foreach (var controller in solarFlareEmitter.GetComponentsInChildren<SolarFlareController>()) foreach (var controller in solarFlareEmitter.GetComponentsInChildren<SolarFlareController>())
{ {
// It multiplies color by tint but wants something very bright idk controller.GetComponent<MeshRenderer>().sharedMaterial = material;
controller._color = new Color(1, 1, 1); controller._color = Color.white;
controller.GetComponent<MeshRenderer>().sharedMaterial.SetColor("_Color", controller._color);
controller._tint = flareTint; controller._tint = flareTint;
} }
} }

View File

@ -16,7 +16,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="OWML" Version="2.9.0" /> <PackageReference Include="OWML" Version="2.9.0" />
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" /> <PackageReference Include="OuterWildsGameLibs" Version="1.1.13.456" />
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" /> <Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book", "author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "1.11.1", "version": "1.11.2",
"owmlVersion": "2.9.0", "owmlVersion": "2.9.0",
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ], "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],

View File

@ -18,9 +18,9 @@
<None Include="UnityEngine.CoreModule.dll"> <None Include="UnityEngine.CoreModule.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NJsonSchema" Version="10.8.0" /> <PackageReference Include="NJsonSchema" Version="10.9.0" />
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" IncludeAssets="compile" /> <PackageReference Include="OuterWildsGameLibs" Version="1.1.13.456" IncludeAssets="compile" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>