dao::equipment

Hear when equipment goes on or comes off a creature.

Declared in dao/Equipment.h.

Classes

Class  
Change One item equipped or unequipped, as reported to a callback.

Functions

OnEquip()

void OnEquip(std::function<void(const Change &change)> observer)

Registers a callback for every equip, called once the game has handled it.

It runs on the game thread. Loading an area equips every creature’s ammunition, and each of those equips is reported too.

Parameter  
observer receives the item, its slot and whether it was equipped

OnUnequip()

void OnUnequip(std::function<void(const Change &change)> observer)

Registers a callback for every unequip, called once the game has handled it.

It runs on the game thread. When an equip pushes an item out of its slot, that item is reported here with displaced set, before OnEquip reports the item that replaced it.

Parameter  
observer receives the item, the slot it left and whether it came off