flow: room editing

This commit is contained in:
cha0s 2022-04-11 18:18:45 -05:00
parent 8f79e06b74
commit 0754a3804e

View File

@ -69,9 +69,13 @@ const RoomComponent = ({
// Otherwise, we'll update the room. // Otherwise, we'll update the room.
else { else {
const updateRoom = async () => { const updateRoom = async () => {
// Update entities.
if (previousResource.entities !== resource.entities) { if (previousResource.entities !== resource.entities) {
if (previousResource.entities.length !== resource.entities.length) { if (previousResource.entities.length !== resource.entities.length) {
await room.entityList.load(resource.entities); await room.entityList.load(resource.entities);
Object.values(room.entities()).forEach((entity) => {
entity.renderTick(Infinity);
});
} }
else { else {
for (let i = 0; i < resource.entities.length; i++) { for (let i = 0; i < resource.entities.length; i++) {
@ -85,6 +89,7 @@ const RoomComponent = ({
} }
} }
} }
// Update tiles.
if (previousResource.tiles !== resource.tiles) { if (previousResource.tiles !== resource.tiles) {
if (previousResource.tiles.length !== resource.tiles.length) { if (previousResource.tiles.length !== resource.tiles.length) {
await room.loadTiles(resource.tiles); await room.loadTiles(resource.tiles);