Scripts/Guards: Fix infinite loop in npc_air_force_bots

Fix infinite loop in npc_air_force_bots happening when aura 38067 was removed, triggering MoveInLineOfSight() that would add back the aura. Only 1 aura add/remove for guard for player is allowed now.
This commit is contained in:
jackpoz
2019-04-27 16:32:41 +02:00
parent f26f716714
commit 844e7ee926

View File

@@ -165,6 +165,13 @@ public:
return nullptr;
}
void UpdateAI(uint32 diff) override
{
ScriptedAI::UpdateAI(diff);
inLineOfSightSinceLastUpdate.clear();
}
void MoveInLineOfSight(Unit* who) override
{
if (!SpawnAssoc)
@@ -188,6 +195,10 @@ public:
{
case SPAWNTYPE_ALARMBOT:
{
// handle only 1 change for world update for each target
if (!inLineOfSightSinceLastUpdate.insert(who->GetGUID()).second)
return;
if (!who->IsWithinDistInMap(me, RANGE_GUARDS_MARK))
return;
@@ -239,6 +250,8 @@ public:
}
}
}
GuidSet inLineOfSightSinceLastUpdate;
};
CreatureAI* GetAI(Creature* creature) const override