fix(Core/Creatures): Fixed unitialized varibale implemented in 728d018. (#5042)
- Closes #5030 Co-authored-by: UltraNix <ultranix@gmail.com>
This commit is contained in:
parent
5d3cc6e513
commit
9ca4a23ef3
1 changed files with 5 additions and 1 deletions
|
|
@ -185,6 +185,8 @@ Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(),
|
|||
TriggerJustRespawned = false;
|
||||
m_isTempWorldObject = false;
|
||||
_focusSpell = nullptr;
|
||||
|
||||
m_respawnedTime = time_t(0);
|
||||
}
|
||||
|
||||
Creature::~Creature()
|
||||
|
|
@ -1790,6 +1792,8 @@ void Creature::Respawn(bool force)
|
|||
|
||||
//Re-initialize reactstate that could be altered by movementgenerators
|
||||
InitializeReactState();
|
||||
|
||||
m_respawnedTime = sWorld->GetGameTime();
|
||||
}
|
||||
m_respawnedTime = time(nullptr);
|
||||
// xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
|
||||
|
|
@ -2277,7 +2281,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
|||
return false;
|
||||
|
||||
// cannot attack if is during 5 second grace period, unless being attacked
|
||||
if ((time(nullptr) - m_respawnedTime) < 5 && victim->getAttackers().empty())
|
||||
if (m_respawnedTime && (sWorld->GetGameTime() - m_respawnedTime) < 5 && victim->getAttackers().empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue