mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
fix(Core/Creature): Respawning mobs missing aggro "grace period" (#4893)
This commit is contained in:
@@ -1791,7 +1791,7 @@ void Creature::Respawn(bool force)
|
||||
//Re-initialize reactstate that could be altered by movementgenerators
|
||||
InitializeReactState();
|
||||
}
|
||||
|
||||
m_respawnedTime = time(nullptr);
|
||||
// xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
|
||||
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
|
||||
UpdateObjectVisibility(false);
|
||||
@@ -2276,6 +2276,12 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
||||
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
|
||||
return false;
|
||||
|
||||
// cannot attack if is during 5 second grace period, unless being attacked
|
||||
if ((time(nullptr) - m_respawnedTime) < 5 && victim->getAttackers().empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IS_PLAYER_GUID(GetCharmerOrOwnerGUID()))
|
||||
{
|
||||
if (GetMap()->IsDungeon())
|
||||
|
||||
@@ -769,6 +769,7 @@ protected:
|
||||
/// Timers
|
||||
time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance
|
||||
time_t m_respawnTime; // (secs) time of next respawn
|
||||
time_t m_respawnedTime; // (secs) time when creature respawned
|
||||
uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning
|
||||
uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
|
||||
float m_wanderDistance;
|
||||
|
||||
Reference in New Issue
Block a user