private void FindAllInInventory(InventoryModule inventory, List <Entity> list, EntityTags tag) { if (inventory == null) { return; } foreach (var item in inventory.Storage.GetContents()) { if (item.Owner.TagList.HasTag(tag)) { list.Add(item.Owner); } FindAllInInventory(item.Owner.Inventory, list, tag); } }
private Entity FindInInventory(InventoryModule inventory, EntityTags tag) { if (inventory == null) { return(null); } foreach (var item in inventory.Storage.GetContents()) { if (item.Owner.TagList.HasTag(tag)) { return(item.Owner); } Entity found = FindInInventory(item.Owner.Inventory, tag); if (found != null) { return(found); } } return(null); }
private Entity FindInInventory(InventoryModule inventory, string name) { if (inventory == null) { return(null); } foreach (var item in inventory.Storage.GetContents()) { if (item.Owner.Name == name) { return(item.Owner); } Entity found = FindInInventory(item.Owner.Inventory, name); if (found != null) { return(found); } } return(null); }