fix: set dirty to avoid dupes

This commit is contained in:
cha0s 2019-10-16 01:10:22 -05:00
parent f106371fca
commit 86f1fb0b11

View File

@ -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;