fix: careful with tickingPromises
This commit is contained in:
parent
53aae792cb
commit
049b4a9592
|
@ -72,7 +72,8 @@ export class Vulnerable extends Trait {
|
||||||
});
|
});
|
||||||
const tickingPromise = this._tookDamageActions.tickingPromise(
|
const tickingPromise = this._tookDamageActions.tickingPromise(
|
||||||
context
|
context
|
||||||
).then(() => {
|
);
|
||||||
|
tickingPromise.then(() => {
|
||||||
context.destroy();
|
context.destroy();
|
||||||
});
|
});
|
||||||
this.damageTickingPromises.push(tickingPromise);
|
this.damageTickingPromises.push(tickingPromise);
|
||||||
|
|
|
@ -243,16 +243,20 @@ export class Tool extends decorate(Trait) {
|
||||||
const promises = this.targets.map((target) => {
|
const promises = this.targets.map((target) => {
|
||||||
// Set up.
|
// Set up.
|
||||||
const context = this.createTargetContext(target);
|
const context = this.createTargetContext(target);
|
||||||
return this.toolSetup.tickingPromise(context).then(() => {
|
const tickingPromise = this.toolSetup.tickingPromise(context);
|
||||||
|
tickingPromise.then(() => {
|
||||||
// Check condition.
|
// Check condition.
|
||||||
if (!this.toolCondition.get(context)) {
|
if (!this.toolCondition.get(context)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Execute actions.
|
// Execute actions.
|
||||||
return this.toolActions.tickingPromise(context).then(() => {
|
const tickingPromise = this.toolActions.tickingPromise(context);
|
||||||
|
tickingPromise.then(() => {
|
||||||
context.destroy();
|
context.destroy();
|
||||||
});
|
});
|
||||||
|
return tickingPromise;
|
||||||
});
|
});
|
||||||
|
return tickingPromise;
|
||||||
})
|
})
|
||||||
return TickingPromise.all(promises);
|
return TickingPromise.all(promises);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user