refactor: acceptAction

This commit is contained in:
cha0s 2021-02-16 00:07:33 -06:00
parent b10bc5b57d
commit c947c23698
2 changed files with 16 additions and 2 deletions

View File

@ -109,7 +109,7 @@ export default () => class Mobile extends decorate(Trait) {
};
}
listeners() {
hooks() {
return {
acceptAction: ({action, value}) => {
@ -131,6 +131,12 @@ export default () => class Mobile extends decorate(Trait) {
}
},
};
}
listeners() {
return {
isMobileChanged: () => {
if (this.params.mobileAnimation) {
this.updateAnimation();

View File

@ -37,7 +37,15 @@ export default () => class Controllable extends Trait {
acceptActionStream: (actionStream) => {
for (let i = 0; i < actionStream.length; i++) {
this.entity.emit('acceptAction', actionStream[i]);
if (
this.entity
.invokeHookFlat('acceptAction', actionStream[i])
.every((result) => false !== result)
) {
if ('client' === process.env.SIDE) {
this.#queued.push(actionStream[i]);
}
}
}
},