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.Configs;
|
||||||
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
public static class CometTailBuilder
|
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();
|
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);
|
var cometTail = GameObject.Instantiate(_tailPrefab, sector?.transform ?? planetGO.transform);
|
||||||
cometTail.transform.position = planetGO.transform.position;
|
cometTail.transform.position = planetGO.transform.position;
|
||||||
cometTail.name = "CometTail";
|
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);
|
var alignment = new Vector3(0, 270, 90);
|
||||||
if (config.Base.cometTailRotation != null) alignment = config.Base.cometTailRotation;
|
if (cometTailModule.rotationOverride != null) alignment = cometTailModule.rotationOverride;
|
||||||
|
|
||||||
cometTail.transform.rotation = Quaternion.Euler(alignment);
|
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)
|
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")]
|
[JsonObject(Title = "Celestial Body")]
|
||||||
public class PlanetConfig
|
public class PlanetConfig
|
||||||
{
|
{
|
||||||
|
#region Fields
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique name of your planet
|
/// Unique name of your planet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,6 +33,34 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue("SolarSystem")] public string starSystem = "SolarSystem";
|
[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>
|
/// <summary>
|
||||||
/// Add ambient lights to this body
|
/// Add ambient lights to this body
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -57,37 +86,11 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public BrambleModule Bramble;
|
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>
|
/// <summary>
|
||||||
/// Add a cloaking field to this planet
|
/// Add a cloaking field to this planet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CloakModule Cloak;
|
public CloakModule Cloak;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// `true` if you want to delete this planet
|
|
||||||
/// </summary>
|
|
||||||
public bool destroy;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make this body into a focal point (barycenter)
|
/// Make this body into a focal point (barycenter)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -103,16 +106,6 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public HeightMapModule HeightMap;
|
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>
|
/// <summary>
|
||||||
/// Add lava to this planet
|
/// Add lava to this planet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -138,11 +131,6 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ReferenceFrameModule ReferenceFrame;
|
public ReferenceFrameModule ReferenceFrame;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of paths to child GameObjects to destroy on this planet
|
|
||||||
/// </summary>
|
|
||||||
public string[] removeChildren;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create rings around the planet
|
/// Create rings around the planet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -183,11 +171,35 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumesModule Volumes;
|
public VolumesModule Volumes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a comet tail to this body, like the Interloper
|
||||||
|
/// </summary>
|
||||||
|
public CometTailModule CometTail;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extra data that may be used by extension mods
|
/// Extra data that may be used by extension mods
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object extras;
|
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()
|
public PlanetConfig()
|
||||||
{
|
{
|
||||||
// Always have to have a base module
|
// 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>
|
/// </summary>
|
||||||
public bool centerOfSolarSystem;
|
public bool centerOfSolarSystem;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If it has a comet tail, it'll be oriented according to these Euler angles.
|
|
||||||
/// </summary>
|
|
||||||
public MVector3 cometTailRotation;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.
|
/// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -41,11 +36,6 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float groundSize;
|
public float groundSize;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If you want the body to have a tail like the Interloper.
|
|
||||||
/// </summary>
|
|
||||||
public bool hasCometTail;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If the body should have a marker on the map screen.
|
/// If the body should have a marker on the map screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -116,6 +106,12 @@ namespace NewHorizons.External.Modules
|
|||||||
[Obsolete("zeroGravityRadius is deprecated, please use Volumes->ZeroGravityVolumes instead")]
|
[Obsolete("zeroGravityRadius is deprecated, please use Volumes->ZeroGravityVolumes instead")]
|
||||||
public float zeroGravityRadius;
|
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
|
#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);
|
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)
|
if (body.Config.Lava != null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user