diff --git a/NewHorizons/Builder/Body/SingularityBuilder.cs b/NewHorizons/Builder/Body/SingularityBuilder.cs
index 96466121..1f913ec9 100644
--- a/NewHorizons/Builder/Body/SingularityBuilder.cs
+++ b/NewHorizons/Builder/Body/SingularityBuilder.cs
@@ -10,6 +10,7 @@ using NewHorizons.Components.SizeControllers;
using System.Drawing;
using Color = UnityEngine.Color;
using NewHorizons.Components.Volumes;
+using NewHorizons.Builder.Props;
namespace NewHorizons.Builder.Body
{
@@ -139,26 +140,16 @@ namespace NewHorizons.Builder.Body
// polarity true = black, false = white
- var singularity = new GameObject(!string.IsNullOrEmpty(rename) ? rename : (polarity ? "BlackHole" : "WhiteHole"));
- singularity.transform.parent = sector?.transform ?? planetGO.transform;
-
- if (!string.IsNullOrEmpty(parentPath))
+ var info = new SingularityModule
{
- var newParent = planetGO.transform.Find(parentPath);
- if (newParent != null)
- {
- singularity.transform.parent = newParent;
- }
- else
- {
- Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{parentPath}");
- }
- }
+ position = position,
+ rotation = rotation,
+ isRelativeToParent = isRelativeToParent,
+ parentPath = parentPath,
+ rename = rename,
+ };
- if (isRelativeToParent)
- singularity.transform.localPosition = position;
- else
- singularity.transform.position = planetGO.transform.TransformPoint(position);
+ var singularity = GeneralPropBuilder.MakeNew(polarity ? "BlackHole" : "WhiteHole", planetGO, sector, info);
var singularityRenderer = MakeSingularityGraphics(singularity, polarity, horizon, distort, renderQueue);
@@ -273,12 +264,6 @@ namespace NewHorizons.Builder.Body
whiteHoleFluidVolume.enabled = true;
}
- var rot = Quaternion.Euler(rotation);
- if (isRelativeToParent)
- singularity.transform.localRotation = rot;
- else
- singularity.transform.rotation = planetGO.transform.TransformRotation(rot);
-
singularity.SetActive(true);
return singularity;
}
diff --git a/NewHorizons/External/Modules/VariableSize/SingularityModule.cs b/NewHorizons/External/Modules/VariableSize/SingularityModule.cs
index e0c1041d..eaa1540c 100644
--- a/NewHorizons/External/Modules/VariableSize/SingularityModule.cs
+++ b/NewHorizons/External/Modules/VariableSize/SingularityModule.cs
@@ -9,7 +9,7 @@ using Newtonsoft.Json.Converters;
namespace NewHorizons.External.Modules.VariableSize
{
[JsonObject]
- public class SingularityModule : VariableSizeModule
+ public class SingularityModule : PropModule.PositionedAndRotatedPropInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public enum SingularityType
@@ -19,6 +19,11 @@ namespace NewHorizons.External.Modules.VariableSize
[EnumMember(Value = @"whiteHole")] WhiteHole = 1
}
+ ///
+ /// Scale this object over time
+ ///
+ public TimeValuePair[] curve;
+
///
/// The uniqueID of the white hole or black hole that is paired to this one. If you don't set a value, entering will kill
/// the player
@@ -30,16 +35,6 @@ namespace NewHorizons.External.Modules.VariableSize
///
public string uniqueID;
- ///
- /// Position of the singularity
- ///
- public MVector3 position;
-
- ///
- /// Rotation of the singularity. Determines the direction you come out of a white hole
- ///
- public MVector3 rotation;
-
///
/// Radius of the singularity. Note that this isn't the same as the event horizon, but includes the entire volume that
/// has warped effects in it.
@@ -75,20 +70,5 @@ namespace NewHorizons.External.Modules.VariableSize
/// Optional override for the render queue. If the singularity is rendering oddly, increasing this to 3000 can help
///
[Range(2501f, 3500f)] public int renderQueueOverride = 2985;
-
- ///
- /// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
- ///
- public string parentPath;
-
- ///
- /// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
- ///
- public bool isRelativeToParent;
-
- ///
- /// An optional rename of this object
- ///
- public string rename;
}
}
\ No newline at end of file