Revert "Core/SmartAI: Remove duplicate OnReset() call"

This reverts commit 73345b0d7f.
This commit is contained in:
Ovahlord committed 2019-04-27 17:38:06 +02:00
1 parent 3d08987773
commit 1c7a520095
4 files changed
+43 -31

No files matched your search

+27 -12
View File
@@ -595,22 +595,19 @@ bool SmartAI::AssistPlayerInCombatAgainst(Unit* who)
return false;
}
void SmartAI::InitializeAI()
void SmartAI::JustAppeared()
{
GetScript()->OnInitialize(me);
mDespawnTime = 0;
mDespawnState = 0;
_escortState = SMART_ESCORT_NONE;
me->SetVisible(true);
if (!me->isDead())
{
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
GetScript()->OnReset();
}
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
me->RestoreFaction();
GetScript()->OnReset();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
mFollowGuid.Clear(); // do not reset follower on Reset(), we need it after combat evade
mFollowDist = 0;
mFollowAngle = 0;
@@ -742,6 +739,17 @@ void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
GetScript()->ProcessEventsFor(apply ? SMART_EVENT_PASSENGER_BOARDED : SMART_EVENT_PASSENGER_REMOVED, who, uint32(seatId), 0, apply);
}
void SmartAI::InitializeAI()
{
GetScript()->OnInitialize(me);
if (!me->isDead())
{
GetScript()->OnReset();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
}
}
void SmartAI::OnCharmed(bool apply)
{
if (apply) // do this before we change charmed state, as charmed state might prevent these things from processing
@@ -921,9 +929,11 @@ void SmartAI::StopFollow(bool complete)
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED, player);
}
void SmartAI::SetTimedActionList(SmartScriptHolder& e, uint32 entry, Unit* invoker)
void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
{
GetScript()->SetTimedActionList(e, entry, invoker);
if (invoker)
GetScript()->mLastInvoker = invoker->GetGUID();
GetScript()->SetScript9(e, entry);
}
void SmartAI::OnGameEvent(bool start, uint16 eventId)
@@ -985,6 +995,9 @@ void SmartGameObjectAI::InitializeAI()
void SmartGameObjectAI::Reset()
{
// call respawn event on reset
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
GetScript()->OnReset();
}
@@ -1040,9 +1053,11 @@ void SmartGameObjectAI::SetData(uint32 id, uint32 value, Unit* invoker)
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, invoker, id, value);
}
void SmartGameObjectAI::SetTimedActionList(SmartScriptHolder& e, uint32 entry, Unit* invoker)
void SmartGameObjectAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
{
GetScript()->SetTimedActionList(e, entry, invoker);
if (invoker)
GetScript()->mLastInvoker = invoker->GetGUID();
GetScript()->SetScript9(e, entry);
}
void SmartGameObjectAI::OnGameEvent(bool start, uint16 eventId)