mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Cloak Module
This commit is contained in:
parent
3ed6834f61
commit
855a4caa2f
@ -1,12 +1,14 @@
|
|||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
|
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 CloakBuilder
|
public static class CloakBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject planetGO, Sector sector, OWRigidbody OWRB, float radius, bool keepReferenceFrame)
|
public static void Make(GameObject planetGO, Sector sector, OWRigidbody OWRB, CloakModule module, bool keepReferenceFrame)
|
||||||
{
|
{
|
||||||
|
var radius = module.radius;
|
||||||
var cloak = SearchUtilities.Find("RingWorld_Body/CloakingField_IP");
|
var cloak = SearchUtilities.Find("RingWorld_Body/CloakingField_IP");
|
||||||
|
|
||||||
var newCloak = GameObject.Instantiate(cloak, sector?.transform ?? planetGO.transform);
|
var newCloak = GameObject.Instantiate(cloak, sector?.transform ?? planetGO.transform);
|
||||||
|
|||||||
13
NewHorizons/External/Configs/PlanetConfig.cs
vendored
13
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
@ -45,6 +45,11 @@ namespace NewHorizons.External.Configs
|
|||||||
|
|
||||||
#endregion Obsolete
|
#endregion Obsolete
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a cloaking field to this planet
|
||||||
|
/// </summary>
|
||||||
|
public CloakModule Cloak;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// `true` if you want to delete this planet
|
/// `true` if you want to delete this planet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -192,6 +197,12 @@ namespace NewHorizons.External.Configs
|
|||||||
|
|
||||||
if (childrenToDestroy != null) removeChildren = childrenToDestroy;
|
if (childrenToDestroy != null) removeChildren = childrenToDestroy;
|
||||||
|
|
||||||
|
if (Base.cloakRadius != 0)
|
||||||
|
Cloak = new CloakModule
|
||||||
|
{
|
||||||
|
radius = Base.cloakRadius
|
||||||
|
};
|
||||||
|
|
||||||
if (Base.hasAmbientLight) Base.ambientLight = 0.5f;
|
if (Base.hasAmbientLight) Base.ambientLight = 0.5f;
|
||||||
|
|
||||||
if (Atmosphere != null)
|
if (Atmosphere != null)
|
||||||
|
|||||||
11
NewHorizons/External/Modules/BaseModule.cs
vendored
11
NewHorizons/External/Modules/BaseModule.cs
vendored
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
@ -30,12 +30,6 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool centerOfSolarSystem;
|
public bool centerOfSolarSystem;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you
|
|
||||||
/// don't want a cloak, leave this as 0.
|
|
||||||
/// </summary>
|
|
||||||
public float cloakRadius;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If it has a comet tail, it'll be oriented according to these Euler angles.
|
/// If it has a comet tail, it'll be oriented according to these Euler angles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -112,6 +106,9 @@ namespace NewHorizons.External.Modules
|
|||||||
[Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")]
|
[Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")]
|
||||||
public bool hasAmbientLight;
|
public bool hasAmbientLight;
|
||||||
|
|
||||||
|
[Obsolete("CloakRadius is deprecated, please use CloakModule instead")]
|
||||||
|
public float cloakRadius;
|
||||||
|
|
||||||
#endregion Obsolete
|
#endregion Obsolete
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
19
NewHorizons/External/Modules/CloakModule.cs
vendored
Normal file
19
NewHorizons/External/Modules/CloakModule.cs
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using NewHorizons.Utility;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
|
namespace NewHorizons.External.Modules
|
||||||
|
{
|
||||||
|
[JsonObject]
|
||||||
|
public class CloakModule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you
|
||||||
|
/// don't want a cloak, leave this as 0.
|
||||||
|
/// </summary>
|
||||||
|
public float radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -480,9 +480,9 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Has to go last probably
|
// Has to go last probably
|
||||||
if (body.Config.Base.cloakRadius != 0f)
|
if (body.Config.Cloak != null && body.Config.Cloak.radius != 0f)
|
||||||
{
|
{
|
||||||
CloakBuilder.Make(go, sector, rb, body.Config.Base.cloakRadius, body.Config.Base.hasReferenceFrame);
|
CloakBuilder.Make(go, sector, rb, body.Config.Cloak, body.Config.Base.hasReferenceFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
return go;
|
return go;
|
||||||
|
|||||||
@ -30,6 +30,10 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Should this planet ever be shown on the title screen?"
|
"description": "Should this planet ever be shown on the title screen?"
|
||||||
},
|
},
|
||||||
|
"Cloak": {
|
||||||
|
"description": "Add a cloaking field to this planet",
|
||||||
|
"$ref": "#/definitions/CloakModule"
|
||||||
|
},
|
||||||
"destroy": {
|
"destroy": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "`true` if you want to delete this planet"
|
"description": "`true` if you want to delete this planet"
|
||||||
@ -285,6 +289,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"CloakModule": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"radius": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you\ndon't want a cloak, leave this as 0.",
|
||||||
|
"format": "float"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"CloudInfo": {
|
"CloudInfo": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -384,11 +399,6 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Set this to true if you are replacing the sun with a different body. Only one object in a star system should ever\nhave this set to true."
|
"description": "Set this to true if you are replacing the sun with a different body. Only one object in a star system should ever\nhave this set to true."
|
||||||
},
|
},
|
||||||
"cloakRadius": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you\ndon't want a cloak, leave this as 0.",
|
|
||||||
"format": "float"
|
|
||||||
},
|
|
||||||
"cometTailRotation": {
|
"cometTailRotation": {
|
||||||
"description": "If it has a comet tail, it'll be oriented according to these Euler angles.",
|
"description": "If it has a comet tail, it'll be oriented according to these Euler angles.",
|
||||||
"$ref": "#/definitions/MVector3"
|
"$ref": "#/definitions/MVector3"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user