Core/Creature: Do not attack non-combat pets.
Fixes an issue where non-combat pets were aggroing other creatures
This commit is contained in:
@@ -462,8 +462,11 @@ void SmartAI::EnterEvadeMode()
|
|||||||
|
|
||||||
void SmartAI::MoveInLineOfSight(Unit* who)
|
void SmartAI::MoveInLineOfSight(Unit* who)
|
||||||
{
|
{
|
||||||
if (!who) return;
|
if (!who)
|
||||||
|
return;
|
||||||
|
|
||||||
GetScript()->OnMoveInLineOfSight(who);
|
GetScript()->OnMoveInLineOfSight(who);
|
||||||
|
|
||||||
if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
|
if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1412,6 +1412,10 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
|
|||||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE))
|
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Do not attack non-combat pets
|
||||||
|
if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance))
|
if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance))
|
||||||
//|| who->IsControlledByPlayer() && who->IsFlying()))
|
//|| who->IsControlledByPlayer() && who->IsFlying()))
|
||||||
// we cannot check flying for other creatures, too much map/vmap calculation
|
// we cannot check flying for other creatures, too much map/vmap calculation
|
||||||
|
|||||||
Reference in New Issue
Block a user