Core/AI: minimize further undesired behaviours

Port From (https://github.com/TrinityCore/TrinityCore/commit/d7e544e81626ab477024c057e3e7a2a45083f3a7)
This commit is contained in:
hondacrx
2021-12-24 20:22:19 -05:00
parent bd3768c4ef
commit d255912aa6
+15 -6
View File
@@ -152,14 +152,23 @@ namespace Game.AI
// Called when creature appears in the world (spawn, respawn, grid load etc...)
public virtual void JustAppeared()
{
if (me.GetVehicle() == null)
{
Unit owner = me.GetCharmerOrOwner();
// Filter which type of summons apply the following follow handling
if (!me.IsSummon())
return;
TempSummon summon = me.ToTempSummon();
if (summon.m_Properties.Control != SummonCategory.Unk && summon.m_Properties.Control != SummonCategory.Pet)
return;
// Not applied to vehicles
if (summon.GetVehicle())
return;
Unit owner = summon.GetCharmerOrOwner();
if (owner != null)
{
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, me.GetFollowAngle());
}
summon.GetMotionMaster().Clear();
summon.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, summon.GetFollowAngle());
}
}