(4d472a71c) Removing an item after it's been combined doesn't trigger the OnBroken StatusEffects (e.g. combining two half-full flash powder jars doesn't cause them to explode), made all crafting materials disappear after they've been fully used. Closes #1303

This commit is contained in:
Joonas Rikkonen
2019-03-27 13:52:04 +02:00
parent e5fd660479
commit 66af3464a9

View File

@@ -392,13 +392,10 @@ namespace Barotrauma.Items.Components
else
transferAmount = -Math.Min(this.item.Condition, item.MaxCondition - item.Condition);
if (transferAmount == 0.0f)
return false;
this.Item.Condition += transferAmount;
item.Condition -= transferAmount;
if (transferAmount == 0.0f) { return false; }
if (removeOnCombined)
{
if (item.Condition <= 0.0f)
if (item.Condition - transferAmount <= 0.0f)
{
if (item.ParentInventory != null)
{
@@ -408,7 +405,11 @@ namespace Barotrauma.Items.Components
}
Entity.Spawner.AddToRemoveQueue(item);
}
if (this.Item.Condition <= 0.0f)
else
{
item.Condition -= transferAmount;
}
if (this.Item.Condition + transferAmount <= 0.0f)
{
if (this.Item.ParentInventory != null)
{
@@ -418,6 +419,15 @@ namespace Barotrauma.Items.Components
}
Entity.Spawner.AddToRemoveQueue(this.Item);
}
else
{
this.Item.Condition += transferAmount;
}
}
else
{
this.Item.Condition += transferAmount;
item.Condition -= transferAmount;
}
return true;
}