fun: yoink sound upon pickup

This commit is contained in:
cha0s 2021-02-04 20:19:28 -06:00
parent d59450f268
commit cdaf1567c0

View File

@ -159,6 +159,17 @@ export default (latus) => class Receptacle extends decorate(Trait) {
return -1; return -1;
} }
// eslint-disable-next-line class-methods-use-this
hooks() {
return {
sounds: () => ({
yoink: {
extends: '/yoink.sound.json',
},
}),
};
}
isSlotIndexInRange(slotIndex) { isSlotIndexInRange(slotIndex) {
return slotIndex >= 0 && slotIndex < this.entity.slotCount; return slotIndex >= 0 && slotIndex < this.entity.slotCount;
} }
@ -181,6 +192,9 @@ export default (latus) => class Receptacle extends decorate(Trait) {
other.list.removeEntity(other); other.list.removeEntity(other);
} }
this.entity.addItemToSlot(other); this.entity.addItemToSlot(other);
if (this.entity.is('Audible')) {
this.entity.playSound('yoink');
}
} }
}; };
} }