If I had to do what I think you are trying to do, I would do something like below. Most likely not written appropriately, but just to give you an idea.
Network.prototype.updatePosition = function () {
if (this.initialized) {
var pos = this.player.getPosition();
var anim = this.player.anim.baseLayer.activeState;
Network.socket.emit('positionUpdate', {id: Network.id, x: pos.x, y: pos.y, z: pos.z, a: anim});
}
};
Network.prototype.movePlayer = function (data) {
if (this.initialized && !this.players[data.id].deleted) {
this.players[data.id].entity.rigidbody.teleport(data.x, data.y, data.z);
if (this.players[data.id].entity.anim.baseLayer.activateState != data.a) {
this.players[data.id].entity.anim.baseLayer.play(data.a);
}
}
};