From 852fc174c2abe34cd37f853a63c83cad517ab22b Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 23 Jul 2018 22:51:52 +0300 Subject: [PATCH] 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. --- .../Source/Networking/RespawnManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Networking/RespawnManager.cs b/Barotrauma/BarotraumaShared/Source/Networking/RespawnManager.cs index f32d873ce..d32650e6d 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/RespawnManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/RespawnManager.cs @@ -277,15 +277,15 @@ namespace Barotrauma.Networking 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); - shuttleGaps.ForEach(g => g.Remove()); + shuttleGaps.ForEach(g => Spawner.AddToRemoveQueue(g)); var dockingPorts = Item.ItemList.FindAll(i => i.Submarine == respawnShuttle && i.GetComponent() != null); dockingPorts.ForEach(d => d.GetComponent().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 if (!CoroutineManager.IsCoroutineRunning("forcepos")) @@ -405,7 +405,7 @@ namespace Barotrauma.Networking } 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) { @@ -427,7 +427,7 @@ namespace Barotrauma.Networking foreach (Item item in c.Inventory.Items) { if (item == null) continue; - Entity.Spawner.AddToRemoveQueue(item); + Spawner.AddToRemoveQueue(item); } }