mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Core/Movegen: Fix logic in WaypointMovementGenerator<Creature>::StartMove
This commit is contained in:
@@ -84,6 +84,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
||||
|
||||
// Inform script
|
||||
MovementInform(creature);
|
||||
creature.UpdateWaypointID(i_currentNode);
|
||||
Stop(i_path->at(i_currentNode)->delay);
|
||||
}
|
||||
|
||||
@@ -94,13 +95,11 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
|
||||
if (Stopped())
|
||||
return true;
|
||||
|
||||
const WaypointData *node = i_path->at(i_currentNode);
|
||||
|
||||
if (m_isArrivalDone)
|
||||
{
|
||||
if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint
|
||||
{
|
||||
creature.SetHomePosition(node->x, node->y, node->z, creature.GetOrientation());
|
||||
creature.SetHomePosition(i_path->at(i_currentNode)->x, i_path->at(i_currentNode)->y, i_path->at(i_currentNode)->z, creature.GetOrientation());
|
||||
creature.GetMotionMaster()->Initialize();
|
||||
return false;
|
||||
}
|
||||
@@ -108,6 +107,8 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
|
||||
i_currentNode = (i_currentNode+1) % i_path->size();
|
||||
}
|
||||
|
||||
const WaypointData *node = i_path->at(i_currentNode);
|
||||
|
||||
m_isArrivalDone = false;
|
||||
|
||||
creature.AddUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
|
||||
Reference in New Issue
Block a user