Add rule Aggro:NPCAggroMaxDistanceEnabled - enabled by default

If enabled, NPC's will drop aggro beyond 600 units or what is defined at the zone level
This commit is contained in:
Akkadius 2018-05-25 22:41:46 -05:00
parent add0c4de47
commit 05ae8c8219
4 changed files with 8 additions and 3 deletions

View File

@ -549,6 +549,7 @@ RULE_BOOL(Aggro, AllowTickPulling, false) // tick pulling is an exploit in an NP
RULE_BOOL(Aggro, UseLevelAggro, true) // Level 18+ and Undead will aggro regardless of level difference. (this will disabled Rule:IntAggroThreshold if set to true)
RULE_INT(Aggro, ClientAggroCheckInterval, 6) // Interval in which clients actually check for aggro - in seconds
RULE_REAL(Aggro, PetAttackRange, 40000.0) // max squared range /pet attack works at default is 200
RULE_BOOL(Aggro, NPCAggroMaxDistanceEnabled, true) /* If enabled, NPC's will drop aggro beyond 600 units or what is defined at the zone level */
RULE_CATEGORY_END()
RULE_CATEGORY(TaskSystem)

View File

@ -116,7 +116,7 @@ Mob::Mob(const char* in_name,
fix_z_timer_engaged(100),
attack_anim_timer(1000),
position_update_melee_push_timer(500),
mHateListCleanup(6000)
hate_list_cleanup_timer(6000)
{
targeted = 0;
tar_ndx = 0;

View File

@ -1453,7 +1453,7 @@ protected:
void AddItemFactionBonus(uint32 pFactionID,int32 bonus);
int32 GetItemFactionBonus(uint32 pFactionID);
void ClearItemFactionBonuses();
Timer mHateListCleanup;
Timer hate_list_cleanup_timer;
bool flee_mode;
Timer flee_timer;

View File

@ -487,6 +487,10 @@ void Mob::AI_Start(uint32 iMoveDelay) {
AI_feign_remember_timer = std::unique_ptr<Timer>(new Timer(AIfeignremember_delay));
AI_scan_door_open_timer = std::unique_ptr<Timer>(new Timer(AI_scan_door_open_interval));
if(!RuleB(Aggro, NPCAggroMaxDistanceEnabled)) {
hate_list_cleanup_timer.Disable();
}
if (CastToNPC()->WillAggroNPCs())
AI_scan_area_timer = std::unique_ptr<Timer>(new Timer(RandomTimer(RuleI(NPC, NPCToNPCAggroTimerMin), RuleI(NPC, NPCToNPCAggroTimerMax))));
@ -1163,7 +1167,7 @@ void Mob::AI_Process() {
// NPCs will forget people after 10 mins of not interacting with them or out of range
// both of these maybe zone specific, hardcoded for now
if (mHateListCleanup.Check()) {
if (hate_list_cleanup_timer.Check()) {
hate_list.RemoveStaleEntries(600000, 600.0f);
if (hate_list.IsHateListEmpty()) {
AI_Event_NoLongerEngaged();