mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/AI: Actually accurately reproduce the logic from before 849943 that determines what summons start following on appearance. Third time's the charm?
Closes #23513.
This commit is contained in:
@@ -152,25 +152,50 @@ void CreatureAI::TriggerAlert(Unit const* who) const
|
|||||||
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS, me->GetAbsoluteAngle(who));
|
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS, me->GetAbsoluteAngle(who));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adapted from logic in Spell:EFfectSummonType before commit 849943
|
||||||
|
static bool ShouldFollowOnSpawn(SummonPropertiesEntry const* properties)
|
||||||
|
{
|
||||||
|
// Summons without SummonProperties are generally scripted summons that don't belong to any owner
|
||||||
|
if (!properties)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (properties->Category)
|
||||||
|
{
|
||||||
|
case SUMMON_CATEGORY_PET:
|
||||||
|
return true;
|
||||||
|
case SUMMON_CATEGORY_WILD:
|
||||||
|
case SUMMON_CATEGORY_ALLY:
|
||||||
|
case SUMMON_CATEGORY_UNK:
|
||||||
|
if (properties->Flags & 512)
|
||||||
|
return true;
|
||||||
|
switch (properties->Type)
|
||||||
|
{
|
||||||
|
case SUMMON_TYPE_PET:
|
||||||
|
case SUMMON_TYPE_GUARDIAN:
|
||||||
|
case SUMMON_TYPE_GUARDIAN2:
|
||||||
|
case SUMMON_TYPE_MINION:
|
||||||
|
case SUMMON_TYPE_MINIPET:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
void CreatureAI::JustAppeared()
|
void CreatureAI::JustAppeared()
|
||||||
{
|
{
|
||||||
// Filter which type of summons apply the following follow handling
|
if (TempSummon* summon = me->ToTempSummon())
|
||||||
if (!me->IsSummon())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Summons without SummonProperties are generally scripted summons that don't belong to any owner
|
|
||||||
TempSummon* summon = me->ToTempSummon();
|
|
||||||
if (!summon->m_Properties || (summon->m_Properties->Category != SUMMON_CATEGORY_UNK && summon->m_Properties->Category != SUMMON_CATEGORY_PET))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Not applied to vehicles
|
|
||||||
if (summon->GetVehicle())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Unit* owner = summon->GetCharmerOrOwner())
|
|
||||||
{
|
{
|
||||||
summon->GetMotionMaster()->Clear();
|
// Only apply this to specific types of summons
|
||||||
summon->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, summon->GetFollowAngle());
|
if (!summon->GetVehicle() && ShouldFollowOnSpawn(summon->m_Properties))
|
||||||
|
{
|
||||||
|
if (Unit* owner = summon->GetCharmerOrOwner())
|
||||||
|
{
|
||||||
|
summon->GetMotionMaster()->Clear();
|
||||||
|
summon->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, summon->GetFollowAngle());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user