mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add optional mesh change for supernova planet effect
This commit is contained in:
parent
8c937f67ef
commit
8d370ac546
@ -173,7 +173,7 @@ namespace NewHorizons.Builder.Body
|
||||
NHSupernovaPlanetEffectController supernovaPlanetEffect = null;
|
||||
if ((body.Config.ShockEffect == null || body.Config.ShockEffect.hasSupernovaShockEffect) && body.Config.Star == null && body.Config.name != "Sun" && body.Config.FocalPoint == null && !body.Config.isStellarRemnant)
|
||||
{
|
||||
supernovaPlanetEffect = SupernovaEffectBuilder.Make(proxy, null, body.Config, procGen, null, null, null, atmosphere, fog);
|
||||
supernovaPlanetEffect = SupernovaEffectBuilder.Make(proxy, null, body.Config, body.Mod, procGen, null, null, null, atmosphere, fog);
|
||||
}
|
||||
|
||||
// Remove all collisions if there are any
|
||||
|
||||
@ -4,12 +4,13 @@ using NewHorizons.External.Configs;
|
||||
using NewHorizons.Components;
|
||||
using System.Linq;
|
||||
using NewHorizons.Handlers;
|
||||
using OWML.Common;
|
||||
|
||||
namespace NewHorizons.Builder.Body
|
||||
{
|
||||
public static class SupernovaEffectBuilder
|
||||
{
|
||||
public static NHSupernovaPlanetEffectController Make(GameObject planetGO, Sector sector, PlanetConfig config, GameObject procGen, Light ambientLight, PlanetaryFogController fog, LODGroup atmosphere, Renderer atmosphereRenderer, Renderer fogImpostor)
|
||||
public static NHSupernovaPlanetEffectController Make(GameObject planetGO, Sector sector, PlanetConfig config, IModBehaviour mod, GameObject procGen, Light ambientLight, PlanetaryFogController fog, LODGroup atmosphere, Renderer atmosphereRenderer, Renderer fogImpostor)
|
||||
{
|
||||
var vanillaController = planetGO.GetComponentInChildren<SupernovaPlanetEffectController>();
|
||||
if (vanillaController != null)
|
||||
@ -139,6 +140,20 @@ namespace NewHorizons.Builder.Body
|
||||
shockLayer.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||
}
|
||||
|
||||
if (config.ShockEffect != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(config.ShockEffect.assetBundle) && !string.IsNullOrWhiteSpace(config.ShockEffect.meshPath))
|
||||
{
|
||||
var mesh = AssetBundleUtilities.Load<Mesh>(config.ShockEffect.assetBundle, config.ShockEffect.meshPath, mod);
|
||||
if (mesh != null)
|
||||
{
|
||||
shockLayer.GetComponent<MeshFilter>().sharedMesh = mesh;
|
||||
shockLayer.transform.localScale = Vector3.one * 1.1f;
|
||||
shockLayer.transform.rotation = Quaternion.Euler(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return supernovaEffectController;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ namespace NewHorizons.External.Modules
|
||||
public string assetBundle;
|
||||
|
||||
/// <summary>
|
||||
/// Path in the asset bundle that leads a replacement mesh for the planet's supernova shock effect
|
||||
/// Path to the replacement mesh for the planet's supernova shock effect in the supplied asset bundle
|
||||
/// </summary>
|
||||
public string meshPath;
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if ((body.Config.ShockEffect == null || body.Config.ShockEffect.hasSupernovaShockEffect) && body.Config.Star == null && body.Config.name != "Sun" && body.Config.FocalPoint == null)
|
||||
{
|
||||
SupernovaEffectBuilder.Make(go, sector, body.Config, procGen, ambientLight, fog, atmosphere, null, fog?._fogImpostor);
|
||||
SupernovaEffectBuilder.Make(go, sector, body.Config, body.Mod, procGen, ambientLight, fog, atmosphere, null, fog?._fogImpostor);
|
||||
}
|
||||
|
||||
return go;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user