Core/SmartAI: Reset Actions will not be processed until creature reaches home.
This commit is contained in:
1 parent
9f741432a3
commit
c045d4c7f4
2 files changed
+20
-17
No files matched your search
@@ -68,6 +68,8 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
mInvincibilityHpLevel = 0;
|
||||
|
||||
mJustReset = false;
|
||||
}
|
||||
|
||||
void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
@@ -88,13 +90,6 @@ void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
} else mDespawnTime -= diff;
|
||||
}
|
||||
|
||||
void SmartAI::Reset()
|
||||
{
|
||||
if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat
|
||||
SetRun(mRun);
|
||||
GetScript()->OnReset();
|
||||
}
|
||||
|
||||
WayPoint* SmartAI::GetNextWayPoint()
|
||||
{
|
||||
if (!mWayPoints || mWayPoints->empty())
|
||||
@@ -476,7 +471,8 @@ void SmartAI::EnterEvadeMode()
|
||||
else
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
Reset();
|
||||
if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat
|
||||
SetRun(mRun);
|
||||
}
|
||||
|
||||
void SmartAI::MoveInLineOfSight(Unit* who)
|
||||
@@ -567,7 +563,8 @@ void SmartAI::JustRespawned()
|
||||
if (me->getFaction() != me->GetCreatureTemplate()->faction_A)
|
||||
me->RestoreFaction();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
Reset();
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
@@ -586,10 +583,17 @@ int SmartAI::Permissible(const Creature* creature)
|
||||
|
||||
void SmartAI::JustReachedHome()
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
||||
GetScript()->OnReset();
|
||||
|
||||
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
|
||||
me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
|
||||
if (!mJustReset)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
||||
|
||||
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
|
||||
me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
|
||||
}
|
||||
|
||||
mJustReset = false;
|
||||
}
|
||||
|
||||
void SmartAI::EnterCombat(Unit* enemy)
|
||||
@@ -689,7 +693,8 @@ void SmartAI::InitializeAI()
|
||||
{
|
||||
GetScript()->OnInitialize(me);
|
||||
if (!me->isDead())
|
||||
Reset();
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user