diff --git a/common/traits/receptacle.trait.js b/common/traits/receptacle.trait.js index 795a029..fafaf33 100644 --- a/common/traits/receptacle.trait.js +++ b/common/traits/receptacle.trait.js @@ -229,6 +229,7 @@ export class Receptacle extends decorate(Trait) { else { this.addListenersForItem(item); this.slotItems[slotIndex] = item; + this.entity.emit('itemAdded', item, slotIndex); if (AVOCADO_SERVER) { this.packetUpdates.push(new TraitUpdateReceptacleItemFullPacket({ slotIndex, @@ -247,6 +248,7 @@ export class Receptacle extends decorate(Trait) { } this.removeListenersForItem(item); delete this.slotItems[slotIndex]; + this.entity.emit('itemRemoved', item, slotIndex); if (AVOCADO_SERVER) { this.packetUpdates.push(new TraitUpdateReceptacleItemSwapPacket({ firstSlotIndex: slotIndex, @@ -282,6 +284,13 @@ export class Receptacle extends decorate(Trait) { this.slotItems[rightIndex] = leftItem; this.addListenersForItem(leftItem); this.addListenersForItem(rightItem); + this.entity.emit( + 'itemsSwapped', + leftIndex, + rightIndex, + leftItem, + rightItem + ); }, };