aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2019-06-23 17:37:35 +0200
committerTreeston <treeston.mmoc@gmail.com>2019-06-23 17:37:35 +0200
commit37fc38b91701c3e699b20f3ed8de8da3b5c42063 (patch)
tree1f0fc04497d006f26d75a1ba1b64ac0a4f4b689d /src
parent8499434340919902b5aefe58f812c3f24d37310d (diff)
AI/SmartAI: Move SMART_EVENT_RESPAWN invocation from ::InitializeAI() to ::JustAppeared(). Closes #23313.
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 e0c0e43d388..acbd5888aa9 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -515,12 +515,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;
@@ -530,6 +524,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 6deb81c0f50..fa3af7b9549 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -133,9 +133,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;