Skip to content

Commit 6d330dc

Browse files
author
NoFantasy
committed
[1547] Some corrections to followerAi, remove no longer needed checks.
Some corrections to followerAi, remove no longer needed checks. git-svn-id: https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2@1547 5f9c896b-1e26-0410-94da-f77f675e2462
1 parent 9c703eb commit 6d330dc

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

base/follower_ai.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/* ScriptData
66
SDName: FollowerAI
7-
SD%Complete: 50
7+
SD%Complete: 60
88
SDComment: This AI is under development
99
SDCategory: Npc
1010
EndScriptData */
@@ -37,9 +37,6 @@ void FollowerAI::AttackStart(Unit* pWho)
3737
m_creature->SetInCombatWith(pWho);
3838
pWho->SetInCombatWith(m_creature);
3939

40-
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
41-
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
42-
4340
if (IsCombatMovement())
4441
m_creature->GetMotionMaster()->MoveChase(pWho);
4542
}
@@ -129,8 +126,8 @@ void FollowerAI::JustDied(Unit* pKiller)
129126
{
130127
if (Player* pMember = pRef->getSource())
131128
{
132-
if (pPlayer->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
133-
pPlayer->FailQuest(m_pQuestForFollow->GetQuestId());
129+
if (pMember->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
130+
pMember->FailQuest(m_pQuestForFollow->GetQuestId());
134131
}
135132
}
136133
}
@@ -339,10 +336,8 @@ Player* FollowerAI::GetLeaderForFollower()
339336

340337
void FollowerAI::SetFollowComplete(bool bWithEndEvent)
341338
{
342-
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
339+
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
343340
{
344-
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
345-
346341
m_creature->StopMoving();
347342
m_creature->GetMotionMaster()->Clear();
348343
m_creature->GetMotionMaster()->MoveIdle();
@@ -368,10 +363,8 @@ void FollowerAI::SetFollowPaused(bool bPaused)
368363
{
369364
AddFollowState(STATE_FOLLOW_PAUSED);
370365

371-
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
366+
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
372367
{
373-
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
374-
375368
m_creature->StopMoving();
376369
m_creature->GetMotionMaster()->Clear();
377370
m_creature->GetMotionMaster()->MoveIdle();

0 commit comments

Comments
 (0)