Fixes to respawn shuttle bugs that may have caused entity ID mismatches: clients don't remove gaps or undock docking ports when a respawn shuttle leaves the level (but instead receive network events that tell them to do so), removing gaps is done with EntitySpawner.

This commit is contained in:
Joonas Rikkonen
2018-07-23 22:51:52 +03:00
parent 002e63f1eb
commit 852fc174c2
@@ -277,15 +277,15 @@ namespace Barotrauma.Networking
if (door.IsOpen) door.SetState(false,false,true); if (door.IsOpen) door.SetState(false,false,true);
} }
var server = networkMember as GameServer;
if (server == null) return;
var shuttleGaps = Gap.GapList.FindAll(g => g.Submarine == respawnShuttle && g.ConnectedWall != null); var shuttleGaps = Gap.GapList.FindAll(g => g.Submarine == respawnShuttle && g.ConnectedWall != null);
shuttleGaps.ForEach(g => g.Remove()); shuttleGaps.ForEach(g => Spawner.AddToRemoveQueue(g));
var dockingPorts = Item.ItemList.FindAll(i => i.Submarine == respawnShuttle && i.GetComponent<DockingPort>() != null); var dockingPorts = Item.ItemList.FindAll(i => i.Submarine == respawnShuttle && i.GetComponent<DockingPort>() != null);
dockingPorts.ForEach(d => d.GetComponent<DockingPort>().Undock()); dockingPorts.ForEach(d => d.GetComponent<DockingPort>().Undock());
var server = networkMember as GameServer;
if (server == null) return;
//shuttle has returned if the path has been traversed or the shuttle is close enough to the exit //shuttle has returned if the path has been traversed or the shuttle is close enough to the exit
if (!CoroutineManager.IsCoroutineRunning("forcepos")) if (!CoroutineManager.IsCoroutineRunning("forcepos"))
@@ -405,7 +405,7 @@ namespace Barotrauma.Networking
} }
var shuttleGaps = Gap.GapList.FindAll(g => g.Submarine == respawnShuttle && g.ConnectedWall != null); var shuttleGaps = Gap.GapList.FindAll(g => g.Submarine == respawnShuttle && g.ConnectedWall != null);
shuttleGaps.ForEach(g => g.Remove()); shuttleGaps.ForEach(g => Spawner.AddToRemoveQueue(g));
foreach (Hull hull in Hull.hullList) foreach (Hull hull in Hull.hullList)
{ {
@@ -427,7 +427,7 @@ namespace Barotrauma.Networking
foreach (Item item in c.Inventory.Items) foreach (Item item in c.Inventory.Items)
{ {
if (item == null) continue; if (item == null) continue;
Entity.Spawner.AddToRemoveQueue(item); Spawner.AddToRemoveQueue(item);
} }
} }