Skip to content
This repository was archived by the owner on Jan 24, 2020. It is now read-only.

Commit 6681350

Browse files
author
Avaer Kazmer
committed
Clean up scene commit rendering
1 parent 020df40 commit 6681350

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

index.html

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,13 +1760,33 @@
17601760
})
17611761
.then(() => {
17621762
console.log('mined', {x, z});
1763-
/* queue.push(async () => {
1764-
_unloadScene(_getKey(x, z));
1765-
lastChunkLoaded[0] = NaN;
1766-
lastChunkLoaded[1] = NaN;
1767-
_refresh();
1768-
});
1769-
_tick(); */
1763+
1764+
for (;;) {
1765+
const index = sceneMeshes.findIndex(sceneMesh => sceneMesh.token.coords.some(coord => coord[0] === x && coord[1] === z));
1766+
if (index !== -1) {
1767+
const sceneMesh = sceneMeshes[index];
1768+
sceneMesh.destroy();
1769+
scene.remove(sceneMesh);
1770+
sceneMeshes.splice(index, 1);
1771+
} else {
1772+
break;
1773+
}
1774+
}
1775+
1776+
const sceneMesh = _makeSceneObjectMesh();
1777+
sceneMesh.token = {
1778+
id: 0,
1779+
coords: [[x, z]],
1780+
apps: [],
1781+
owner: _getUserAddress(),
1782+
};
1783+
scene.add(sceneMesh);
1784+
sceneMeshes.push(sceneMesh);
1785+
1786+
selectedSceneToken = null;
1787+
1788+
lastSceneCoords[0] = NaN;
1789+
lastSceneCoords[1] = NaN;
17701790
});
17711791
}
17721792
});

0 commit comments

Comments
 (0)