c++ and BP implementation of a full-feature inventory system
Features:
- BP_InventoryComponent which extends a c++ InventoryComponent containing all inventory-related functionality.
- Depositing items into stacks of varying sizes. Stack size and type dictated by data tables.
- Swapping two stacks of different types.
- Drag and drop UI. Makes calls to different methods in inventory component to facilitate changes.
- Splitting stacks.
- Fully supported interactions between inventories (containers, armour).
- Restricting inventory slots to certain types (Armour)
Full support for all interactions within and between other inventory objects.
Items are stored in slots, and their max stack size is dictated by a data table. Items slots of the same item are filled before empty slots are utilized.
By setting an item type and setting a slot restriction, items cannot fill certain slots unless they are of the type. Swapping, splitting and dropping are safe operations to make and won't break the slot restrictions.
Here, the UI shows slot restrictions by an icon. The right items can be dropped to fill them in.
Holding Shift and dragging off from an item will split the stack if more than one exists. If it's an odd number, the stack's origin will retain the extra item. It can be dropped into an empty slot or added onto a stack of the same item with available space.