fix: packet clearing

This commit is contained in:
cha0s 2019-09-30 22:28:55 -05:00
parent 15a46d3668
commit 4f7b0c74aa
2 changed files with 10 additions and 6 deletions

View File

@ -128,6 +128,10 @@ export class Vulnerable extends Trait {
this._hasAddedEmitterRenderer = true;
}
cleanPackets() {
this.damages = [];
}
get isInvulnerable() {
return this._isInvulnerable;
}
@ -138,9 +142,7 @@ export class Vulnerable extends Trait {
packets(informed) {
if (this.damages.length > 0) {
const {damages} = this;
this.damages = [];
return new DamagePacket(damages);
return new DamagePacket(this.damages);
}
}

View File

@ -57,6 +57,10 @@ export class Receptacle extends decorate(Trait) {
}
}
cleanPackets() {
this.packetUpdates = [];
}
destroy() {
for (let i = 0; i < this.entity.slotCount; ++i) {
const item = this.entity.removeItemFromSlot(i);
@ -133,9 +137,7 @@ export class Receptacle extends decorate(Trait) {
}
packets(informed) {
const packetsForUpdate = this.packetUpdates;
this.packetUpdates = [];
return packetsForUpdate;
return this.packetUpdates;
}
removeListenersForItem(item) {