Skip to content

Commit 0d6d282

Browse files
Some fixes
1 parent 770827a commit 0d6d282

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/Entity/Live.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export default class LivingEntity extends ObjectEntity {
108108
this.healthData.health -= amount;
109109

110110
if (this.healthData.health <= 0.0001) {
111+
this.destroy(true);
111112
this.healthData.health = 0;
112113

113114
let killer: ObjectEntity = source;
@@ -134,8 +135,6 @@ export default class LivingEntity extends ObjectEntity {
134135
super.applyPhysics();
135136

136137
if (this.healthData.values.health <= 0) {
137-
this.destroy(true);
138-
139138
this.damagedEntities.length = 0;
140139
return;
141140
}

src/Entity/Object.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,13 @@ export default class ObjectEntity extends Entity {
215215

216216
/** Calls the deletion animation, unless animate is set to false, in that case it instantly deletes. */
217217
public destroy(animate = true) {
218-
if (!animate) {
218+
if (!animate || this.isSleeping) {
219219
if (this.deletionAnimation) this.deletionAnimation = null;
220220

221221
this.delete();
222222
} else if (!this.deletionAnimation) { // if we aren't already deleting
223223
this.deletionAnimation = new DeletionAnimation(this);
224224
}
225-
this.isSleeping = false;
226225
}
227226

228227
/** Extends Entity.delete, but removes child from parent. */

0 commit comments

Comments
 (0)