AI/SmartAI: Fix an issue where SmartAI creatures would not properly follow their owner on evade. Also fix a bug where creatures with INHABIT_ROOT would get stuck in evade under certain conditions.
This allows us to fix quest 12261 (No Place to Run). Closes #16291.
This commit is contained in:
1 parent
2afb2131c5
commit
2e896a15dd
3 files changed
+15
-5
No files matched your search
@@ -449,14 +449,17 @@ void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
|
||||
AddEscortState(SMART_ESCORT_RETURNING);
|
||||
ReturnToLastOOCPos();
|
||||
}
|
||||
else if (mFollowGuid)
|
||||
else if (Unit* target = mFollowGuid ? ObjectAccessor::GetUnit(*me, mFollowGuid) : nullptr)
|
||||
{
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
// evade is not cleared in MoveFollow, so we can't keep it
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
}
|
||||
else if (Unit* owner = me->GetCharmerOrOwner())
|
||||
{
|
||||
me->GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
}
|
||||
else
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
|
||||
Reference in new issue
Block a user