Removing items from their parent inventory in item.Drop

This commit is contained in:
Regalis
2017-01-31 20:11:19 +02:00
parent 0cd2d7a0b9
commit b8263d6a90
2 changed files with 12 additions and 1 deletions
+1
View File
@@ -564,6 +564,7 @@ namespace Barotrauma
if (newItemIDs[i] == 0) if (newItemIDs[i] == 0)
{ {
if (Items[i] != null) Items[i].Drop(); if (Items[i] != null) Items[i].Drop();
System.Diagnostics.Debug.Assert(Items[i]==null);
} }
else else
{ {
+11 -1
View File
@@ -1529,7 +1529,17 @@ namespace Barotrauma
{ {
foreach (ItemComponent ic in components) ic.Drop(dropper); foreach (ItemComponent ic in components) ic.Drop(dropper);
if (Container != null) Container.RemoveContained(this); if (Container != null)
{
Container.RemoveContained(this);
Container = null;
}
if (parentInventory != null)
{
parentInventory.RemoveItem(this);
parentInventory = null;
}
} }
public void Equip(Character character) public void Equip(Character character)