How-To: Bridge to Equipment
Goal: equip an inventory item on a character and keep the inventory's view of it (the Equipped lock, the slot it sits in) correct across equips, forced unequips and save/load.
1. Name the equipment on the item
Add UCrimsonInventoryItemFragment_Equippable to the item definition and set its equipment definition class. The fragment is data: whatever code performs the equip reads it.
2. Equip, then report the result
On the server, hand the item to your equipment system. When it succeeds, call SetEntryEquipped(EntryId, true, SlotTag, SlotIndex) on the manager; when the item comes off, call it with false. The entry gets the Equipped lock flag and leaves the layout (unless bEquippedItemsOccupyLayout is set).
Switch Has Authority (Authority) -> <your equip call> -> Branch (success) -> Set Entry Equipped (Entry Id = the item's entry, b Equipped = true, Slot Tag / Slot Index = where it landed).
Equipped lock on the client, and Get Entry Equipped Slot returns the slot.3. Re-equip after a load
ApplySaveData restores which entries were equipped but cannot equip them (it knows no equipment system). It queues them: read GetPendingEquips() (FCrimsonInventoryEquippedSlot per entry), equip each through your system, and call ClearPendingEquip(EntryId) as you go. HasPendingEquips tells you whether anything is waiting.
UCrimsonInventoryEquipmentStatics (CanEquipItem, IsItemEquipped, EquipItem, UnequipItem, HasRoomToUnequip, FlushPendingEquips) and UCrimsonInventoryIntegrationSubsystem, which keeps the Equipped flag in sync when equipment is removed by other code. They are a complete reference for steps 2 and 3.See also
- How-To: Save and Restore
- API Reference