// Player double-clicks item in inventory
void EquipFromInventory(int32 InventorySlot)
{
FItemInstance Item = InventoryComponent->GetItemAtIndex(InventorySlot);
if (!Item.IsEmpty() && Item.ItemData->bIsEquipable)
{
// Find valid slot
TArray<int32> ValidSlots = EquipmentComponent->FindValidSlotsForItem(Item);
if (ValidSlots.Num() > 0)
{
// Equip to first valid slot
bool bSuccess = EquipmentComponent->EquipItemToSlot(Item, ValidSlots[0]);
if (bSuccess)
{
// Remove from inventory
InventoryComponent->RemoveItemAtIndex(InventorySlot, 1);
}
}
}
}