Fixed errors in RespawnManager.ClientRead when not using a shuttle, extra diving gear does not spawn when respawning in main sub (TODO: automatically give and equip diving gear if the sub is flooded?)
This commit is contained in:
@@ -353,6 +353,11 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
private IEnumerable<object> ForceShuttleToPos(Vector2 position, float speed)
|
private IEnumerable<object> ForceShuttleToPos(Vector2 position, float speed)
|
||||||
{
|
{
|
||||||
|
if (respawnShuttle == null)
|
||||||
|
{
|
||||||
|
yield return CoroutineStatus.Success;
|
||||||
|
}
|
||||||
|
|
||||||
respawnShuttle.PhysicsBody.FarseerBody.IgnoreCollisionWith(Level.Loaded.TopBarrier);
|
respawnShuttle.PhysicsBody.FarseerBody.IgnoreCollisionWith(Level.Loaded.TopBarrier);
|
||||||
|
|
||||||
while (Math.Abs(position.Y - respawnShuttle.WorldPosition.Y) > 100.0f)
|
while (Math.Abs(position.Y - respawnShuttle.WorldPosition.Y) > 100.0f)
|
||||||
@@ -374,6 +379,8 @@ namespace Barotrauma.Networking
|
|||||||
shuttleTransportTimer = maxTransportTime;
|
shuttleTransportTimer = maxTransportTime;
|
||||||
shuttleReturnTimer = maxTransportTime;
|
shuttleReturnTimer = maxTransportTime;
|
||||||
|
|
||||||
|
if (respawnShuttle == null) return;
|
||||||
|
|
||||||
foreach (Item item in Item.ItemList)
|
foreach (Item item in Item.ItemList)
|
||||||
{
|
{
|
||||||
if (item.Submarine != respawnShuttle) continue;
|
if (item.Submarine != respawnShuttle) continue;
|
||||||
@@ -448,7 +455,7 @@ namespace Barotrauma.Networking
|
|||||||
var server = networkMember as GameServer;
|
var server = networkMember as GameServer;
|
||||||
if (server == null) return;
|
if (server == null) return;
|
||||||
|
|
||||||
var respawnSub = respawnShuttle != null ? respawnShuttle : Submarine.MainSub;
|
var respawnSub = respawnShuttle ?? Submarine.MainSub;
|
||||||
|
|
||||||
var clients = GetClientsToRespawn();
|
var clients = GetClientsToRespawn();
|
||||||
foreach (Client c in clients)
|
foreach (Client c in clients)
|
||||||
@@ -514,31 +521,33 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position;
|
if (respawnShuttle != null)
|
||||||
|
|
||||||
if (divingSuitPrefab != null && oxyPrefab != null)
|
|
||||||
{
|
{
|
||||||
var divingSuit = new Item(divingSuitPrefab, pos, respawnSub);
|
Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position;
|
||||||
Spawner.CreateNetworkEvent(divingSuit, false);
|
if (divingSuitPrefab != null && oxyPrefab != null)
|
||||||
respawnItems.Add(divingSuit);
|
{
|
||||||
|
var divingSuit = new Item(divingSuitPrefab, pos, respawnSub);
|
||||||
|
Spawner.CreateNetworkEvent(divingSuit, false);
|
||||||
|
respawnItems.Add(divingSuit);
|
||||||
|
|
||||||
var oxyTank = new Item(oxyPrefab, pos, respawnSub);
|
var oxyTank = new Item(oxyPrefab, pos, respawnSub);
|
||||||
Spawner.CreateNetworkEvent(oxyTank, false);
|
Spawner.CreateNetworkEvent(oxyTank, false);
|
||||||
divingSuit.Combine(oxyTank);
|
divingSuit.Combine(oxyTank);
|
||||||
respawnItems.Add(oxyTank);
|
respawnItems.Add(oxyTank);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scooterPrefab != null && batteryPrefab != null)
|
if (scooterPrefab != null && batteryPrefab != null)
|
||||||
{
|
{
|
||||||
var scooter = new Item(scooterPrefab, pos, respawnSub);
|
var scooter = new Item(scooterPrefab, pos, respawnSub);
|
||||||
Spawner.CreateNetworkEvent(scooter, false);
|
Spawner.CreateNetworkEvent(scooter, false);
|
||||||
|
|
||||||
var battery = new Item(batteryPrefab, pos, respawnSub);
|
var battery = new Item(batteryPrefab, pos, respawnSub);
|
||||||
Spawner.CreateNetworkEvent(battery, false);
|
Spawner.CreateNetworkEvent(battery, false);
|
||||||
|
|
||||||
scooter.Combine(battery);
|
scooter.Combine(battery);
|
||||||
respawnItems.Add(scooter);
|
respawnItems.Add(scooter);
|
||||||
respawnItems.Add(battery);
|
respawnItems.Add(battery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//give the character the items they would've gotten if they had spawned in the main sub
|
//give the character the items they would've gotten if they had spawned in the main sub
|
||||||
|
|||||||
Reference in New Issue
Block a user