This commit is contained in:
Evil Factory
2021-12-16 15:09:48 -03:00
10 changed files with 34 additions and 21 deletions
@@ -266,7 +266,6 @@ namespace Barotrauma.Items.Components
}
int amount = (int)amountMultiplier;
for (int i = 0; i < amount; i++)
{
Entity.Spawner.AddToSpawnQueue(itemPrefab, outputContainer.Inventory, condition, onSpawned: (Item spawnedItem) =>
@@ -276,16 +275,24 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < outputContainer.Capacity; i++)
{
var containedItem = outputContainer.Inventory.GetItemAt(i);
bool combined = false;
if (containedItem?.OwnInventory != null)
{
foreach (Item subItem in containedItem.ContainedItems.ToList())
{
if (subItem.Combine(spawnedItem, null)) { break; }
if (subItem.Combine(spawnedItem, null))
{
combined = true;
break;
}
}
}
else if (containedItem?.Combine(spawnedItem, null) ?? false)
if (!combined)
{
break;
if (containedItem?.Combine(spawnedItem, null) ?? false)
{
break;
}
}
}
PutItemsToLinkedContainer();