[Performance] Don't process ProjectileAttack checks for NPC's that are not engaged in any combat

This commit is contained in:
Akkadius
2017-03-28 03:05:46 -05:00
parent f931ef7bcb
commit d777b1048d
4 changed files with 34 additions and 33 deletions
+6 -4
View File
@@ -1011,8 +1011,8 @@ void Mob::AI_Process() {
CastToNPC()->CheckSignal();
}
if (engaged)
{
if (engaged) {
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
SendAddPlayerState(PlayerState::Aggressive);
// we are prevented from getting here if we are blind and don't have a target in range
@@ -1039,8 +1039,7 @@ void Mob::AI_Process() {
if (!target)
return;
if (target->IsCorpse())
{
if (target->IsCorpse()) {
RemoveFromHateList(this);
return;
}
@@ -1057,6 +1056,8 @@ void Mob::AI_Process() {
if (DivineAura())
return;
ProjectileAttack();
auto npcSpawnPoint = CastToNPC()->GetSpawnPoint();
if (GetSpecialAbility(TETHER)) {
float tether_range = static_cast<float>(GetSpecialAbilityParam(TETHER, 0));
@@ -1255,6 +1256,7 @@ void Mob::AI_Process() {
}
AI_EngagedCastCheck();
} //end is within combat rangepet
else {
//we cannot reach our target...