From 86f1fb0b115ff43a101a7a9705eb8698a031bc4d Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 16 Oct 2019 01:10:22 -0500 Subject: [PATCH] fix: set dirty to avoid dupes --- common/traits/receptacle.trait.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/traits/receptacle.trait.js b/common/traits/receptacle.trait.js index ddf9eef..d7f0ca0 100644 --- a/common/traits/receptacle.trait.js +++ b/common/traits/receptacle.trait.js @@ -123,6 +123,7 @@ export class Receptacle extends decorate(Trait) { this.entity.removeItemFromSlot(slotIndex); item.destroy(); } + this.setDirty(); } }; this.qtyListeners.set(item, listener); @@ -206,11 +207,10 @@ export class Receptacle extends decorate(Trait) { if (AVOCADO_SERVER) { listeners.collisionStart = (other) => { if (other.is('item')) { - this.entity.addItemToSlot(other); - const slotIndex = this.itemSlotIndex(other); if (other.is('listed')) { other.list.removeEntity(other); } + this.entity.addItemToSlot(other); } }; } @@ -235,6 +235,7 @@ export class Receptacle extends decorate(Trait) { // CHEATING: assuming this entity is the informed json: item.toNetwork(this.entity), })); + this.setDirty(); } } this.entity.emit('inventoryChanged'); @@ -253,6 +254,7 @@ export class Receptacle extends decorate(Trait) { firstSlotIndex: slotIndex, secondSlotIndex: NULL_SLOT, })); + this.setDirty(); } this.entity.emit('inventoryChanged'); return item;