Vessel Position

This commit is contained in:
Noah Pilarski 2022-06-15 15:38:23 -04:00
parent 3c17bfe8fe
commit 77e7ebb20c
2 changed files with 29 additions and 0 deletions

View File

@ -63,6 +63,26 @@ namespace NewHorizons.External.Configs
/// </summary>
public NomaiCoordinates coords;
/// <summary>
/// The position in the solar system the vessel will warp to.
/// </summary>
public MVector3 vesselPosition;
/// <summary>
/// Euler angles by which the vessel will be oriented.
/// </summary>
public MVector3 vesselRotation;
/// <summary>
/// The relative position to the vessel that you will be teleported to when you exit the vessel through the black hole.
/// </summary>
public MVector3 warpExitPosition;
/// <summary>
/// Euler angles by which the warp exit will be oriented.
/// </summary>
public MVector3 warpExitRotation;
public class NomaiCoordinates
{
public int[] x;

View File

@ -359,15 +359,24 @@ namespace NewHorizons
private EyeSpawnPoint CreateVessel()
{
var system = SystemDict[_currentStarSystem];
Logger.Log("Checking for Vessel Prefab");
if (VesselPrefab == null) return null;
Logger.Log("Creating Vessel");
var vesselObject = GameObject.Instantiate(VesselPrefab);
vesselObject.name = VesselPrefab.name;
vesselObject.transform.parent = null;
if (system.Config.vesselPosition != null)
vesselObject.transform.position += system.Config.vesselPosition;
if (system.Config.vesselRotation != null)
vesselObject.transform.eulerAngles = system.Config.vesselRotation;
vesselObject.SetActive(true);
VesselWarpController vesselWarpController = vesselObject.GetComponentInChildren<VesselWarpController>(true);
vesselWarpController._targetWarpPlatform.OnReceiveWarpedBody += (OWRigidbody warpedBody, NomaiWarpPlatform startPlatform, NomaiWarpPlatform targetPlatform) => OnReceiveWarpedBody(vesselObject, warpedBody, startPlatform, targetPlatform);
if (system.Config.warpExitPosition != null)
vesselWarpController._targetWarpPlatform.transform.localPosition = system.Config.warpExitPosition;
if (system.Config.warpExitRotation != null)
vesselObject.transform.localEulerAngles = system.Config.warpExitRotation;
MapMarker mapMarker = vesselObject.AddComponent<MapMarker>();
mapMarker._labelID = (UITextType)TranslationHandler.AddUI("Vessel");
mapMarker._markerType = MapMarker.MarkerType.Planet;