diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs
index d190244a..1be21be7 100644
--- a/NewHorizons/External/Configs/StarSystemConfig.cs
+++ b/NewHorizons/External/Configs/StarSystemConfig.cs
@@ -69,28 +69,23 @@ namespace NewHorizons.External.Configs
public string travelAudio;
///
- /// Coordinates that the vessel can use to warp to your solar system.
+ /// Configure warping to this system with the vessel
///
+ public VesselModule Vessel;
+
+ [Obsolete("coords is deprecated, please use Vessel.coords instead")]
public NomaiCoordinates coords;
- ///
- /// The position in the solar system the vessel will warp to.
- ///
+ [Obsolete("vesselPosition is deprecated, please use Vessel.vesselPosition instead")]
public MVector3 vesselPosition;
- ///
- /// Euler angles by which the vessel will be oriented.
- ///
+ [Obsolete("vesselRotation is deprecated, please use Vessel.vesselRotation instead")]
public MVector3 vesselRotation;
- ///
- /// The relative position to the vessel that you will be teleported to when you exit the vessel through the black hole.
- ///
+ [Obsolete("warpExitPosition is deprecated, please use Vessel.warpExitPosition instead")]
public MVector3 warpExitPosition;
- ///
- /// Euler angles by which the warp exit will be oriented.
- ///
+ [Obsolete("warpExitRotation is deprecated, please use Vessel.warpExitRotation instead")]
public MVector3 warpExitRotation;
///
@@ -189,6 +184,35 @@ namespace NewHorizons.External.Configs
public string backPath;
}
+ [JsonObject]
+ public class VesselModule
+ {
+ ///
+ /// Coordinates that the vessel can use to warp to your solar system.
+ ///
+ public NomaiCoordinates coords;
+
+ ///
+ /// The position in the solar system the vessel will warp to.
+ ///
+ public MVector3 vesselPosition;
+
+ ///
+ /// Euler angles by which the vessel will be oriented.
+ ///
+ public MVector3 vesselRotation;
+
+ ///
+ /// The relative position to the vessel that you will be teleported to when you exit the vessel through the black hole.
+ ///
+ public MVector3 warpExitPosition;
+
+ ///
+ /// Euler angles by which the warp exit will be oriented.
+ ///
+ public MVector3 warpExitRotation;
+ }
+
///
/// Makes sure they are all numbers are unique and between 0 and 5.
///
@@ -196,11 +220,11 @@ namespace NewHorizons.External.Configs
public void FixCoordinates()
{
- if (coords != null)
+ if (Vessel?.coords != null)
{
- coords.x = FixAxis(coords.x);
- coords.y = FixAxis(coords.y);
- coords.z = FixAxis(coords.z);
+ Vessel.coords.x = FixAxis(Vessel.coords.x);
+ Vessel.coords.y = FixAxis(Vessel.coords.y);
+ Vessel.coords.z = FixAxis(Vessel.coords.z);
}
}
@@ -226,6 +250,8 @@ namespace NewHorizons.External.Configs
mapRestricted = mapRestricted || otherConfig.mapRestricted;
startHere = startHere || otherConfig.startHere;
+ Vessel = Vessel == null ? otherConfig.Vessel : Vessel;
+
entryPositions = Concatenate(entryPositions, otherConfig.entryPositions);
curiosities = Concatenate(curiosities, otherConfig.curiosities);
initialReveal = Concatenate(initialReveal, otherConfig.initialReveal);
@@ -251,6 +277,18 @@ namespace NewHorizons.External.Configs
Skybox.destroyStarField = skybox.destroyStarField;
}
}
+ if (coords != null || vesselPosition != null || vesselRotation != null || warpExitPosition != null || warpExitRotation != null)
+ {
+ if (Vessel == null)
+ {
+ Vessel = new VesselModule();
+ }
+ Vessel.coords = Vessel.coords ?? coords;
+ Vessel.vesselPosition = Vessel.vesselPosition ?? vesselPosition;
+ Vessel.vesselRotation = Vessel.vesselRotation ?? vesselRotation;
+ Vessel.warpExitPosition = Vessel.warpExitPosition ?? warpExitPosition;
+ Vessel.warpExitRotation = Vessel.warpExitRotation ?? warpExitRotation;
+ }
}
}
}
\ No newline at end of file
diff --git a/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs b/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs
index e03ebdd9..705d4dcb 100644
--- a/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs
+++ b/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs
@@ -32,7 +32,7 @@ namespace NewHorizons.Handlers
{
var systemName = system.UniqueID;
var fact = system.Config.factRequiredForWarp;
- var nomaiCoords = system.Config.coords;
+ var nomaiCoords = system.Config.Vessel?.coords;
if (system.UniqueID == "EyeOfTheUniverse" || nomaiCoords == null) continue;
diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs
index 12dfb26e..1cd7cb10 100644
--- a/NewHorizons/Handlers/VesselWarpHandler.cs
+++ b/NewHorizons/Handlers/VesselWarpHandler.cs
@@ -88,11 +88,11 @@ namespace NewHorizons.Handlers
vesselOrbLocker.InitializeOrbs();
vesselOrbLocker.AddLocks();
- if (system.Config.vesselPosition != null)
- vesselObject.transform.position = system.Config.vesselPosition;
+ if (system.Config.Vessel?.vesselPosition != null)
+ vesselObject.transform.position = system.Config.Vessel.vesselPosition;
- if (system.Config.vesselRotation != null)
- vesselObject.transform.eulerAngles = system.Config.vesselRotation;
+ if (system.Config.Vessel?.vesselRotation != null)
+ vesselObject.transform.eulerAngles = system.Config.Vessel.vesselRotation;
vesselOrbLocker.RemoveLocks();
vesselOrbLocker.AddLockToWarpOrb();
@@ -142,11 +142,11 @@ namespace NewHorizons.Handlers
vesselWarpController._targetWarpPlatform.OnReceiveWarpedBody += OnReceiveWarpedBody;
- if (system.Config.warpExitPosition != null)
- vesselWarpController._targetWarpPlatform.transform.localPosition = system.Config.warpExitPosition;
+ if (system.Config.Vessel?.warpExitPosition != null)
+ vesselWarpController._targetWarpPlatform.transform.localPosition = system.Config.Vessel.warpExitPosition;
- if (system.Config.warpExitRotation != null)
- vesselWarpController._targetWarpPlatform.transform.localEulerAngles = system.Config.warpExitRotation;
+ if (system.Config.Vessel?.warpExitRotation != null)
+ vesselWarpController._targetWarpPlatform.transform.localEulerAngles = system.Config.Vessel.warpExitRotation;
vesselObject.GetComponent()._labelID = (UITextType)TranslationHandler.AddUI("VESSEL");
diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs
index 44980880..12ffc98f 100644
--- a/NewHorizons/Main.cs
+++ b/NewHorizons/Main.cs
@@ -127,11 +127,14 @@ namespace NewHorizons
Config =
{
destroyStockPlanets = false,
- coords = new StarSystemConfig.NomaiCoordinates
+ Vessel = new StarSystemConfig.VesselModule()
{
- x = new int[5]{ 0,3,2,1,5 },
- y = new int[5]{ 4,5,3,2,1 },
- z = new int[5]{ 4,1,2,5,0 }
+ coords = new StarSystemConfig.NomaiCoordinates
+ {
+ x = new int[5]{ 0,3,2,1,5 },
+ y = new int[5]{ 4,5,3,2,1 },
+ z = new int[5]{ 4,1,2,5,0 }
+ }
}
}
};
@@ -139,11 +142,14 @@ namespace NewHorizons
{
Config =
{
- coords = new StarSystemConfig.NomaiCoordinates
+ Vessel = new StarSystemConfig.VesselModule()
{
- x = new int[3]{ 1,5,4 },
- y = new int[4]{ 3,0,1,4 },
- z = new int[6]{ 1,2,3,0,5,4 }
+ coords = new StarSystemConfig.NomaiCoordinates
+ {
+ x = new int[3]{ 1,5,4 },
+ y = new int[4]{ 3,0,1,4 },
+ z = new int[6]{ 1,2,3,0,5,4 }
+ }
}
}
};
@@ -340,7 +346,7 @@ namespace NewHorizons
else if (shouldWarpInFromVessel) VesselWarpHandler.TeleportToVessel();
else FindObjectOfType().DebugWarp(SystemDict[_currentStarSystem].SpawnPoint);
- VesselCoordinatePromptHandler.RegisterPrompts(SystemDict.Where(system => system.Value.Config.coords != null).Select(x => x.Value).ToList());
+ VesselCoordinatePromptHandler.RegisterPrompts(SystemDict.Where(system => system.Value.Config.Vessel?.coords != null).Select(x => x.Value).ToList());
}
public void EnableWarpDrive()
diff --git a/NewHorizons/Utility/NewHorizonExtensions.cs b/NewHorizons/Utility/NewHorizonExtensions.cs
index bc63a7a5..c41ba884 100644
--- a/NewHorizons/Utility/NewHorizonExtensions.cs
+++ b/NewHorizons/Utility/NewHorizonExtensions.cs
@@ -158,11 +158,11 @@ namespace NewHorizons.Utility
return transform.rotation * localRotation;
}
- public static bool CheckAllCoordinates(this NomaiCoordinateInterface nomaiCoordinateInterface) => Main.SystemDict.Where(system => system.Value.Config.coords != null).Select(system => new KeyValuePair(system.Key, system.Value.Config.coords)).Any(system => nomaiCoordinateInterface.CheckCoordinates(system.Key, system.Value));
+ public static bool CheckAllCoordinates(this NomaiCoordinateInterface nomaiCoordinateInterface) => Main.SystemDict.Where(system => system.Value.Config.Vessel?.coords != null).Select(system => new KeyValuePair(system.Key, system.Value.Config.Vessel.coords)).Any(system => nomaiCoordinateInterface.CheckCoordinates(system.Key, system.Value));
public static bool CheckAllCoordinates(this NomaiCoordinateInterface nomaiCoordinateInterface, out string selectedSystem)
{
- foreach (KeyValuePair cbs in Main.SystemDict.Where(system => system.Value.Config.coords != null).Select(system => new KeyValuePair(system.Key, system.Value.Config.coords)))
+ foreach (KeyValuePair cbs in Main.SystemDict.Where(system => system.Value.Config.Vessel?.coords != null).Select(system => new KeyValuePair(system.Key, system.Value.Config.Vessel.coords)))
{
if (CheckCoordinates(nomaiCoordinateInterface, cbs.Key, cbs.Value))
{