reduce update packet size by ~70%

This commit is contained in:
Asraelite 2016-03-29 01:14:32 +01:00
parent 1af386d9f5
commit 0906441246
20 changed files with 219 additions and 143 deletions

View file

@ -4,17 +4,19 @@ const Body = require('./body.js');
class Asteroid extends Body {
constructor(world, pos, size) {
super(world);
this.x = pos.x;
this.y = pos.y;
super(world, pos);
this.debug = 0;
this.size = size;
this.type = 'asteroid';
this.size = size;
this.frame = this.randomFrame();
this.interface.order.push.apply(this.interface.order, [
'debug'
]);
this.interface.type = 'asteroid';
}
randomFrame() {
@ -34,13 +36,8 @@ class Asteroid extends Body {
return [this.debug];
}
packFull() {
return {
type: 'asteroid',
id: this.id,
frame: this.frame,
delta: this.packDelta()
}
packTypeFull() {
return {};
}
}