diff --git a/Subsurface/Source/Items/Components/Door.cs b/Subsurface/Source/Items/Components/Door.cs index a4ce54086..65a6096b2 100644 --- a/Subsurface/Source/Items/Components/Door.cs +++ b/Subsurface/Source/Items/Components/Door.cs @@ -378,7 +378,12 @@ namespace Barotrauma.Items.Components { base.RemoveComponentSpecific(); - GameMain.World.RemoveBody(body.FarseerBody); + if (body != null) + { + body.Remove(); + body = null; + } + if (linkedGap!=null) linkedGap.Remove(); diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index 5495caaec..327c36183 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -1894,8 +1894,11 @@ namespace Barotrauma Removed = true; - //sprite.Remove(); - //if (body != null) body.Remove(); + if (parentInventory != null) + { + parentInventory.RemoveItem(this); + parentInventory = null; + } foreach (ItemComponent ic in components) { @@ -1903,13 +1906,19 @@ namespace Barotrauma } ItemList.Remove(this); + if (body != null) + { + body.Remove(); + body = null; + } + foreach (Item it in ItemList) { if (it.linkedTo.Contains(this)) { it.linkedTo.Remove(this); } - } + } } }