Items are removed from their parent inventory and their bodies are removed when Item.Remove is called
This commit is contained in:
@@ -378,7 +378,12 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
base.RemoveComponentSpecific();
|
base.RemoveComponentSpecific();
|
||||||
|
|
||||||
GameMain.World.RemoveBody(body.FarseerBody);
|
if (body != null)
|
||||||
|
{
|
||||||
|
body.Remove();
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (linkedGap!=null) linkedGap.Remove();
|
if (linkedGap!=null) linkedGap.Remove();
|
||||||
|
|
||||||
|
|||||||
@@ -1894,8 +1894,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Removed = true;
|
Removed = true;
|
||||||
|
|
||||||
//sprite.Remove();
|
if (parentInventory != null)
|
||||||
//if (body != null) body.Remove();
|
{
|
||||||
|
parentInventory.RemoveItem(this);
|
||||||
|
parentInventory = null;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (ItemComponent ic in components)
|
foreach (ItemComponent ic in components)
|
||||||
{
|
{
|
||||||
@@ -1903,6 +1906,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
ItemList.Remove(this);
|
ItemList.Remove(this);
|
||||||
|
|
||||||
|
if (body != null)
|
||||||
|
{
|
||||||
|
body.Remove();
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Item it in ItemList)
|
foreach (Item it in ItemList)
|
||||||
{
|
{
|
||||||
if (it.linkedTo.Contains(this))
|
if (it.linkedTo.Contains(this))
|
||||||
|
|||||||
Reference in New Issue
Block a user