avocado-old/packages/topdown/traits/roomed.trait.js
2019-05-17 05:47:40 -05:00

27 lines
404 B
JavaScript

import {Trait} from '@avocado/entity';
export class Roomed extends Trait {
static type() {
return 'roomed';
}
destroy() {
const room = this.entity.room;
this.entity.room = null;
this.entity.emit('removedFromRoom', room);
}
methods() {
return {
setRoom: (room) => {
this.entity.room = room;
this.entity.emit('addedToRoom');
},
};
}
}