chore: tidy

This commit is contained in:
cha0s 2024-07-12 01:53:15 -05:00
parent 7141d20a94
commit 78060ded37

View File

@ -237,12 +237,15 @@ export default function Ui({disconnected}) {
for (const id in payload) { for (const id in payload) {
const entity = ecs.get(id); const entity = ecs.get(id);
const update = payload[id]; const update = payload[id];
if (!update) {
continue;
}
if (update.Sound?.play) { if (update.Sound?.play) {
for (const sound of update.Sound.play) { for (const sound of update.Sound.play) {
(new Audio(sound)).play(); (new Audio(sound)).play();
} }
} }
if (update?.MainEntity) { if (update.MainEntity) {
setMainEntity(localMainEntity = id); setMainEntity(localMainEntity = id);
} }
if (localMainEntity === id) { if (localMainEntity === id) {
@ -275,7 +278,7 @@ export default function Ui({disconnected}) {
return () => { return () => {
document.body.removeEventListener('contextmenu', onContextMenu); document.body.removeEventListener('contextmenu', onContextMenu);
}; };
}, []) }, []);
return ( return (
<div <div
className={styles.ui} className={styles.ui}