From 876335bb54a5ef0c9f7954a0c4b1d1bc51e27e5c Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 8 Mar 2018 19:42:40 -0500 Subject: [PATCH] Pull out forced movement from push to it's own function Had to pull this out so we could process it before mez/stun --- zone/mob.h | 1 + zone/mob_ai.cpp | 20 ++++++++++++-------- zone/npc.cpp | 4 ++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/zone/mob.h b/zone/mob.h index 5530e0cab..a160b2a45 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -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); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 055200d56..70176a92e 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -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; diff --git a/zone/npc.cpp b/zone/npc.cpp index 0fcc1e17d..c872fb680 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -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;