refactor: acceptAction
This commit is contained in:
parent
b10bc5b57d
commit
c947c23698
|
@ -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();
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user