(Mostly) show status update when using an item. Need to fix up the equipping code here
This commit is contained in:
@@ -25,9 +25,17 @@ public interface IInventory : INode
|
||||
|
||||
public bool IsEquipped(IEquipable equipable);
|
||||
|
||||
public void Use(IInventoryItem inventoryItem);
|
||||
|
||||
public void Throw(IInventoryItem inventoryItem);
|
||||
|
||||
public void Drop(IInventoryItem inventoryItem);
|
||||
|
||||
event Inventory.InventoryAtCapacityEventHandler InventoryAtCapacity;
|
||||
|
||||
event Inventory.AccessoryUnequippedEventHandler AccessoryUnequipped;
|
||||
|
||||
event Inventory.RaiseStatRequestEventHandler RaiseStatRequest;
|
||||
}
|
||||
|
||||
public partial class Inventory : Node, IInventory
|
||||
@@ -39,6 +47,8 @@ public partial class Inventory : Node, IInventory
|
||||
public delegate void InventoryAtCapacityEventHandler(string rejectedItemName);
|
||||
[Signal]
|
||||
public delegate void AccessoryUnequippedEventHandler(AccessoryStats unequippedAccessory);
|
||||
[Signal]
|
||||
public delegate void RaiseStatRequestEventHandler(ConsumableItemStats consumableItemStats);
|
||||
|
||||
public Inventory()
|
||||
{
|
||||
@@ -108,4 +118,23 @@ public partial class Inventory : Node, IInventory
|
||||
else
|
||||
throw new NotImplementedException("Item type is not supported.");
|
||||
}
|
||||
|
||||
public void Use(IInventoryItem item)
|
||||
{
|
||||
if (item is ConsumableItem consumableItem)
|
||||
{
|
||||
EmitSignal(SignalName.RaiseStatRequest, consumableItem.ConsumableItemInfo);
|
||||
Remove(consumableItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void Throw(IInventoryItem item)
|
||||
{
|
||||
Remove(item);
|
||||
}
|
||||
|
||||
public void Drop(IInventoryItem item)
|
||||
{
|
||||
Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user