mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add in comet tail module
This commit is contained in:
parent
a664e7e861
commit
5dd8e8db4e
@ -1,6 +1,8 @@
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Builder.Body
|
||||
{
|
||||
public static class CometTailBuilder
|
||||
@ -12,17 +14,15 @@ namespace NewHorizons.Builder.Body
|
||||
if (_tailPrefab == null) _tailPrefab = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes").InstantiateInactive().Rename("Prefab_CO_Tail").DontDestroyOnLoad();
|
||||
}
|
||||
|
||||
public static void Make(GameObject planetGO, Sector sector, PlanetConfig config)
|
||||
public static void Make(GameObject planetGO, Sector sector, CometTailModule cometTailModule, float surfaceSize)
|
||||
{
|
||||
InitPrefab();
|
||||
|
||||
var cometTail = GameObject.Instantiate(_tailPrefab, sector?.transform ?? planetGO.transform);
|
||||
cometTail.transform.position = planetGO.transform.position;
|
||||
cometTail.name = "CometTail";
|
||||
cometTail.transform.localScale = Vector3.one * config.Base.surfaceSize / 110;
|
||||
cometTail.transform.localScale = Vector3.one * (cometTailModule.innerRadius ?? surfaceSize) / 110;
|
||||
|
||||
Vector3 alignment = new Vector3(0, 270, 90);
|
||||
if (config.Base.cometTailRotation != null) alignment = config.Base.cometTailRotation;
|
||||
var alignment = new Vector3(0, 270, 90);
|
||||
if (cometTailModule.rotationOverride != null) alignment = cometTailModule.rotationOverride;
|
||||
|
||||
cometTail.transform.rotation = Quaternion.Euler(alignment);
|
||||
|
||||
|
||||
@ -194,9 +194,9 @@ namespace NewHorizons.Builder.Body
|
||||
}
|
||||
}
|
||||
|
||||
if (body.Config.Base.hasCometTail)
|
||||
if (body.Config.CometTail != null)
|
||||
{
|
||||
CometTailBuilder.Make(proxy, null, body.Config);
|
||||
CometTailBuilder.Make(proxy, null, body.Config.CometTail, body.Config.Base.surfaceSize);
|
||||
}
|
||||
|
||||
if (body.Config.Props?.proxyDetails != null)
|
||||
|
||||
104
NewHorizons/External/Configs/PlanetConfig.cs
vendored
104
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -21,6 +21,7 @@ namespace NewHorizons.External.Configs
|
||||
[JsonObject(Title = "Celestial Body")]
|
||||
public class PlanetConfig
|
||||
{
|
||||
#region Fields
|
||||
/// <summary>
|
||||
/// Unique name of your planet
|
||||
/// </summary>
|
||||
@ -32,6 +33,34 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
[DefaultValue("SolarSystem")] public string starSystem = "SolarSystem";
|
||||
|
||||
/// <summary>
|
||||
/// Does this config describe a quantum state of a custom planet defined in another file?
|
||||
/// </summary>
|
||||
public bool isQuantumState;
|
||||
|
||||
/// <summary>
|
||||
/// Does this config describe a stellar remnant of a custom star defined in another file?
|
||||
/// </summary>
|
||||
public bool isStellarRemnant;
|
||||
|
||||
/// <summary>
|
||||
/// Should this planet ever be shown on the title screen?
|
||||
/// </summary>
|
||||
[DefaultValue(true)] public bool canShowOnTitle = true;
|
||||
|
||||
/// <summary>
|
||||
/// `true` if you want to delete this planet
|
||||
/// </summary>
|
||||
public bool destroy;
|
||||
|
||||
/// <summary>
|
||||
/// A list of paths to child GameObjects to destroy on this planet
|
||||
/// </summary>
|
||||
public string[] removeChildren;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Modules
|
||||
/// <summary>
|
||||
/// Add ambient lights to this body
|
||||
/// </summary>
|
||||
@ -57,37 +86,11 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public BrambleModule Bramble;
|
||||
|
||||
/// <summary>
|
||||
/// Should this planet ever be shown on the title screen?
|
||||
/// </summary>
|
||||
[DefaultValue(true)] public bool canShowOnTitle = true;
|
||||
|
||||
#region Obsolete
|
||||
|
||||
[Obsolete("ChildrenToDestroy is deprecated, please use RemoveChildren instead")]
|
||||
public string[] childrenToDestroy;
|
||||
|
||||
[Obsolete("Singularity is deprecated, please use Props->singularities")]
|
||||
public SingularityModule Singularity;
|
||||
|
||||
[Obsolete("Signal is deprecated, please use Props->signals")]
|
||||
public SignalModule Signal;
|
||||
|
||||
[Obsolete("Ring is deprecated, please use Rings")]
|
||||
public RingModule Ring;
|
||||
|
||||
#endregion Obsolete
|
||||
|
||||
/// <summary>
|
||||
/// Add a cloaking field to this planet
|
||||
/// </summary>
|
||||
public CloakModule Cloak;
|
||||
|
||||
/// <summary>
|
||||
/// `true` if you want to delete this planet
|
||||
/// </summary>
|
||||
public bool destroy;
|
||||
|
||||
/// <summary>
|
||||
/// Make this body into a focal point (barycenter)
|
||||
/// </summary>
|
||||
@ -103,16 +106,6 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public HeightMapModule HeightMap;
|
||||
|
||||
/// <summary>
|
||||
/// Does this config describe a quantum state of a custom planet defined in another file?
|
||||
/// </summary>
|
||||
public bool isQuantumState;
|
||||
|
||||
/// <summary>
|
||||
/// Does this config describe a stellar remnant of a custom star defined in another file?
|
||||
/// </summary>
|
||||
public bool isStellarRemnant;
|
||||
|
||||
/// <summary>
|
||||
/// Add lava to this planet
|
||||
/// </summary>
|
||||
@ -138,11 +131,6 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public ReferenceFrameModule ReferenceFrame;
|
||||
|
||||
/// <summary>
|
||||
/// A list of paths to child GameObjects to destroy on this planet
|
||||
/// </summary>
|
||||
public string[] removeChildren;
|
||||
|
||||
/// <summary>
|
||||
/// Create rings around the planet
|
||||
/// </summary>
|
||||
@ -183,11 +171,35 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public VolumesModule Volumes;
|
||||
|
||||
/// <summary>
|
||||
/// Add a comet tail to this body, like the Interloper
|
||||
/// </summary>
|
||||
public CometTailModule CometTail;
|
||||
|
||||
/// <summary>
|
||||
/// Extra data that may be used by extension mods
|
||||
/// </summary>
|
||||
public object extras;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Obsolete
|
||||
|
||||
[Obsolete("ChildrenToDestroy is deprecated, please use RemoveChildren instead")]
|
||||
public string[] childrenToDestroy;
|
||||
|
||||
[Obsolete("Singularity is deprecated, please use Props->singularities")]
|
||||
public SingularityModule Singularity;
|
||||
|
||||
[Obsolete("Signal is deprecated, please use Props->signals")]
|
||||
public SignalModule Signal;
|
||||
|
||||
[Obsolete("Ring is deprecated, please use Rings")]
|
||||
public RingModule Ring;
|
||||
|
||||
#endregion Obsolete
|
||||
|
||||
#region ctor validation and migration
|
||||
public PlanetConfig()
|
||||
{
|
||||
// Always have to have a base module
|
||||
@ -566,6 +578,16 @@ namespace NewHorizons.External.Configs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Base.hasCometTail)
|
||||
{
|
||||
CometTail ??= new();
|
||||
if (Base.cometTailRotation != null)
|
||||
{
|
||||
CometTail.rotationOverride = Base.cometTailRotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
16
NewHorizons/External/Modules/BaseModule.cs
vendored
16
NewHorizons/External/Modules/BaseModule.cs
vendored
@ -25,11 +25,6 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public bool centerOfSolarSystem;
|
||||
|
||||
/// <summary>
|
||||
/// If it has a comet tail, it'll be oriented according to these Euler angles.
|
||||
/// </summary>
|
||||
public MVector3 cometTailRotation;
|
||||
|
||||
/// <summary>
|
||||
/// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.
|
||||
/// </summary>
|
||||
@ -41,11 +36,6 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public float groundSize;
|
||||
|
||||
/// <summary>
|
||||
/// If you want the body to have a tail like the Interloper.
|
||||
/// </summary>
|
||||
public bool hasCometTail;
|
||||
|
||||
/// <summary>
|
||||
/// If the body should have a marker on the map screen.
|
||||
/// </summary>
|
||||
@ -116,6 +106,12 @@ namespace NewHorizons.External.Modules
|
||||
[Obsolete("zeroGravityRadius is deprecated, please use Volumes->ZeroGravityVolumes instead")]
|
||||
public float zeroGravityRadius;
|
||||
|
||||
[Obsolete("hasCometTail is deprecated, please use CometTail instead")]
|
||||
public bool hasCometTail;
|
||||
|
||||
[Obsolete("cometTailRotation is deprecated, please use CometTail->rotationOverride instead")]
|
||||
public MVector3 cometTailRotation;
|
||||
|
||||
#endregion Obsolete
|
||||
}
|
||||
}
|
||||
25
NewHorizons/External/Modules/CometTailModule.cs
vendored
Normal file
25
NewHorizons/External/Modules/CometTailModule.cs
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
using NewHorizons.External.SerializableData;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
[JsonObject]
|
||||
public class CometTailModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Manually sets the local rotation
|
||||
/// </summary>
|
||||
public MVector3 rotationOverride;
|
||||
|
||||
/// <summary>
|
||||
/// Inner radius of the comet tail, defaults to match surfaceSize
|
||||
/// </summary>
|
||||
public float? innerRadius;
|
||||
}
|
||||
}
|
||||
@ -599,9 +599,9 @@ namespace NewHorizons.Handlers
|
||||
AsteroidBeltBuilder.Make(body.Config.name, body.Config, body.Mod);
|
||||
}
|
||||
|
||||
if (body.Config.Base.hasCometTail)
|
||||
if (body.Config.CometTail != null)
|
||||
{
|
||||
CometTailBuilder.Make(go, sector, body.Config);
|
||||
CometTailBuilder.Make(go, sector, body.Config.CometTail, body.Config.Base.surfaceSize);
|
||||
}
|
||||
|
||||
if (body.Config.Lava != null)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user