mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using HarmonyLib;
|
|
using NewHorizons.Utility;
|
|
using Logger = NewHorizons.Utility.Logger;
|
|
|
|
namespace NewHorizons.Patches.PlayerPatches
|
|
{
|
|
[HarmonyPatch(typeof(PlayerSpawner))]
|
|
public static class PlayerSpawnerPatches
|
|
{
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(nameof(PlayerSpawner.SpawnPlayer))]
|
|
public static bool PlayerSpawner_SpawnPlayer(PlayerSpawner __instance)
|
|
{
|
|
if (Main.Instance.IsWarpingFromVessel || Main.Instance.DidWarpFromVessel)
|
|
{
|
|
Logger.LogWarning("Abort player spawn. Vessel will handle it.");
|
|
return false;
|
|
}
|
|
else if (Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint != null)
|
|
{
|
|
Logger.LogVerbose($"Player spawning at {Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint.transform.GetPath()}");
|
|
__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;
|
|
}
|
|
}
|
|
}
|