Core/AI: Remove EnterEvadeMode calls from Guardian/Summon spell handlers. Add follow logic to CreatureAI::JustAppeared. Closes #23270.

This commit is contained in:
Treeston
2019-06-23 17:18:42 +02:00
parent aeed616c22
commit 8499434340
3 changed files with 13 additions and 5 deletions

View File

@@ -151,6 +151,18 @@ void CreatureAI::TriggerAlert(Unit const* who) const
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS, me->GetAbsoluteAngle(who));
}
void CreatureAI::JustAppeared()
{
if (!me->GetVehicle())
{
if (Unit* owner = me->GetCharmerOrOwner())
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
}
}
}
void CreatureAI::EnterEvadeMode(EvadeReason why)
{
if (!_EnterEvadeMode(why))

View File

@@ -141,7 +141,7 @@ class TC_GAME_API CreatureAI : public UnitAI
virtual bool IsEscorted() const { return false; }
// Called when creature appears in the world (spawn, respawn, grid load etc...)
virtual void JustAppeared() { }
virtual void JustAppeared();
// Called at waypoint reached or point movement finished
virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) { }

View File

@@ -2245,8 +2245,6 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
summon->SelectLevel(); // some summoned creaters have different from 1 DB data for level/hp
summon->SetUInt32Value(UNIT_NPC_FLAGS, summon->GetCreatureTemplate()->npcflag);
summon->SetImmuneToAll(true);
summon->AI()->EnterEvadeMode();
break;
}
default:
@@ -5357,8 +5355,6 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
summon->SetDisplayId(1126); // modelid1
}
summon->AI()->EnterEvadeMode();
ExecuteLogEffectSummonObject(i, summon);
}
}