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