Additional cargo isn't spawned in shuttles, fixed exception if trying to spawn additional cargo in a sub with no cargo spawnpoint, netlobby chatMsgBox stays selected after sending a chat message

This commit is contained in:
Regalis
2016-10-08 18:02:10 +03:00
parent 1ba87165b0
commit 1b66e51970
2 changed files with 13 additions and 4 deletions
+11 -2
View File
@@ -963,9 +963,18 @@ namespace Barotrauma.Networking
} }
} }
foreach (Submarine sub in Submarine.Loaded) foreach (Submarine sub in Submarine.MainSubs)
{ {
if (sub == null) continue;
WayPoint cargoSpawnPos = WayPoint.GetRandom(SpawnType.Cargo, null, sub); WayPoint cargoSpawnPos = WayPoint.GetRandom(SpawnType.Cargo, null, sub);
if (cargoSpawnPos == null)
{
DebugConsole.ThrowError("Couldn't spawn additional cargo (cargo spawnpoint now found)");
continue;
}
var cargoRoom = cargoSpawnPos.CurrentHull; var cargoRoom = cargoSpawnPos.CurrentHull;
Vector2 position = new Vector2( Vector2 position = new Vector2(
cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f, false), cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f, false),
@@ -980,7 +989,7 @@ namespace Barotrauma.Networking
{ {
Item.Spawner.QueueItem(itemPrefab, position, sub, false); Item.Spawner.QueueItem(itemPrefab, position, sub, false);
} }
} }
} }
@@ -251,8 +251,8 @@ namespace Barotrauma.Networking
if (string.IsNullOrWhiteSpace(message)) return false; if (string.IsNullOrWhiteSpace(message)) return false;
SendChatMessage(message); SendChatMessage(message);
textBox.Deselect(); if (textBox == chatMsgBox) textBox.Deselect();
return true; return true;
} }