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

@ -17,7 +17,9 @@ class Mount {
this.traversal = data.traversal ? {
cw: data.bounds[0],
ccw: data.bounds[1]
} : false;
} : 0;
this.updateDeltaInterface();
}
destruct() {
@ -25,11 +27,20 @@ class Mount {
this.fixture.destruct();
}
packDelta() {
return [this.traversal || 0];
}
updateDeltaInterface() {
this.deltaInterface = this.fixture ? ['traversal'] : [];
}
packFull() {
return {
x: this.position.x,
y: this.position.y
}
y: this.position.y,
turret: this.turret ? this.turret.type : 0
};
}
}