fix(Core/Spells): Correct follow position for Pets and Companions. (#23154)

Co-authored-by: sogladev <sogladev@gmail.com>
This commit is contained in:
GrenderG
2025-10-09 20:09:40 +02:00
committed by GitHub
parent 8fbdca8d50
commit 8d2f307483
4 changed files with 17 additions and 7 deletions

View File

@@ -2429,8 +2429,14 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
}
break;
}
case SUMMON_TYPE_JEEVES:
case SUMMON_TYPE_MINIPET:
// For companions, recalculate the position to ensure they spawn at the intended π/4 angle.
destTarget->Relocate(m_originalCaster->GetNearPosition(
m_originalCaster->GetDistance2d(destTarget->GetPositionX(), destTarget->GetPositionY()),
MINI_PET_SUMMON_ANGLE
));
[[fallthrough]];
case SUMMON_TYPE_JEEVES:
{
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn);
if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION))
@@ -2446,8 +2452,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
//summon->AI()->EnterEvadeMode();
if (properties->Type != SUMMON_TYPE_JEEVES)
{
summon->SetFacingToObject(m_originalCaster);
summon->GetMotionMaster()->Clear(false);
summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, summon->GetFollowAngle(), MOTION_SLOT_ACTIVE);
summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, MINI_PET_FOLLOW_ANGLE, MOTION_SLOT_ACTIVE);
}
break;
}