fix: don't double up remove packets
This commit is contained in:
parent
6047a61906
commit
042034d5d8
|
@ -159,12 +159,19 @@ export class Informed extends decorate(Trait) {
|
|||
}
|
||||
|
||||
injectEntityRemovePackets(packets, visibleEntities) {
|
||||
const alreadyRemovedEntities = packets.filter((packet) => {
|
||||
return packet instanceof EntityRemovePacket;
|
||||
}).map((packet) => {
|
||||
return packet.entity;
|
||||
});
|
||||
for (let i = 0; i < this.seenEntities.length; i++) {
|
||||
const entity = this.seenEntities[i];
|
||||
if (-1 === visibleEntities.indexOf(entity)) {
|
||||
if (-1 === alreadyRemovedEntities.indexOf(entity)) {
|
||||
packets.push(new EntityRemovePacket({}, entity));
|
||||
}
|
||||
}
|
||||
}
|
||||
return packets;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user