Skip to main content

Overview

All inventories in Bolt implement IBLInventory.

Slots

All inventories store items in slots, rather than directly. Slots can be accessed by their id, which is unique for that inventory instance1.

Gameplay Tags

Each slot may have gameplay tags; these tags can be:

  • Description tags, like Slot.Type.Helmet, which could be used to mark a helmet slot. You could then search for this slot based on this tag.
  • State-based tags, like Bolt.EquipmentSlot.IsEquipped, which means the slot's contents are equipped.
  • Behavioral tags, like Bolt.Slot.DepositDisabled. This tag prevents items from being deposited into the slot.

Slot Capacity

Each slot supports changing the capacity, or maximum stack size, of items it stores. This can be either:

  • Constant: Always be the same number.
  • Multiplier: Multiply by the item definition's default slot capacity.

Each item stack has a default capacity and a maximum capacity. Default capacity works with the slot's multiplier option. Maximum capacity limits the capacity of all instances of that item, even those not deposited in slots. It takes precedence over slot capacity.

Slot CapacityDefault CapacityMax CapacityFinal Capacity
Constant(100)100200100
Constant(75)10010075
Constant(100)1005050
Multiplier(1.5x)100200150
Multiplier(3x)100200200

Uses

  • Maximum Capacity: Set maximum capacity to 1 for items that should never be stackable.
  • Slot Capacity (Multiplier): You may want some inventories to have a larger capacity than others. E.g., a storage chest stores more items per stack than the player's backpack.
  • Slot Capacity (Constant): Some slots should always limit to a single item.

Item Requirements

Item Requirements determine which items can be deposited into that slot. Item requirements are meant to be simple, so they only allow filtering by:

  • Item Definition, only items of a specific item definition are allowed.
  • Item Tags, you can filter based on the item stack's current tags.

Initialization

During initialization, slots from the inventory's initial storage will be copied into the inventory. Any item stack templates defined in the storage will be duplicated for gameplay.

Inventory Init Data

Inventory Storage Def

Inventory storage defs are reusable assets for the inventory's initial storage. For example, suppose you have multiple types of player characters that all share the same layout for their equipment slots. You could create the equipment layout once using a storage def and reuse it for each character.

Inventory Operations

Inventories all implement similar functions for manipulating items.

Withdraw

Withdraw an item stack from a slot.

Deposit

Deposit an item stack to a slot.

Swap

Swapping items between two slots (A, B) is essentially:

  1. Withdraw From SlotA -> ItemStackA
  2. Withdraw From SlotB -> ItemStackB
  3. Deposit (ItemStackA -> SlotB)
  4. Deposit (ItemStackB -> SlotA)

Transfer

Transfer functions operate between inventories. Bolt includes options for transferring from Slot to Slot, Slot to Inventory, or Inventory to Inventory.


  1. If you want to reference an item slot, you can use a BLItemSlotHandle, which holds an Inventory, SlotId pair.