Add event publishing for inventory and combat interactions

This commit is contained in:
2025-10-29 02:12:39 +01:00
parent bf15fad9ce
commit d6a31b12e3
14 changed files with 96 additions and 5 deletions

View File

@@ -21,6 +21,10 @@ public class InventorySystem : ISystem
private void OnAddItem(AddItemToInventoryEvent e)
{
var inventory = _world.GetComponent<InventoryComponent>(e.Target);
inventory?.AddItem(e.Item);
if (inventory == null) return;
inventory.AddItem(e.Item);
var newQuantity = inventory.GetItemCount(e.Item.ItemId);
_world.PublishEvent(new InventoryItemChangedEvent(e.Target, e.Item.ItemId, newQuantity));
}
}