fix: kill self entity when destroying

This commit is contained in:
cha0s 2021-02-10 11:54:03 -06:00
parent 28e5e9f56f
commit f78978c88e

View File

@ -15,12 +15,16 @@ export default () => {
if (!room) {
return;
}
const onDestroying = () => {
setEntity(undefined);
};
const augmentSelfEntity = async (entity) => {
if (entity) {
await entity.addTraits({
Controllable: {},
Followed: {},
});
entity.on('destroying', onDestroying);
}
setEntity(entity);
};