Rewrite and simplify Inventory Menu, various fixes for item effects

This commit is contained in:
2025-11-04 01:12:16 -08:00
parent 7b7fc910bd
commit a5846e08dc
49 changed files with 1070 additions and 826 deletions

View File

@@ -19,6 +19,7 @@ public partial class Inventory : Node, IInventory
private const int _maxInventorySize = 20;
public event Action<string> BroadcastMessage;
public event Action InventoryChanged;
public Inventory()
{
@@ -32,10 +33,7 @@ public partial class Inventory : Node, IInventory
{
var isAdded = TryAdd(item);
if (isAdded)
{
BroadcastMessage?.Invoke($"{item.ItemName} picked up.");
item.QueueFree();
}
else
BroadcastMessage?.Invoke($"Could not pick up {item.ItemName}.");
@@ -48,6 +46,7 @@ public partial class Inventory : Node, IInventory
return false;
Items.Add(inventoryItem);
InventoryChanged?.Invoke();
return true;
}
@@ -57,11 +56,15 @@ public partial class Inventory : Node, IInventory
return false;
Items.Insert(index, inventoryItem);
InventoryChanged?.Invoke();
return true;
}
public void Remove(InventoryItem inventoryItem) => Items.Remove(inventoryItem);
public void Remove(InventoryItem inventoryItem)
{
Items.Remove(inventoryItem);
InventoryChanged?.Invoke();
}
public void Sort(EquipableItem currentWeapon, EquipableItem currentArmor, EquipableItem currentAccessory)
{