File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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. */
You can’t perform that action at this time.
0 commit comments