aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgvcoman <none@none>2008-11-22 16:55:17 -0500
committergvcoman <none@none>2008-11-22 16:55:17 -0500
commit915bc1acdac918f6a1c3017527e072652f59a613 (patch)
treec45fe9418b6dd7fe2dc0a6d1c2c79094635cb74b /src
parentbd5ee9e49ef2fa0e6503887f314e6d515505140e (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp10
-rw-r--r--src/game/AggressorAI.cpp4
-rw-r--r--src/game/ReactorAI.cpp11
3 files changed, 20 insertions, 5 deletions
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index 289b6b925c5..657a1f41b5b 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -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);
diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp
index 0c45fff79f4..04e4f997e7f 100644
--- a/src/game/AggressorAI.cpp
+++ b/src/game/AggressorAI.cpp
@@ -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;
diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp
index 41e5fb51f10..de8f544fddb 100644
--- a/src/game/ReactorAI.cpp
+++ b/src/game/ReactorAI.cpp
@@ -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);
}