Core/Movement: some corrections on WaypointMovementGenerator

- Since a timer can be set on MovementGenerator::Pause, dont update it till the movespline is Finalized
- Don't set HomePosition on every Update, check if movespline is Finalized
    * This is still doesnt feel correct, should it only be called on WaypointNode Start?

(cherry picked from commit 2ce9a0a094a3d86a86a9323693c93ed6a2bbcaaf)
This commit is contained in:
ccrs
2021-02-15 19:13:25 +01:00
committed by funjoker
parent a36ddf47a9
commit 88c3a184cc
@@ -256,16 +256,15 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di
if (!_nextMoveTime.Passed())
{
_nextMoveTime.Update(diff);
if (_nextMoveTime.Passed())
return StartMoveNow(creature);
if (creature->movespline->Finalized())
{
_nextMoveTime.Update(diff);
if (_nextMoveTime.Passed())
return StartMoveNow(creature);
}
}
else
{
// Set home position at place on waypoint movement.
if (creature->GetTransGUID().IsEmpty())
creature->SetHomePosition(creature->GetPosition());
if (creature->movespline->Finalized())
{
OnArrived(creature);
@@ -274,14 +273,21 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di
if (_nextMoveTime.Passed())
return StartMove(creature);
}
else if (_recalculateSpeed)
else
{
if (_nextMoveTime.Passed())
StartMove(creature);
// Set home position at place on waypoint movement.
if (creature->GetTransGUID().IsEmpty())
creature->SetHomePosition(creature->GetPosition());
if (_recalculateSpeed)
{
if (_nextMoveTime.Passed())
StartMove(creature);
}
}
}
return true;
}
}
void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
{