mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
Add fix for scenario where a client traveled far distance quickly and mob scanning is too slow; this takes care of all scenarios
This commit is contained in:
+12
-8
@@ -2716,18 +2716,22 @@ void EntityList::ScanCloseMobs(
|
||||
}
|
||||
|
||||
float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition());
|
||||
if (distance <= scan_range) {
|
||||
if (distance <= scan_range || 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));
|
||||
}
|
||||
}
|
||||
else if (mob->GetAggroRange() >= scan_range) {
|
||||
close_mobs.insert(std::pair<uint16, Mob *>(mob->GetID(), mob));
|
||||
bool has_mob = false;
|
||||
|
||||
if (add_self_to_other_lists) {
|
||||
mob->close_mobs.insert(std::pair<uint16, Mob *>(scanning_mob->GetID(), scanning_mob));
|
||||
for (auto &cm: mob->close_mobs) {
|
||||
if (scanning_mob->GetID() == cm.first) {
|
||||
has_mob = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_mob) {
|
||||
mob->close_mobs.insert(std::pair<uint16, Mob *>(scanning_mob->GetID(), scanning_mob));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user