aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CreatureAI.cpp12
-rw-r--r--src/server/game/AI/CreatureAI.h2
-rw-r--r--src/server/game/Spells/SpellEffects.cpp4
3 files changed, 13 insertions, 5 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index c705eb7e7f2..3c4836876f3 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -158,6 +158,18 @@ void CreatureAI::TriggerAlert(Unit const* who) const
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS, me->GetAbsoluteAngle(who));
}
+void CreatureAI::JustAppeared()
+{
+ if (!me->GetVehicle())
+ {
+ if (Unit* owner = me->GetCharmerOrOwner())
+ {
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
+ }
+ }
+}
+
void CreatureAI::EnterEvadeMode(EvadeReason why)
{
if (!_EnterEvadeMode(why))
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index babac1d6f59..165b905803e 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -136,7 +136,7 @@ class TC_GAME_API CreatureAI : public UnitAI
virtual bool IsEscorted() const { return false; }
// Called when creature appears in the world (spawn, respawn, grid load etc...)
- virtual void JustAppeared() { }
+ virtual void JustAppeared();
// Called at waypoint reached or point movement finished
virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) { }
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a78d02d7666..dd04159818f 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2047,8 +2047,6 @@ void Spell::EffectSummonType()
summon->SetNpcFlags(NPCFlags(summon->GetCreatureTemplate()->npcflag & 0xFFFFFFFF));
summon->SetNpcFlags2(NPCFlags2(summon->GetCreatureTemplate()->npcflag >> 32));
summon->SetImmuneToAll(true);
-
- summon->AI()->EnterEvadeMode();
break;
}
default:
@@ -4940,8 +4938,6 @@ void Spell::SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPr
summon->SetDisplayId(1126); // modelid1
}
- summon->AI()->EnterEvadeMode();
-
ExecuteLogEffectSummonObject(SpellEffectName(effect->Effect), summon);
}
}