mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
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?
This commit is contained in:
@@ -252,16 +252,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->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || creature->GetTransGUID().IsEmpty())
|
||||
creature->SetHomePosition(creature->GetPosition());
|
||||
|
||||
if (creature->movespline->Finalized())
|
||||
{
|
||||
OnArrived(creature);
|
||||
@@ -270,14 +269,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->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || creature->GetTransGUID().IsEmpty())
|
||||
creature->SetHomePosition(creature->GetPosition());
|
||||
|
||||
if (_recalculateSpeed)
|
||||
{
|
||||
if (_nextMoveTime.Passed())
|
||||
StartMove(creature);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user