refactor: selfEntity patch

This commit is contained in:
cha0s 2019-04-05 23:50:38 -04:00
parent b63a15c8a4
commit ec4732b15b

View File

@ -183,8 +183,11 @@ function onMessage({type, payload}) {
switch (type) {
case 'state-update':
const patch = unpacker.unpack(payload);
if (payload.selfEntity) {
selfEntity = payload.selfEntity;
for (const step of patch) {
const {op, path, value} = step;
if ('add' === op && '/selfEntity' === path) {
selfEntity = value;
}
}
stateSynchronizer.patchState(patch);
dirty = true;