This commit is contained in:
Akkadius 2024-11-16 01:53:54 -06:00
parent 8606ccffc9
commit 6424e6a3f3
6 changed files with 25 additions and 6 deletions

View File

@ -12968,6 +12968,18 @@ void Client::CheckSendBulkClientPositionUpdate()
}
}
// if we have seen this mob before and it hasn't moved, skip it
if (m_last_seen_mob_position.contains(mob->GetID())) {
if (m_last_seen_mob_position[mob->GetID()] == mob->GetPosition()) {
LogVisibilityDetail(
"Mob [{}] has already been sent to client [{}] at this position, skipping",
mob->GetCleanName(),
GetCleanName()
);
continue;
}
}
mob_movement_manager.SendCommandToClients(
mob,
0.0,

View File

@ -971,6 +971,8 @@ void Client::CompleteConnect()
RecordStats();
AutoGrantAAPoints();
m_last_seen_mob_position.reserve(entity_list.GetMobList().size());
// enforce some rules..
if (!CanEnterZone()) {
LogInfo("Kicking character [{}] from zone, not allowed here (missing requirements)", GetCleanName());

View File

@ -2870,6 +2870,7 @@ bool EntityList::RemoveMobFromCloseLists(Mob *mob)
it->second->m_close_mobs.erase(entity_id);
it->second->m_can_see_mob.erase(entity_id);
it->second->m_last_seen_mob_position.erase(entity_id);
++it;
}
@ -2975,7 +2976,7 @@ void EntityList::ScanCloseMobs(Mob *scanning_mob)
}
BenchTimer g_vis_bench_timer;
#define STATE_HIDDEN -1
#define STATE_HIDDEN (-1)
#define STATE_VISIBLE 1
void EntityList::UpdateVisibility(Mob *scanning_mob) {

View File

@ -571,6 +571,7 @@ public:
void SendAlternateAdvancementStats();
void ScanCloseMobs(Mob *scanning_mob);
void UpdateVisibility(Mob *scanning_mob);
void UpdateKnownPositions(Mob *scanning_mob);
void GetTrapInfo(Client* c);
bool IsTrapGroupSpawned(uint32 trap_id, uint8 group);

View File

@ -201,11 +201,12 @@ public:
void DisplayInfo(Mob *mob);
std::unordered_map<uint16, Mob *> m_close_mobs;
std::unordered_map<int, int8> m_can_see_mob;
Timer m_scan_close_mobs_timer;
Timer m_see_close_mobs_timer;
Timer m_mob_check_moving_timer;
std::unordered_map<uint16, Mob *> m_close_mobs;
std::unordered_map<int, int8> m_can_see_mob;
std::unordered_map<int, glm::vec4> m_last_seen_mob_position;
Timer m_scan_close_mobs_timer;
Timer m_see_close_mobs_timer;
Timer m_mob_check_moving_timer;
// Bot attack flag
Timer bot_attack_flag_timer;

View File

@ -852,6 +852,7 @@ void MobMovementManager::SendCommandToClients(
}
c->QueuePacket(&outapp, false);
c->m_last_seen_mob_position[mob->GetID()] = mob->GetPosition();
}
}
else {
@ -902,6 +903,7 @@ void MobMovementManager::SendCommandToClients(
}
c->QueuePacket(&outapp, false);
c->m_last_seen_mob_position[mob->GetID()] = mob->GetPosition();
}
}
}