(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:
@@ -392,13 +392,10 @@ namespace Barotrauma.Items.Components
|
|||||||
else
|
else
|
||||||
transferAmount = -Math.Min(this.item.Condition, item.MaxCondition - item.Condition);
|
transferAmount = -Math.Min(this.item.Condition, item.MaxCondition - item.Condition);
|
||||||
|
|
||||||
if (transferAmount == 0.0f)
|
if (transferAmount == 0.0f) { return false; }
|
||||||
return false;
|
|
||||||
this.Item.Condition += transferAmount;
|
|
||||||
item.Condition -= transferAmount;
|
|
||||||
if (removeOnCombined)
|
if (removeOnCombined)
|
||||||
{
|
{
|
||||||
if (item.Condition <= 0.0f)
|
if (item.Condition - transferAmount <= 0.0f)
|
||||||
{
|
{
|
||||||
if (item.ParentInventory != null)
|
if (item.ParentInventory != null)
|
||||||
{
|
{
|
||||||
@@ -408,7 +405,11 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
Entity.Spawner.AddToRemoveQueue(item);
|
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)
|
if (this.Item.ParentInventory != null)
|
||||||
{
|
{
|
||||||
@@ -418,6 +419,15 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
Entity.Spawner.AddToRemoveQueue(this.Item);
|
Entity.Spawner.AddToRemoveQueue(this.Item);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Item.Condition += transferAmount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Item.Condition += transferAmount;
|
||||||
|
item.Condition -= transferAmount;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user