reduce update packet size by ~70%
This commit is contained in:
parent
1af386d9f5
commit
0906441246
20 changed files with 219 additions and 143 deletions
|
@ -5,13 +5,9 @@ const Rope = require('../../copula/rope.js');
|
|||
|
||||
class Grapple extends Projectile {
|
||||
constructor(world, pos, source) {
|
||||
super(world);
|
||||
// pos.x *= 32, pos.y *= 32, idk why
|
||||
super(world, pos);
|
||||
|
||||
this.x = pos.x * 32;
|
||||
this.y = pos.y * 32;
|
||||
this.xvel = pos.xvel;
|
||||
this.yvel = pos.yvel;
|
||||
this.r = pos.r;
|
||||
this.xvel += Math.cos(this.r) * 0.25;
|
||||
this.yvel += Math.sin(this.r) * 0.25;
|
||||
|
||||
|
@ -64,14 +60,8 @@ class Grapple extends Projectile {
|
|||
return [];
|
||||
}
|
||||
|
||||
packFull() {
|
||||
return {
|
||||
type: 'grapple',
|
||||
id: this.id,
|
||||
source: this.source.id,
|
||||
frame: this.frame,
|
||||
delta: this.packDelta()
|
||||
};
|
||||
packProjectileFull() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,14 +51,8 @@ class Missile extends Projectile {
|
|||
return [];
|
||||
}
|
||||
|
||||
packFull() {
|
||||
return {
|
||||
type: 'missile',
|
||||
id: this.id,
|
||||
source: this.source.id,
|
||||
frame: this.frame,
|
||||
delta: this.packDelta()
|
||||
};
|
||||
packProjectileFull() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,21 @@ class Projectile extends Body {
|
|||
}
|
||||
|
||||
connect() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
packTypeDelta() {
|
||||
return [];
|
||||
}
|
||||
|
||||
packProjectileFull() {
|
||||
return {};
|
||||
}
|
||||
|
||||
packTypeFull() {
|
||||
let packet = this.packProjectileFull();
|
||||
packet.source = this.source.id;
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue