@cryptovoxels/messages
Advanced tools
Comparing version 2.0.0-5 to 2.0.0-6
@@ -121,7 +121,6 @@ "use strict"; | ||
} | ||
return msgpack_1.encode([encodeUUID(input.uuid), Float32Array.from(input.position), utils_1.compressQuaternion(input.bodyOrientation), utils_1.compressQuaternion(input.headOrientation)]); | ||
return msgpack_1.encode([encodeUUID(input.uuid), Float32Array.from(input.position), utils_1.compressQuaternion(input.bodyOrientation), utils_1.compressQuaternion(input.headOrientation), input.animation]); | ||
}, | ||
decode: (data) => { | ||
const res = msgpack_1.decode(data); | ||
const rotUint8 = Uint8Array.from(res[2]); | ||
return { | ||
@@ -133,3 +132,3 @@ type: MessageType.updateAvatar, | ||
headOrientation: utils_1.decompressQuaternion(res[3]), | ||
animation: res[3], | ||
animation: res[4], | ||
}; | ||
@@ -136,0 +135,0 @@ }, |
{ | ||
"name": "@cryptovoxels/messages", | ||
"version": "2.0.0-5", | ||
"version": "2.0.0-6", | ||
"description": "common protocol for multiplayer messages", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -241,9 +241,6 @@ import { Decoder, Encoder, decode as decodeAlias, encode, ExtensionCodec } from '@msgpack/msgpack' | ||
} | ||
return encode([encodeUUID(input.uuid), Float32Array.from(input.position), compressQuaternion(input.bodyOrientation), compressQuaternion(input.headOrientation)]) | ||
return encode([encodeUUID(input.uuid), Float32Array.from(input.position), compressQuaternion(input.bodyOrientation), compressQuaternion(input.headOrientation), input.animation]) | ||
}, | ||
decode: (data): UpdateAvatarMessage => { | ||
const res = decodeAlias(data) as any[] | ||
const rotUint8 = Uint8Array.from(res[2]) | ||
return { | ||
@@ -255,3 +252,3 @@ type: MessageType.updateAvatar, | ||
headOrientation: decompressQuaternion(res[3]), | ||
animation: res[3], | ||
animation: res[4], | ||
} | ||
@@ -258,0 +255,0 @@ }, |
@@ -60,3 +60,3 @@ import test, { Test } from 'tape' | ||
// @todo original size was 76 | ||
size: 48, | ||
size: 49, | ||
msg: { type: msg.MessageType.updateAvatar, uuid: uuid, position: [1.23, 4.56, 7.89], bodyOrientation: [0.24, 0.665, -0.665, 0.24], headOrientation: [0.24, 0.665, -0.665, 0.24], animation: 2 }, | ||
@@ -86,3 +86,3 @@ }, | ||
const encoded = WorldStateEncoder({ type: msg.MessageType.worldState, avatars: avatars, server_ts: 120 }) | ||
t.equal(encoded.length, 150, 'encoded message size is correct') | ||
t.equal(encoded.length, 153, 'encoded message size is correct') | ||
const decoded: WorldStateMessage = msg.decode(encoded) | ||
@@ -122,3 +122,3 @@ t.equal(decoded.avatars.length, avatars.length, 'we have three avatar update messages') | ||
const encoded = JoinEncoder(joinMsg) | ||
t.equal(encoded.length, 304, 'encoded message size is correct') | ||
t.equal(encoded.length, 307, 'encoded message size is correct') | ||
const decoded: JoinMessage = msg.decode(encoded) | ||
@@ -125,0 +125,0 @@ t.equal(decoded.type, msg.MessageType.join) |
Sorry, the diff of this file is not supported yet
73586
30
1545