fix(Core/Movement): Fix creatures not resuming movement after being talked to (#20945)

Fix creatures not resuming movement after being talked to
This commit is contained in:
Takenbacon
2024-12-18 11:19:31 -08:00
committed by GitHub
parent 4d349e87b5
commit c8734af4bc
2 changed files with 19 additions and 18 deletions
@@ -240,21 +240,16 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di
} }
else else
{ {
if (creature->IsStopped()) bool finished = creature->movespline->Finalized();
Stop(sWorld->getIntConfig(CONFIG_WAYPOINT_MOVEMENT_STOP_TIME_FOR_PLAYER) * IN_MILLISECONDS); // xinef: code to detect pre-empetively if we should start movement to next waypoint
else // xinef: do not start pre-empetive movement if current node has delay or we are ending waypoint movement
{ //if (!finished && !i_path->at(i_currentNode)->delay && ((i_currentNode != i_path->size() - 1) || repeating))
bool finished = creature->movespline->Finalized(); // finished = (creature->movespline->_Spline().length(creature->movespline->_currentSplineIdx() + 1) - creature->movespline->timePassed()) < 200;
// xinef: code to detect pre-empetively if we should start movement to next waypoint
// xinef: do not start pre-empetive movement if current node has delay or we are ending waypoint movement
//if (!finished && !i_path->at(i_currentNode)->delay && ((i_currentNode != i_path->size() - 1) || repeating))
// finished = (creature->movespline->_Spline().length(creature->movespline->_currentSplineIdx() + 1) - creature->movespline->timePassed()) < 200;
if (finished) if (finished)
{ {
OnArrived(creature); OnArrived(creature);
return StartMove(creature); return StartMove(creature);
}
} }
} }
return true; return true;
@@ -287,10 +282,16 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
} }
} }
void WaypointMovementGenerator<Creature>::Pause(uint32 /*timer*/) void WaypointMovementGenerator<Creature>::Pause(uint32 timer)
{ {
stalled = true; if (timer)
i_nextMoveTime.Reset(1); i_nextMoveTime.Reset(timer);
else
{
// No timer? Will be paused forever until ::Resume is called
stalled = true;
i_nextMoveTime.Reset(1);
}
} }
void WaypointMovementGenerator<Creature>::Resume(uint32 /*overrideTimer/*/) void WaypointMovementGenerator<Creature>::Resume(uint32 /*overrideTimer/*/)
@@ -61,7 +61,7 @@ public:
void DoFinalize(Creature*); void DoFinalize(Creature*);
void DoReset(Creature*); void DoReset(Creature*);
bool DoUpdate(Creature*, uint32 diff); bool DoUpdate(Creature*, uint32 diff);
void Pause(uint32 timer/* = 0*/); void Pause(uint32 timer = 0);
void Resume(uint32 overrideTimer/* = 0*/); void Resume(uint32 overrideTimer/* = 0*/);
void MovementInform(Creature*); void MovementInform(Creature*);