refactor: surgical traitage
This commit is contained in:
parent
a7bf31715b
commit
960afcc46d
|
@ -15,7 +15,16 @@ export default () => {
|
||||||
if (!room) {
|
if (!room) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setEntity(room.findEntity(selfEntity));
|
const augmentSelfEntity = async (entity) => {
|
||||||
|
if (entity) {
|
||||||
|
await entity.addTraits({
|
||||||
|
Controllable: {},
|
||||||
|
Followed: {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setEntity(entity);
|
||||||
|
};
|
||||||
|
augmentSelfEntity(room.findEntity(selfEntity));
|
||||||
}, [room, selfEntity]);
|
}, [room, selfEntity]);
|
||||||
return entity;
|
return entity;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,12 +4,14 @@ import {SenderSynchronizer} from '@avocado/s13n';
|
||||||
|
|
||||||
export default (latus) => class Informed extends Trait {
|
export default (latus) => class Informed extends Trait {
|
||||||
|
|
||||||
static type() {
|
|
||||||
return 'informed';
|
|
||||||
}
|
|
||||||
|
|
||||||
#synchronizer = new SenderSynchronizer(latus);
|
#synchronizer = new SenderSynchronizer(latus);
|
||||||
|
|
||||||
|
static dependencies() {
|
||||||
|
return [
|
||||||
|
'Followed',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.#synchronizer.destroy();
|
this.#synchronizer.destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,10 @@ export default (latus) => class ServerJoin extends Join() {
|
||||||
'cha0s',
|
'cha0s',
|
||||||
'index.entity.json',
|
'index.entity.json',
|
||||||
),
|
),
|
||||||
|
traits: {
|
||||||
|
Controllable: {},
|
||||||
|
Informed: {},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
player = universe.addPlayer({
|
player = universe.addPlayer({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user