mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-01 10:03:47 +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
|
//Re-initialize reactstate that could be altered by movementgenerators
|
||||||
InitializeReactState();
|
InitializeReactState();
|
||||||
}
|
}
|
||||||
|
m_respawnedTime = time(nullptr);
|
||||||
// xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
|
// 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);
|
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
|
||||||
UpdateObjectVisibility(false);
|
UpdateObjectVisibility(false);
|
||||||
@@ -2276,6 +2276,12 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
|||||||
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
|
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
|
||||||
return false;
|
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 (!IS_PLAYER_GUID(GetCharmerOrOwnerGUID()))
|
||||||
{
|
{
|
||||||
if (GetMap()->IsDungeon())
|
if (GetMap()->IsDungeon())
|
||||||
|
|||||||
@@ -769,6 +769,7 @@ protected:
|
|||||||
/// Timers
|
/// Timers
|
||||||
time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance
|
time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance
|
||||||
time_t m_respawnTime; // (secs) time of next respawn
|
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_respawnDelay; // (secs) delay between corpse disappearance and respawning
|
||||||
uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
|
uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
|
||||||
float m_wanderDistance;
|
float m_wanderDistance;
|
||||||
|
|||||||
Reference in New Issue
Block a user