Unstable 1.2.4.0

This commit is contained in:
Markus Isberg
2023-11-30 13:53:00 +02:00
parent 8a2e2ea0ae
commit fb5ea537bf
210 changed files with 4201 additions and 1283 deletions
@@ -39,6 +39,23 @@ namespace Barotrauma
}
public Item? FindItemInContainer(ItemContainer? container)
=> container?.Inventory.GetItemsAt(Slot).ElementAt(StackIndex);
{
var items = container?.Inventory.GetItemsAt(Slot);
if (items != null && StackIndex >= 0 && StackIndex < items.Count())
{
return items.ElementAt(StackIndex);
}
else
{
string errorMsg =
$"Circuit box error: failed to find an item in the container {container?.Item.Name ?? "null"}.";
DebugConsole.ThrowError(
errorMsg +
$" Items: {items?.Count().ToString() ?? "null"}, " +
$" Slot: {Slot}, StackIndex: {StackIndex}");
GameAnalyticsManager.AddErrorEventOnce("ItemSlotIndexPair.FindItemInContainer", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
return null;
}
}
}
}