mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user