Skip to content

Commit

Permalink
- Reldens - v4.0.0 - Fix respawn clear intervals.
Browse files Browse the repository at this point in the history
  • Loading branch information
damian-pastorini committed Nov 13, 2024
1 parent 38a11ad commit 5cd0ed1
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/objects/server/object/type/enemy-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,13 @@ class EnemyObject extends NpcObject
let elapsedTime = Date.now() - respawnStartTime;
let remainingTime = Math.max(0, (this.respawnTime - elapsedTime) / 1000);
Logger.debug('Respawn Object "'+this.uid+'" in: '+remainingTime.toFixed(2)+' seconds.');
if(1 > Number(sc.roundToPrecision(remainingTime, 0))){
await this.respawnTimerCallback(room);
}
}, 1000);
this.respawnTimer = setTimeout(async () => {
await this.respawnTimerCallback(room);
clearInterval(this.respawnTimerInterval);
await this.restoreObject(room);
}, this.respawnTime);
}

async respawnTimerCallback(room)
{
clearInterval(this.respawnTimerInterval);
await this.restoreObject(room);
}

async restoreObject(room)
{
this.objectBody.collisionResponse = true;
Expand Down

0 comments on commit 5cd0ed1

Please sign in to comment.