diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index 922192f5..dc4023f3 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -45,7 +45,7 @@ namespace NewHorizons.Handlers { var vesselConfig = SystemDict[Instance.CurrentStarSystem].Config?.Vessel; var shouldSpawnOnVessel = IsVesselPresent() && (vesselConfig?.spawnOnVessel ?? false); - return Instance.IsWarpingFromVessel || shouldSpawnOnVessel; + return !Instance.IsWarpingFromShip && (Instance.IsWarpingFromVessel || shouldSpawnOnVessel); } public static void LoadVessel() @@ -174,9 +174,6 @@ namespace NewHorizons.Handlers vesselObject.GetComponent()._labelID = (UITextType)TranslationHandler.AddUI("Vessel"); - EyeSpawnPoint eyeSpawnPoint = vesselObject.GetComponentInChildren(true); - system.SpawnPoint = eyeSpawnPoint; - var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody); var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody; @@ -209,6 +206,12 @@ namespace NewHorizons.Handlers } } + EyeSpawnPoint eyeSpawnPoint = vesselObject.GetComponentInChildren(true); + if (ShouldSpawnAtVessel()) + { + system.SpawnPoint = eyeSpawnPoint; + } + vesselObject.SetActive(true); Delay.FireOnNextUpdate(() => SetupWarpController(vesselWarpController)); diff --git a/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs b/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs index 80f814fb..11bcc7c1 100644 --- a/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs +++ b/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Utility; using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Patches.PlayerPatches @@ -15,12 +16,15 @@ namespace NewHorizons.Patches.PlayerPatches Logger.LogWarning("Abort player spawn. Vessel will handle it."); return false; } - else + else if (Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint != null) { - Logger.LogVerbose("Player spawning"); + Logger.LogVerbose($"Player spawning at {Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint.transform.GetPath()}"); __instance.SetInitialSpawnPoint(Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint); - return true; + } else if (Main.Instance.CurrentStarSystem != "SolarSystem" && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse") + { + Logger.LogWarning("No player spawn point set."); } + return true; } } }