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
|
// Inform script
|
||||||
MovementInform(creature);
|
MovementInform(creature);
|
||||||
|
creature.UpdateWaypointID(i_currentNode);
|
||||||
Stop(i_path->at(i_currentNode)->delay);
|
Stop(i_path->at(i_currentNode)->delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,13 +95,11 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
|
|||||||
if (Stopped())
|
if (Stopped())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const WaypointData *node = i_path->at(i_currentNode);
|
|
||||||
|
|
||||||
if (m_isArrivalDone)
|
if (m_isArrivalDone)
|
||||||
{
|
{
|
||||||
if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint
|
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();
|
creature.GetMotionMaster()->Initialize();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -108,6 +107,8 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
|
|||||||
i_currentNode = (i_currentNode+1) % i_path->size();
|
i_currentNode = (i_currentNode+1) % i_path->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WaypointData *node = i_path->at(i_currentNode);
|
||||||
|
|
||||||
m_isArrivalDone = false;
|
m_isArrivalDone = false;
|
||||||
|
|
||||||
creature.AddUnitState(UNIT_STAT_ROAMING_MOVE);
|
creature.AddUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||||
|
|||||||
Reference in New Issue
Block a user