v0.10.6.2

This commit is contained in:
Joonas Rikkonen
2020-10-29 17:55:26 +02:00
parent 20a69375ca
commit bbf06f0984
255 changed files with 6196 additions and 3096 deletions
@@ -151,7 +151,7 @@ namespace Barotrauma
{
if (i < 0 || i >= Items.Length)
{
string errorMsg = "Inventory.TryPutItem failed: index was out of range(" + i + ").\n" + Environment.StackTrace;
string errorMsg = "Inventory.TryPutItem failed: index was out of range(" + i + ").\n" + Environment.StackTrace.CleanupStackTrace();
GameAnalyticsManager.AddErrorEventOnce("Inventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return false;
}
@@ -192,7 +192,7 @@ namespace Barotrauma
{
if (i < 0 || i >= Items.Length)
{
string errorMsg = "Inventory.PutItem failed: index was out of range(" + i + ").\n" + Environment.StackTrace;
string errorMsg = "Inventory.PutItem failed: index was out of range(" + i + ").\n" + Environment.StackTrace.CleanupStackTrace();
GameAnalyticsManager.AddErrorEventOnce("Inventory.PutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return;
}
@@ -304,13 +304,16 @@ namespace Barotrauma
for (int j = 0; j < otherInventory.capacity; j++)
{
if (otherInventory.Items[j] == item) otherInventory.Items[j] = null;
if (otherInventory.Items[j] == item) { otherInventory.Items[j] = null; }
}
for (int j = 0; j < capacity; j++)
{
if (Items[j] == existingItem) Items[j] = null;
if (Items[j] == existingItem) { Items[j] = null; }
}
(otherInventory.Owner as Character)?.DeselectItem(item);
(otherInventory.Owner as Character)?.DeselectItem(existingItem);
bool swapSuccessful = false;
if (otherIsEquipped)
{
@@ -486,6 +489,22 @@ namespace Barotrauma
}
Items[i].Remove();
}
}
}
public List<Item> GetAllItems()
{
List<Item> deletedItems = new List<Item>();
for (int i = 0; i < capacity; i++)
{
if (Items[i] == null) continue;
foreach (ItemContainer itemContainer in Items[i].GetComponents<ItemContainer>())
{
deletedItems.AddRange(itemContainer.Inventory.GetAllItems());
}
deletedItems.Add(Items[i]);
}
return deletedItems;
}
}
}