refactor: send updates before destroys
This commit is contained in:
parent
c08b32b68c
commit
a5a09cbcba
|
@ -139,6 +139,12 @@ export class EntityList extends decorate(class {}) {
|
|||
previousVisibleEntities.splice(index, 1);
|
||||
}
|
||||
}
|
||||
// Send updates.
|
||||
this._informedEntities.set(informed, visibleEntities);
|
||||
if (updates.length > 0) {
|
||||
packets.push(new EntityListUpdateEntityPacket(updates));
|
||||
}
|
||||
// Send destroys.
|
||||
for (let i = 0; i < previousVisibleEntities.length; i++) {
|
||||
const entity = previousVisibleEntities[i];
|
||||
// Newly removed entity.
|
||||
|
@ -146,10 +152,6 @@ export class EntityList extends decorate(class {}) {
|
|||
packets.push(entity.destroyPacket(informed));
|
||||
}
|
||||
}
|
||||
this._informedEntities.set(informed, visibleEntities);
|
||||
if (updates.length > 0) {
|
||||
packets.push(new EntityListUpdateEntityPacket(updates));
|
||||
}
|
||||
return packets;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user