mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix vessel spawn overriding other spawns
This commit is contained in:
parent
094968187b
commit
5805908e6d
@ -45,7 +45,7 @@ namespace NewHorizons.Handlers
|
|||||||
{
|
{
|
||||||
var vesselConfig = SystemDict[Instance.CurrentStarSystem].Config?.Vessel;
|
var vesselConfig = SystemDict[Instance.CurrentStarSystem].Config?.Vessel;
|
||||||
var shouldSpawnOnVessel = IsVesselPresent() && (vesselConfig?.spawnOnVessel ?? false);
|
var shouldSpawnOnVessel = IsVesselPresent() && (vesselConfig?.spawnOnVessel ?? false);
|
||||||
return Instance.IsWarpingFromVessel || shouldSpawnOnVessel;
|
return !Instance.IsWarpingFromShip && (Instance.IsWarpingFromVessel || shouldSpawnOnVessel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadVessel()
|
public static void LoadVessel()
|
||||||
@ -174,9 +174,6 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
vesselObject.GetComponent<MapMarker>()._labelID = (UITextType)TranslationHandler.AddUI("Vessel");
|
vesselObject.GetComponent<MapMarker>()._labelID = (UITextType)TranslationHandler.AddUI("Vessel");
|
||||||
|
|
||||||
EyeSpawnPoint eyeSpawnPoint = vesselObject.GetComponentInChildren<EyeSpawnPoint>(true);
|
|
||||||
system.SpawnPoint = eyeSpawnPoint;
|
|
||||||
|
|
||||||
var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody);
|
var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody);
|
||||||
var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody;
|
var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody;
|
||||||
|
|
||||||
@ -209,6 +206,12 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EyeSpawnPoint eyeSpawnPoint = vesselObject.GetComponentInChildren<EyeSpawnPoint>(true);
|
||||||
|
if (ShouldSpawnAtVessel())
|
||||||
|
{
|
||||||
|
system.SpawnPoint = eyeSpawnPoint;
|
||||||
|
}
|
||||||
|
|
||||||
vesselObject.SetActive(true);
|
vesselObject.SetActive(true);
|
||||||
|
|
||||||
Delay.FireOnNextUpdate(() => SetupWarpController(vesselWarpController));
|
Delay.FireOnNextUpdate(() => SetupWarpController(vesselWarpController));
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using NewHorizons.Utility;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.Patches.PlayerPatches
|
namespace NewHorizons.Patches.PlayerPatches
|
||||||
@ -15,12 +16,15 @@ namespace NewHorizons.Patches.PlayerPatches
|
|||||||
Logger.LogWarning("Abort player spawn. Vessel will handle it.");
|
Logger.LogWarning("Abort player spawn. Vessel will handle it.");
|
||||||
return false;
|
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);
|
__instance.SetInitialSpawnPoint(Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint);
|
||||||
|
} else if (Main.Instance.CurrentStarSystem != "SolarSystem" && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse")
|
||||||
|
{
|
||||||
|
Logger.LogWarning("No player spawn point set.");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user