Cleaned up some of the NPC to NPC aggro code, only do aggro checks to other NPC's when the NPC is flagged for it

This commit is contained in:
Akkadius
2017-04-01 23:16:27 -05:00
parent e5e801dad5
commit d7dfc18c54
8 changed files with 12 additions and 31 deletions
+8 -13
View File
@@ -479,18 +479,18 @@ void Mob::AI_Start(uint32 iMoveDelay) {
AI_movement_timer = std::unique_ptr<Timer>(new Timer(AImovement_duration));
AI_target_check_timer = std::unique_ptr<Timer>(new Timer(AItarget_check_duration));
AI_feign_remember_timer = std::unique_ptr<Timer>(new Timer(AIfeignremember_delay));
AI_scan_area_timer = std::unique_ptr<Timer>(new Timer(RandomTimer(RuleI(NPC, NPCToNPCAggroTimerMin), RuleI(NPC, NPCToNPCAggroTimerMax))));
if(CastToNPC()->WillAggroNPCs())
AI_scan_area_timer = std::unique_ptr<Timer>(new Timer(RandomTimer(RuleI(NPC, NPCToNPCAggroTimerMin), RuleI(NPC, NPCToNPCAggroTimerMax))));
AI_check_signal_timer = std::unique_ptr<Timer>(new Timer(AI_check_signal_timer_delay));
#ifdef REVERSE_AGGRO
if(IsNPC() && !CastToNPC()->WillAggroNPCs())
AI_scan_area_timer->Disable();
#endif
if (GetAggroRange() == 0)
pAggroRange = 70;
if (GetAssistRange() == 0)
pAssistRange = 70;
hate_list.WipeHateList();
m_Delta = glm::vec4();
@@ -1351,18 +1351,13 @@ void Mob::AI_Process() {
{
//we processed a spell action, so do nothing else.
}
else if (zone->CanDoCombat() && AI_scan_area_timer->Check())
else if (zone->CanDoCombat() && CastToNPC()->WillAggroNPCs() && AI_scan_area_timer->Check())
{
/*
* This is where NPCs look around to see if they want to attack anybody.
*
* if REVERSE_AGGRO is enabled, then this timer is disabled unless they
* have the npc_aggro flag on them, and aggro against clients is checked
* by the clients.
*
* NPC to NPC aggro checking, npc needs npc_aggro flag
*/
Mob* temp_target = entity_list.AICheckCloseAggro(this, GetAggroRange(), GetAssistRange());
Mob* temp_target = entity_list.AICheckNPCtoNPCAggro(this, GetAggroRange(), GetAssistRange());
if (temp_target){
AddToHateList(temp_target);
}