mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 15:00:25 +00:00
Fix issue where when a client first enters a zone, a mob may not be aware of their distance to a client immediately so when the client does their scan we also add ourselves to their lists
This commit is contained in:
+13
-1
@@ -2694,7 +2694,11 @@ void EntityList::RemoveAuraFromMobs(Mob *aura)
|
||||
* @param close_mobs
|
||||
* @param scanning_mob
|
||||
*/
|
||||
void EntityList::ScanCloseMobs(std::unordered_map<uint16, Mob *> &close_mobs, Mob *scanning_mob)
|
||||
void EntityList::ScanCloseMobs(
|
||||
std::unordered_map<uint16, Mob *> &close_mobs,
|
||||
Mob *scanning_mob,
|
||||
bool add_self_to_other_lists
|
||||
)
|
||||
{
|
||||
float scan_range = RuleI(Range, MobCloseScanDistance) * RuleI(Range, MobCloseScanDistance);
|
||||
|
||||
@@ -2714,9 +2718,17 @@ void EntityList::ScanCloseMobs(std::unordered_map<uint16, Mob *> &close_mobs, Mo
|
||||
float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition());
|
||||
if (distance <= scan_range) {
|
||||
close_mobs.insert(std::pair<uint16, Mob *>(mob->GetID(), mob));
|
||||
|
||||
if (add_self_to_other_lists) {
|
||||
mob->close_mobs.insert(std::pair<uint16, Mob *>(scanning_mob->GetID(), scanning_mob));
|
||||
}
|
||||
}
|
||||
else if (mob->GetAggroRange() >= scan_range) {
|
||||
close_mobs.insert(std::pair<uint16, Mob *>(mob->GetID(), mob));
|
||||
|
||||
if (add_self_to_other_lists) {
|
||||
mob->close_mobs.insert(std::pair<uint16, Mob *>(scanning_mob->GetID(), scanning_mob));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user