Move shock effect setting to a separate module

This commit is contained in:
Noah Pilarski 2022-08-18 19:14:44 -04:00
parent 3ab60abb1e
commit 8c937f67ef
5 changed files with 35 additions and 7 deletions

View File

@ -171,7 +171,7 @@ namespace NewHorizons.Builder.Body
}
NHSupernovaPlanetEffectController supernovaPlanetEffect = null;
if (body.Config.Base.hasSupernovaShockEffect && body.Config.Star == null && body.Config.name != "Sun" && body.Config.FocalPoint == null && !body.Config.isStellarRemnant)
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);
}

View File

@ -150,6 +150,11 @@ namespace NewHorizons.External.Configs
/// </summary>
public ShipLogModule ShipLog;
/// <summary>
/// Settings for shock effect on planet when the nearest star goes supernova
/// </summary>
public ShockEffectModule ShockEffect;
/// <summary>
/// Spawn the player at this planet
/// </summary>

View File

@ -56,11 +56,6 @@ namespace NewHorizons.External.Modules
/// </summary>
public bool hasMapMarker;
/// <summary>
/// Does this planet have a shock effect when the nearest star goes supernova?
/// </summary>
[DefaultValue(true)] public bool hasSupernovaShockEffect = true;
/// <summary>
/// Can this planet survive entering a star?
/// </summary>

View File

@ -0,0 +1,28 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External.Modules
{
[JsonObject]
public class ShockEffectModule
{
/// <summary>
/// Does this planet have a shock effect when the nearest star goes supernova? Automatically disabled for stars, focal points, and stellar remnants.
/// </summary>
public bool hasSupernovaShockEffect = true;
/// <summary>
/// Asset Bundle that contains the shock effect mesh
/// </summary>
public string assetBundle;
/// <summary>
/// Path in the asset bundle that leads a replacement mesh for the planet's supernova shock effect
/// </summary>
public string meshPath;
}
}

View File

@ -597,7 +597,7 @@ namespace NewHorizons.Handlers
CloakBuilder.Make(go, sector, rb, body.Config.Cloak, !body.Config.ReferenceFrame.hideInMap, body.Mod);
}
if (body.Config.Base.hasSupernovaShockEffect && body.Config.Star == null && body.Config.name != "Sun" && body.Config.FocalPoint == null)
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);
}