diff options
author | ccrs <ccrs@users.noreply.github.com> | 2019-06-24 12:49:15 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-12 02:15:00 +0100 |
commit | d7e544e81626ab477024c057e3e7a2a45083f3a7 (patch) | |
tree | b41e1611e7ae20f1c1996baddadaa3c35acb9ab9 /src/server/game/AI/CreatureAI.cpp | |
parent | 007eb8c9311320217fdda0bc0e6c05044254edfe (diff) |
Core/AI: minimize further undesired behaviours (e3e4b97 followup)
Those Category checks come from checking all Spell::SummonGuardian uses
(cherry picked from commit ebd438883e31de4482617631ff9939f2246fda69)
Diffstat (limited to 'src/server/game/AI/CreatureAI.cpp')
-rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 2908caed584..dd729428934 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -21,6 +21,7 @@ #include "Creature.h" #include "CreatureAIImpl.h" #include "CreatureTextMgr.h" +#include "DB2Structure.h" #include "Errors.h" #include "Language.h" #include "Log.h" @@ -160,13 +161,22 @@ void CreatureAI::TriggerAlert(Unit const* who) const void CreatureAI::JustAppeared() { - if (!me->GetVehicle()) + // Filter which type of summons apply the following follow handling + if (!me->IsSummon()) + return; + + TempSummon* summon = me->ToTempSummon(); + if (summon->m_Properties->Control != SUMMON_CATEGORY_UNK && summon->m_Properties->Control != SUMMON_CATEGORY_PET) + return; + + // Not applied to vehicles + if (summon->GetVehicle()) + return; + + if (Unit* owner = summon->GetCharmerOrOwner()) { - if (Unit* owner = me->GetCharmerOrOwner()) - { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle()); - } + summon->GetMotionMaster()->Clear(); + summon->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, summon->GetFollowAngle()); } } |