mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Fix https://github.com/ElunaLuaEngine/Eluna/issues/164 and close https://github.com/ElunaLuaEngine/Eluna/issues/163
This commit is contained in:
@@ -20,6 +20,8 @@ struct ElunaCreatureAI : ScriptedAI
|
||||
{
|
||||
// used to delay the spawn hook triggering on AI creation
|
||||
bool justSpawned;
|
||||
// used to delay movementinform hook (WP hook)
|
||||
std::vector< std::pair<uint32, uint32> > movepoints;
|
||||
#ifndef TRINITY
|
||||
#define me m_creature
|
||||
#endif
|
||||
@@ -42,6 +44,16 @@ struct ElunaCreatureAI : ScriptedAI
|
||||
JustRespawned();
|
||||
}
|
||||
|
||||
if (!movepoints.empty())
|
||||
{
|
||||
for (auto& point : movepoints)
|
||||
{
|
||||
if (!sEluna->MovementInform(me, point.first, point.second))
|
||||
ScriptedAI::MovementInform(point.first, point.second);
|
||||
}
|
||||
movepoints.clear();
|
||||
}
|
||||
|
||||
if (!sEluna->UpdateAI(me, diff))
|
||||
{
|
||||
#ifdef TRINITY
|
||||
@@ -100,8 +112,9 @@ struct ElunaCreatureAI : ScriptedAI
|
||||
//Called at waypoint reached or PointMovement end
|
||||
void MovementInform(uint32 type, uint32 id) override
|
||||
{
|
||||
if (!sEluna->MovementInform(me, type, id))
|
||||
ScriptedAI::MovementInform(type, id);
|
||||
// delayed since hook triggers before actually reaching the point
|
||||
// and starting new movement would bug
|
||||
movepoints.push_back(std::make_pair(type, id));
|
||||
}
|
||||
|
||||
// Called before EnterCombat even before the creature is in combat.
|
||||
|
||||
Reference in New Issue
Block a user