diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 1c1444ddb..9aaebd2ab 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -281,7 +281,7 @@ namespace Barotrauma listBox.ClearChildren(); characters.Clear(); - WayPoint[] waypoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub, false); + WayPoint[] waypoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub); for (int i = 0; i < waypoints.Length; i++) { diff --git a/Barotrauma/BarotraumaShared/Source/Map/WayPoint.cs b/Barotrauma/BarotraumaShared/Source/Map/WayPoint.cs index 1e371a465..13fbcd339 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/WayPoint.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/WayPoint.cs @@ -490,7 +490,7 @@ namespace Barotrauma return wayPoints[Rand.Int(wayPoints.Count, (useSyncedRand ? Rand.RandSync.Server : Rand.RandSync.Unsynced))]; } - public static WayPoint[] SelectCrewSpawnPoints(List crew, Submarine submarine, bool tryAssignWayPoint = true) + public static WayPoint[] SelectCrewSpawnPoints(List crew, Submarine submarine) { List subWayPoints = WayPointList.FindAll(wp => wp.Submarine == submarine); @@ -524,29 +524,24 @@ namespace Barotrauma assignedWayPoints[i] = wp; break; } - if (assignedWayPoints[i] != null) continue; - if (tryAssignWayPoint) + //try to assign a spawnpoint that isn't meant for any specific job + var nonJobSpecificPoints = subWayPoints.FindAll(wp => wp.spawnType == SpawnType.Human && wp.assignedJob == null); + if (nonJobSpecificPoints.Any()) { - //try to assign a spawnpoint that isn't meant for any specific job - var nonJobSpecificPoints = subWayPoints.FindAll(wp => wp.spawnType == SpawnType.Human && wp.assignedJob == null); - - if (nonJobSpecificPoints.Any()) - { - assignedWayPoints[i] = nonJobSpecificPoints[Rand.Int(nonJobSpecificPoints.Count, Rand.RandSync.Server)]; - } + assignedWayPoints[i] = nonJobSpecificPoints[Rand.Int(nonJobSpecificPoints.Count, Rand.RandSync.Server)]; } if (assignedWayPoints[i] != null) continue; - //everything else failed -> just give a random spawnpoint - assignedWayPoints[i] = GetRandom(SpawnType.Human); + //everything else failed -> just give a random spawnpoint inside the sub + assignedWayPoints[i] = GetRandom(SpawnType.Human, null, submarine, true); } - for (int i = 0; i < assignedWayPoints.Length; i++ ) + for (int i = 0; i < assignedWayPoints.Length; i++) { - if (assignedWayPoints[i]==null) + if (assignedWayPoints[i] == null) { DebugConsole.ThrowError("Couldn't find a waypoint for " + crew[i].Name + "!"); assignedWayPoints[i] = WayPointList[0];