Fix one-off mobs respawning if their regenTime is 0

This commit is contained in:
dongresource 2024-10-19 03:34:03 +02:00
parent 3365cb53b7
commit 05a5303522

View File

@ -478,6 +478,14 @@ void MobAI::deadStep(CombatNPC* npc, time_t currTime) {
if (self->groupLeader == self->id) if (self->groupLeader == self->id)
roamingStep(self, currTime); roamingStep(self, currTime);
/*
* If the mob hasn't fully despanwed yet, don't try to respawn it. This protects
* against the edge case where mobs with a very short regenTime would try to respawn
* before they've faded away; and would respawn even if they were meant to be removed.
*/
if (!self->despawned)
return;
if (self->killedTime != 0 && currTime - self->killedTime < self->regenTime * 100) if (self->killedTime != 0 && currTime - self->killedTime < self->regenTime * 100)
return; return;