Core/SAI: Using SMART_ACTION_SET_FOLLOW with target_type 0 (SMART_TARGET_NONE) will now stop the following completely. Fixes 6 scripts in a clean TDB already using this functionality even though it wasn't implemented.
This commit is contained in:
1 parent
54b7162f1d
commit
20a22662df
3 files changed
+33
-19
No files matched your search
@@ -339,27 +339,10 @@ void SmartAI::UpdateAI(uint32 diff)
|
||||
{
|
||||
if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true))
|
||||
{
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid))
|
||||
{
|
||||
if (!mFollowCreditType)
|
||||
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
|
||||
else
|
||||
player->GroupEventHappens(mFollowCredit, me);
|
||||
}
|
||||
mFollowGuid = 0;
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
mFollowCredit = 0;
|
||||
mFollowArrivedTimer = 1000;
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
SetDespawnTime(5000);
|
||||
me->StopMoving();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
StartDespawn();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED);
|
||||
StopFollow();
|
||||
return;
|
||||
}
|
||||
|
||||
mFollowArrivedTimer = 1000;
|
||||
}
|
||||
else
|
||||
@@ -803,7 +786,11 @@ void SmartAI::SetCombatMove(bool on)
|
||||
void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, uint32 end, uint32 creditType)
|
||||
{
|
||||
if (!target)
|
||||
{
|
||||
StopFollow();
|
||||
return;
|
||||
}
|
||||
|
||||
SetRun(mRun);
|
||||
mFollowGuid = target->GetGUID();
|
||||
mFollowDist = dist >= 0.0f ? dist : PET_FOLLOW_DIST;
|
||||
@@ -815,6 +802,29 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
|
||||
mFollowCreditType = creditType;
|
||||
}
|
||||
|
||||
void SmartAI::StopFollow()
|
||||
{
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid))
|
||||
{
|
||||
if (!mFollowCreditType)
|
||||
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
|
||||
else
|
||||
player->GroupEventHappens(mFollowCredit, me);
|
||||
}
|
||||
|
||||
mFollowGuid = 0;
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
mFollowCredit = 0;
|
||||
mFollowArrivedTimer = 1000;
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
SetDespawnTime(5000);
|
||||
me->StopMoving();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
StartDespawn();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED);
|
||||
}
|
||||
void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
|
||||
{
|
||||
if (invoker)
|
||||
|
||||
@@ -63,6 +63,7 @@ class SmartAI : public CreatureAI
|
||||
void SetCombatMove(bool on);
|
||||
bool CanCombatMove() { return mCanCombatMove; }
|
||||
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0);
|
||||
void StopFollow();
|
||||
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
|
||||
SmartScript* GetScript() { return &mScript; }
|
||||
|
||||
@@ -825,7 +825,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
{
|
||||
CAST_AI(SmartAI, me->AI())->StopFollow();
|
||||
break;
|
||||
}
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user