Add isDefault flag to planet spawns

This commit is contained in:
Joshua Thome 2023-03-22 13:36:03 -05:00
parent 6e93ac01f8
commit 094968187b
2 changed files with 9 additions and 1 deletions

View File

@ -29,6 +29,10 @@ namespace NewHorizons.External.Modules
/// If you spawn on a planet with no oxygen, you probably want to set this to true ;;) /// If you spawn on a planet with no oxygen, you probably want to set this to true ;;)
/// </summary> /// </summary>
public bool startWithSuit; public bool startWithSuit;
/// <summary>
/// Whether this planet's spawn point is the one the player will initially spawn at, if multiple spawn points exist.
/// </summary>
public bool isDefault;
} }
[JsonObject] [JsonObject]

View File

@ -454,7 +454,11 @@ namespace NewHorizons.Handlers
if (body.Config.Spawn != null) if (body.Config.Spawn != null)
{ {
Logger.LogVerbose("Making spawn point"); Logger.LogVerbose("Making spawn point");
Main.SystemDict[body.Config.starSystem].SpawnPoint = SpawnPointBuilder.Make(go, body.Config.Spawn, owRigidBody); var spawnPoint = SpawnPointBuilder.Make(go, body.Config.Spawn, owRigidBody);
if (Main.SystemDict[body.Config.starSystem].SpawnPoint == null || (body.Config.Spawn.playerSpawn?.isDefault ?? false))
{
Main.SystemDict[body.Config.starSystem].SpawnPoint = spawnPoint;
}
} }
if (body.Config.Orbit.showOrbitLine && !body.Config.Orbit.isStatic) if (body.Config.Orbit.showOrbitLine && !body.Config.Orbit.isStatic)