v0.10.5.1

This commit is contained in:
Juan Pablo Arce
2020-09-22 11:31:56 -03:00
parent 44032d0ae0
commit 0002ad2c50
343 changed files with 12276 additions and 5023 deletions
@@ -237,7 +237,7 @@ namespace Barotrauma
#endif
if (this is CharacterInventory)
{
if (prevInventory != this)
if (prevInventory != this && prevOwnerInventory != this)
{
HumanAIController.ItemTaken(item, user);
}
@@ -405,7 +405,7 @@ namespace Barotrauma
if (item == null) { continue; }
if (item.OwnInventory != null)
{
match = item.OwnInventory.FindItem(predicate, true);
match = item.OwnInventory.FindItem(predicate, recursive: true);
if (match != null)
{
return match;
@@ -416,6 +416,27 @@ namespace Barotrauma
return match;
}
public List<Item> FindAllItems(Func<Item, bool> predicate, bool recursive = false, List<Item> list = null)
{
list ??= new List<Item>();
foreach (var item in Items)
{
if (item == null) { continue; }
if (predicate(item))
{
list.Add(item);
}
if (recursive)
{
if (item.OwnInventory != null)
{
item.OwnInventory.FindAllItems(predicate, recursive: true, list);
}
}
}
return list;
}
public Item FindItemByTag(string tag, bool recursive = false)
{
if (tag == null) { return null; }