aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp15
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h5
2 files changed, 13 insertions, 7 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 45bd34cdea5..fef2159e623 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -517,12 +517,6 @@ void SmartAI::InitializeAI()
me->SetVisible(true);
- if (!me->isDead())
- {
- GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
- GetScript()->OnReset();
- }
-
_followGUID.Clear(); // do not reset follower on Reset(), we need it after combat evade
_followDistance = 0;
_followAngle = 0;
@@ -532,6 +526,15 @@ void SmartAI::InitializeAI()
_followCreditType = 0;
}
+void SmartAI::JustAppeared()
+{
+ if (me->isDead())
+ return;
+
+ GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
+ GetScript()->OnReset();
+}
+
void SmartAI::JustReachedHome()
{
GetScript()->OnReset();
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 0baa87ec5a3..b01382079de 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -134,9 +134,12 @@ class TC_GAME_API SmartAI : public CreatureAI
// Called when a Player/Creature enters the creature (vehicle)
void PassengerBoarded(Unit* who, int8 seatId, bool apply) override;
- // Called when gets initialized, when creature is added to world
+ // Called when gets initialized
void InitializeAI() override;
+ // Called once creature is fully added to world
+ void JustAppeared() override;
+
// Called when creature gets charmed by another unit
void OnCharmed(bool isNew) override;