mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Abort player spawn when warping from vessel
This commit is contained in:
parent
06234a2079
commit
36dd053a08
@ -59,6 +59,7 @@ namespace NewHorizons
|
||||
public bool IsWarpingFromShip { get; private set; } = false;
|
||||
public bool IsWarpingFromVessel { get; private set; } = false;
|
||||
public bool IsWarpingBackToEye { get; internal set; } = false;
|
||||
public bool DidWarpFromVessel { get; private set; } = false;
|
||||
public bool WearingSuit { get; private set; } = false;
|
||||
|
||||
public bool IsChangingStarSystem { get; private set; } = false;
|
||||
@ -414,6 +415,7 @@ namespace NewHorizons
|
||||
|
||||
IsWarpingFromShip = false;
|
||||
IsWarpingFromVessel = false;
|
||||
DidWarpFromVessel = shouldWarpInFromVessel;
|
||||
|
||||
var map = GameObject.FindObjectOfType<MapController>();
|
||||
if (map != null) map._maxPanDistance = FurthestOrbit * 1.5f;
|
||||
@ -490,6 +492,7 @@ namespace NewHorizons
|
||||
|
||||
IsWarpingFromShip = false;
|
||||
IsWarpingFromVessel = false;
|
||||
DidWarpFromVessel = false;
|
||||
}
|
||||
|
||||
//Stop starfield from disappearing when there is no lights
|
||||
@ -783,6 +786,7 @@ namespace NewHorizons
|
||||
_currentStarSystem = newStarSystem;
|
||||
IsWarpingFromShip = warp;
|
||||
IsWarpingFromVessel = vessel;
|
||||
DidWarpFromVessel = false;
|
||||
|
||||
var warpingToEye = newStarSystem == "EyeOfTheUniverse";
|
||||
|
||||
@ -802,6 +806,7 @@ namespace NewHorizons
|
||||
|
||||
IsWarpingFromShip = warp;
|
||||
IsWarpingFromVessel = vessel;
|
||||
DidWarpFromVessel = false;
|
||||
OnChangeStarSystem?.Invoke(newStarSystem);
|
||||
|
||||
Logger.Log($"Warping to {newStarSystem}");
|
||||
|
||||
@ -7,10 +7,19 @@ namespace NewHorizons.Patches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerSpawner), nameof(PlayerSpawner.SpawnPlayer))]
|
||||
public static void PlayerSpawner_SpawnPlayer(PlayerSpawner __instance)
|
||||
public static bool PlayerSpawner_SpawnPlayer(PlayerSpawner __instance)
|
||||
{
|
||||
Logger.LogVerbose("Player spawning");
|
||||
__instance.SetInitialSpawnPoint(Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint);
|
||||
if (Main.Instance.IsWarpingFromVessel || Main.Instance.DidWarpFromVessel)
|
||||
{
|
||||
Logger.LogWarning("Abort player spawn. Vessel will handle it.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogVerbose("Player spawning");
|
||||
__instance.SetInitialSpawnPoint(Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user