mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 03:15:55 +00:00
Auto Pickup
This commit is contained in:
parent
e56b896365
commit
488d02ef81
24 changed files with 148 additions and 19 deletions
|
|
@ -52,6 +52,11 @@ public partial class InventoryManager : Node2D
|
|||
return _itemsDict.TryGetValue(key, out item);
|
||||
}
|
||||
|
||||
public LootItem FindItemInDb(string key)
|
||||
{
|
||||
return ItemsDatabase.GetLootItem(key);
|
||||
}
|
||||
|
||||
public bool HasItems(IList<string> itemKeys)
|
||||
{
|
||||
return itemKeys.Aggregate(false, (current, item) => current || GetItemCount(item) > 0);
|
||||
|
|
@ -87,6 +92,19 @@ public partial class InventoryManager : Node2D
|
|||
|
||||
}
|
||||
|
||||
public bool CanAddItem(string itemKey)
|
||||
{
|
||||
|
||||
var found = TryGetItem(itemKey, out var itm);
|
||||
if (found)
|
||||
{
|
||||
return (itm.Count < itm.Item.Max);
|
||||
}
|
||||
|
||||
var dbItem = FindItemInDb(itemKey);
|
||||
return dbItem != null;
|
||||
}
|
||||
|
||||
public bool AddItem(LootItem item)
|
||||
{
|
||||
//var item = new LootItem() { Item = type, Amount = amount };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue