avocado-old/packages/topdown/packets/room-update-layers.packet.js

27 lines
614 B
JavaScript
Raw Normal View History

2019-09-29 13:19:57 -05:00
import {BundlePacket} from '@avocado/net';
import {SynchronizedUpdatePacket} from '@avocado/net';
export class RoomUpdateLayersPacket extends SynchronizedUpdatePacket {
static pack(packet) {
const data = packet.data[1];
data.layersPackets = BundlePacket.packPacket(
new BundlePacket(data.layersPackets)
);
return super.pack(packet);
}
static get synchronizationSchema() {
return {
layersPackets: 'buffer',
};
}
static unpack(packet) {
const data = super.unpack(packet);
data.layersPackets = BundlePacket.unpack(data.layersPackets);
return data;
}
}