From 65b8d2d36efdfbe288fe843a3a0f93e039fa1b71 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 24 Jul 2018 13:19:07 +0300 Subject: [PATCH] Fixed door gaps being removed twice when unloading a sub (in door.Remove and Entity.RemoveAll). Probably didn't cause any issues other than unnecessary console warnings. --- .../BarotraumaShared/Source/Items/Components/Door.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs index c86ce633a..9a97d444a 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs @@ -334,9 +334,13 @@ namespace Barotrauma.Items.Components body.Remove(); body = null; } - - - if (linkedGap != null) linkedGap.Remove(); + + //no need to remove the gap if we're unloading the whole submarine + //otherwise the gap will be removed twice and cause console warnings + if (!Submarine.Unloading) + { + if (linkedGap != null) linkedGap.Remove(); + } doorSprite.Remove(); if (weldedSprite != null) weldedSprite.Remove();