refactor: send updates even if it's a create

This commit is contained in:
cha0s 2021-02-04 17:53:07 -06:00
parent bd999518e7
commit d98435b49a

View File

@ -137,17 +137,14 @@ export default (latus) => class EntityList extends decorate(JsonResource) {
if (-1 === index) {
packets.push(entity.createPacket(informed));
}
// Still visible entity.
else {
const entityPackets = entity.packets(informed);
if (entityPackets.length > 0) {
updates.push({
uuid: entity.instanceUuid,
packets: entityPackets,
});
}
previousVisibleEntities.splice(index, 1);
const entityPackets = entity.packets(informed);
if (entityPackets.length > 0) {
updates.push({
uuid: entity.instanceUuid,
packets: entityPackets,
});
}
previousVisibleEntities.splice(index, 1);
}
// Send updates.
this.#informedEntities.set(informed, visibleEntities);