fix: only listen to action finished once

This commit is contained in:
cha0s 2019-05-03 01:22:42 -05:00
parent 6db0c2bcdd
commit 73b6ee4d04

View File

@ -106,7 +106,7 @@ export class Alive extends decorate(Trait) {
forceDeath: () => { forceDeath: () => {
this._isDying = true; this._isDying = true;
this.entity.emit('dying'); this.entity.emit('dying');
this._deathActions.on('actionsFinished', () => { this._deathActions.once('actionsFinished', () => {
if (this.entity.is('existent')) { if (this.entity.is('existent')) {
this.entity.destroy(); this.entity.destroy();
} }