2019-04-14 20:21:52 -05:00
|
|
|
import {Trait} from '@avocado/entity';
|
2019-03-27 01:03:05 -05:00
|
|
|
|
|
|
|
export class Roomed extends Trait {
|
|
|
|
|
2019-05-05 04:26:35 -05:00
|
|
|
static type() {
|
|
|
|
return 'roomed';
|
|
|
|
}
|
|
|
|
|
2019-03-27 01:03:05 -05:00
|
|
|
destroy() {
|
2019-05-17 05:47:40 -05:00
|
|
|
const room = this.entity.room;
|
|
|
|
this.entity.room = null;
|
2019-04-05 11:25:26 -05:00
|
|
|
this.entity.emit('removedFromRoom', room);
|
2019-03-27 01:03:05 -05:00
|
|
|
}
|
|
|
|
|
2019-05-17 05:47:40 -05:00
|
|
|
methods() {
|
|
|
|
return {
|
|
|
|
|
|
|
|
setRoom: (room) => {
|
|
|
|
this.entity.room = room;
|
|
|
|
this.entity.emit('addedToRoom');
|
|
|
|
},
|
2019-03-27 01:03:05 -05:00
|
|
|
|
2019-05-17 05:47:40 -05:00
|
|
|
};
|
2019-03-27 01:03:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|