Core/AI: delay all AI()->Respawn() hooks by 1 server tick, this way when creatures are just got created they will successfully find other objects in scripts at spawn time
--HG-- branch : trunk
This commit is contained in:
@@ -161,6 +161,7 @@ m_formation(NULL)
|
|||||||
m_CombatDistance = 0;//MELEE_RANGE;
|
m_CombatDistance = 0;//MELEE_RANGE;
|
||||||
|
|
||||||
ResetLootMode(); // restore default loot mode
|
ResetLootMode(); // restore default loot mode
|
||||||
|
TriggerJustRespawned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature::~Creature()
|
Creature::~Creature()
|
||||||
@@ -437,6 +438,12 @@ void Creature::Update(uint32 diff)
|
|||||||
else
|
else
|
||||||
m_GlobalCooldown -= diff;
|
m_GlobalCooldown -= diff;
|
||||||
|
|
||||||
|
if (IsAIEnabled && TriggerJustRespawned)
|
||||||
|
{
|
||||||
|
TriggerJustRespawned = false;
|
||||||
|
AI()->JustRespawned();
|
||||||
|
}
|
||||||
|
|
||||||
switch(m_deathState)
|
switch(m_deathState)
|
||||||
{
|
{
|
||||||
case JUST_ALIVED:
|
case JUST_ALIVED:
|
||||||
@@ -1630,7 +1637,7 @@ void Creature::Respawn(bool force)
|
|||||||
|
|
||||||
//Call AI respawn virtual function
|
//Call AI respawn virtual function
|
||||||
if (IsAIEnabled)
|
if (IsAIEnabled)
|
||||||
AI()->JustRespawned();
|
TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing
|
||||||
|
|
||||||
uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
|
uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
|
||||||
if (poolid)
|
if (poolid)
|
||||||
|
|||||||
@@ -732,6 +732,7 @@ class Creature : public Unit, public GridObject<Creature>
|
|||||||
|
|
||||||
//Formation var
|
//Formation var
|
||||||
CreatureGroup *m_formation;
|
CreatureGroup *m_formation;
|
||||||
|
bool TriggerJustRespawned;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AssistDelayEvent : public BasicEvent
|
class AssistDelayEvent : public BasicEvent
|
||||||
|
|||||||
Reference in New Issue
Block a user