mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 12:47:07 +00:00
fix(Core/Unit): adds in formation not attacking when leader killed (#7412)
Co-authored-by: John Smith <mostdefinitelyanagger@outlook.com>
This commit is contained in:
@@ -933,7 +933,7 @@ void Creature::Motion_Initialize()
|
||||
GetMotionMaster()->Initialize();
|
||||
else if (m_formation->getLeader() == this)
|
||||
{
|
||||
m_formation->FormationReset(false);
|
||||
m_formation->FormationReset(false, true);
|
||||
GetMotionMaster()->Initialize();
|
||||
}
|
||||
else if (m_formation->isFormed())
|
||||
@@ -1759,7 +1759,7 @@ void Creature::setDeathState(DeathState s, bool despawn)
|
||||
|
||||
//Dismiss group if is leader
|
||||
if (m_formation && m_formation->getLeader() == this)
|
||||
m_formation->FormationReset(true);
|
||||
m_formation->FormationReset(true, false);
|
||||
|
||||
bool needsFalling = !despawn && (IsFlying() || IsHovering()) && !IsUnderWater();
|
||||
SetHover(false);
|
||||
|
||||
@@ -186,7 +186,7 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target)
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureGroup::FormationReset(bool dismiss)
|
||||
void CreatureGroup::FormationReset(bool dismiss, bool initMotionMaster)
|
||||
{
|
||||
if (m_members.size() && m_members.begin()->second->groupAI == 5)
|
||||
return;
|
||||
@@ -195,11 +195,18 @@ void CreatureGroup::FormationReset(bool dismiss)
|
||||
{
|
||||
if (itr->first != m_leader && itr->first->IsAlive())
|
||||
{
|
||||
if (dismiss)
|
||||
itr->first->GetMotionMaster()->Initialize();
|
||||
else
|
||||
itr->first->GetMotionMaster()->MoveIdle();
|
||||
LOG_DEBUG("entities.unit", "Set %s movement for member %s", dismiss ? "default" : "idle", itr->first->GetGUID().ToString().c_str());
|
||||
if (initMotionMaster)
|
||||
{
|
||||
if (dismiss)
|
||||
{
|
||||
itr->first->GetMotionMaster()->Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
itr->first->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
LOG_DEBUG("entities.unit", "Set %s movement for member %s", dismiss ? "default" : "idle", itr->first->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
m_Formed = !dismiss;
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
void AddMember(Creature* member);
|
||||
void RemoveMember(Creature* member);
|
||||
void FormationReset(bool dismiss);
|
||||
void FormationReset(bool dismiss, bool initMotionMaster);
|
||||
|
||||
void LeaderMoveTo(float x, float y, float z, bool run);
|
||||
void MemberAttackStart(Creature* member, Unit* target);
|
||||
|
||||
Reference in New Issue
Block a user