From 05a5303522b71cf793b8bec72c4df4c243d0ad8e Mon Sep 17 00:00:00 2001 From: dongresource Date: Sat, 19 Oct 2024 03:34:03 +0200 Subject: [PATCH] Fix one-off mobs respawning if their regenTime is 0 --- src/MobAI.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/MobAI.cpp b/src/MobAI.cpp index ae29a20..dbb700c 100644 --- a/src/MobAI.cpp +++ b/src/MobAI.cpp @@ -478,6 +478,14 @@ void MobAI::deadStep(CombatNPC* npc, time_t currTime) { if (self->groupLeader == self->id) 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) return;