Pull out forced movement from push to it's own function

Had to pull this out so we could process it before mez/stun
This commit is contained in:
Michael Cook (mackal) 2018-03-08 19:42:40 -05:00
parent 5c87b8152d
commit 876335bb54
3 changed files with 17 additions and 8 deletions

View File

@ -581,6 +581,7 @@ public:
inline void Teleport(glm::vec3 NewPosition) { m_Position.x = NewPosition.x; m_Position.y = NewPosition.y;
m_Position.z = NewPosition.z; };
void TryMoveAlong(float distance, float angle, bool send = true);
void ProcessForcedMovement();
//AI
static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel);

View File

@ -950,17 +950,12 @@ void Client::AI_Process()
}
}
void Mob::AI_Process() {
if (!IsAIControlled())
return;
if (!(AI_think_timer->Check() || attack_timer.Check(false)))
return;
void Mob::ProcessForcedMovement()
{
// we are being pushed, we will hijack this movement timer
// this also needs to be done before casting to have a chance to interrupt
// this flag won't be set if the mob can't be pushed (rooted etc)
if (ForcedMovement && AI_movement_timer->Check()) {
if (AI_movement_timer->Check()) {
bool bPassed = true;
auto z_off = GetZOffset();
glm::vec3 normal;
@ -1019,6 +1014,15 @@ void Mob::AI_Process() {
m_Delta = glm::vec4(); // well, we failed to find a spot to be forced to, lets give up
}
}
}
void Mob::AI_Process() {
if (!IsAIControlled())
return;
if (!(AI_think_timer->Check() || attack_timer.Check(false)))
return;
if (IsCasting())
return;

View File

@ -762,6 +762,10 @@ bool NPC::Process()
reface_timer->Disable();
}
// needs to be done before mez and stun
if (ForcedMovement)
ProcessForcedMovement();
if (IsMezzed())
return true;