mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Ship spawn (#711)
## Bug fixes - Allow setting ship spawns in main solar system / separately from the player spawn. Implements #677
This commit is contained in:
commit
72e984f531
@ -259,7 +259,7 @@ namespace NewHorizons.Components.ShipLog
|
||||
if (!name.Equals(uniqueID)) return name;
|
||||
|
||||
// Else we return a default name
|
||||
if (uniqueID.Equals("SolarSystem")) return "Hearthian System";
|
||||
if (uniqueID.Equals("SolarSystem")) return "The Outer Wilds";
|
||||
|
||||
var splitString = uniqueID.Split('.');
|
||||
if (splitString.Length > 1) splitString = splitString.Skip(1).ToArray();
|
||||
|
||||
@ -391,7 +391,8 @@ namespace NewHorizons.Handlers
|
||||
if (defaultPrimaryToSun)
|
||||
{
|
||||
NHLogger.LogError($"Couldn't find {body.Config.Orbit.primaryBody}, defaulting to center of solar system");
|
||||
primaryBody = Locator.GetCenterOfTheUniverse().GetAttachedOWRigidbody().GetComponent<AstroObject>();
|
||||
// TODO: Make this work in other systems. We tried using Locator.GetCenterOfUniverse before but that doesn't work since its too early now
|
||||
primaryBody = SearchUtilities.Find("Sun_Body")?.GetComponent<AstroObject>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -51,11 +51,19 @@ namespace NewHorizons.Handlers
|
||||
// Ensures it has invoked everything and actually placed the player in the cloaking field #671
|
||||
cloak._firstUpdate = true;
|
||||
}
|
||||
|
||||
// Spawn ship
|
||||
Delay.FireInNUpdates(SpawnShip, 30);
|
||||
}
|
||||
|
||||
public static void SpawnShip()
|
||||
{
|
||||
var ship = SearchUtilities.Find("Ship_Body");
|
||||
|
||||
if (SpawnPointBuilder.ShipSpawn != null)
|
||||
{
|
||||
NHLogger.Log("Spawning player ship");
|
||||
|
||||
if (ship != null)
|
||||
{
|
||||
ship.SetActive(true);
|
||||
@ -71,6 +79,12 @@ namespace NewHorizons.Handlers
|
||||
SpawnBody(ship.GetAttachedOWRigidbody(), SpawnPointBuilder.ShipSpawn, pos);
|
||||
}
|
||||
}
|
||||
else if (Main.Instance.CurrentStarSystem != "SolarSystem" && !Main.Instance.IsWarpingFromShip)
|
||||
{
|
||||
NHLogger.Log("System has no ship spawn. Deactivating it.");
|
||||
ship?.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerator SpawnCoroutine(int length)
|
||||
{
|
||||
@ -81,20 +95,6 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
|
||||
InvulnerabilityHandler.MakeInvulnerable(false);
|
||||
|
||||
if (!Main.Instance.IsWarpingFromShip)
|
||||
{
|
||||
if (SpawnPointBuilder.ShipSpawn != null)
|
||||
{
|
||||
NHLogger.Log("Spawning player ship");
|
||||
SpawnShip();
|
||||
}
|
||||
else
|
||||
{
|
||||
NHLogger.Log("System has no ship spawn. Deactivating it.");
|
||||
SearchUtilities.Find("Ship_Body")?.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void FixPlayerVelocity()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user