Make summoned creatures go back to summoner on evade if summoner is alive. This should take care of most (all?) errors about controlled creatures trying to target home.

--HG--
branch : trunk
This commit is contained in:
gvcoman
2008-11-22 16:55:17 -05:00
parent bd5ee9e49e
commit 915bc1acda
3 changed files with 20 additions and 5 deletions
@@ -1038,7 +1038,15 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
m_creature->CombatStop();
m_creature->LoadCreaturesAddon();
if( m_creature->isAlive() )
m_creature->GetMotionMaster()->MoveTargetedHome();
{
if (Unit* owner = m_creature->GetOwner())
{
if (owner->isAlive())
m_creature->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE);
}
else
m_creature->GetMotionMaster()->MoveTargetedHome();
}
m_creature->SetLootRecipient(NULL);
+3 -1
View File
@@ -98,7 +98,7 @@ void AggressorAI::EnterEvadeMode()
//i_tracker.Reset(TIME_INTERVAL_LOOK);
}
if(!i_creature.isCharmed())
if(!i_creature.GetCharmerOrOwner())
{
i_creature.RemoveAllAuras();
@@ -106,6 +106,8 @@ void AggressorAI::EnterEvadeMode()
if( i_creature.GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE )
i_creature.GetMotionMaster()->MoveTargetedHome();
}
else if (i_creature.GetOwner() && i_creature.GetOwner()->isAlive())
i_creature.GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE);
i_creature.DeleteThreatList();
i_victimGuid = 0;
+8 -3
View File
@@ -123,7 +123,12 @@ ReactorAI::EnterEvadeMode()
i_creature.CombatStop();
i_creature.SetLootRecipient(NULL);
// Remove TargetedMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
if( i_creature.GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE )
i_creature.GetMotionMaster()->MoveTargetedHome();
if(!i_creature.GetCharmerOrOwner())
{
// Remove TargetedMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
if( i_creature.GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE )
i_creature.GetMotionMaster()->MoveTargetedHome();
}
else if (i_creature.GetOwner() && i_creature.GetOwner()->isAlive())
i_creature.GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE);
}