fix: remove last

This commit is contained in:
cha0s 2019-05-14 03:41:38 -05:00
parent 3631a7f669
commit 29abc9f540

View File

@ -81,11 +81,6 @@ export class EntityList extends decorate(class {}) {
packets.push(new EntityCreatePacket(entity.toJSON(), entity));
}
this._entitiesJustAdded = [];
for (let i = 0; i < this._entitiesJustRemoved.length; i++) {
const entity = this._entitiesJustRemoved[i];
packets.push(new EntityRemovePacket({}, entity));
}
this._entitiesJustRemoved = [];
}
for (let i = 0; i < this._flatEntities.length; i++) {
const entityPackets = this._flatEntities[i].packetsForUpdate(force);
@ -93,6 +88,13 @@ export class EntityList extends decorate(class {}) {
packets.push(entityPackets[j]);
}
}
if (!force) {
for (let i = 0; i < this._entitiesJustRemoved.length; i++) {
const entity = this._entitiesJustRemoved[i];
packets.push(new EntityRemovePacket({}, entity));
}
this._entitiesJustRemoved = [];
}
return packets;
}