Work on spawn filtering

This commit is contained in:
Michael Cook (mackal) 2017-07-19 14:52:04 -04:00
parent 034c076882
commit f97693f8e1
3 changed files with 9 additions and 11 deletions

View File

@ -299,6 +299,7 @@ public:
const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); }
void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
bool ShouldISpawnFor(Client *c) { return !GMHideMe(c) && !IsHoveringForRespawn(); }
virtual bool Process();
void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const EQEmu::ItemData* item, bool buying);
void SendPacketQueue(bool Block = true);

View File

@ -1246,12 +1246,9 @@ void EntityList::SendZoneSpawns(Client *client)
auto it = mob_list.begin();
while (it != mob_list.end()) {
Mob *ent = it->second;
if (!(ent->InZone()) || (ent->IsClient())) {
if (ent->CastToClient()->GMHideMe(client) ||
ent->CastToClient()->IsHoveringForRespawn()) {
++it;
continue;
}
if (!ent->InZone() || !ent->ShouldISpawnFor(client)) {
++it;
continue;
}
app = new EQApplicationPacket;
@ -1279,17 +1276,16 @@ void EntityList::SendZoneSpawnsBulk(Client *client)
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
spawn = it->second;
if (spawn && spawn->GetID() > 0 && spawn->Spawned()) {
if (spawn->IsClient() && (spawn->CastToClient()->GMHideMe(client) ||
spawn->CastToClient()->IsHoveringForRespawn()))
if (!spawn->ShouldISpawnFor(client))
continue;
#if 1
const glm::vec4& spos = spawn->GetPosition();
delaypkt = false;
if (DistanceSquared(cpos, spos) > dmax || (spawn->IsClient() && (spawn->GetRace() == MINOR_ILL_OBJ || spawn->GetRace() == TREE)))
delaypkt = true;
if (delaypkt) {
app = new EQApplicationPacket;
spawn->CreateSpawnPacket(app);
@ -2659,7 +2655,7 @@ void EntityList::SendPositionUpdates(Client *client, uint32 cLastUpdate, float u
mob && !mob->IsCorpse()
&& (it->second != client)
&& (mob->IsClient() || iSendEvenIfNotChanged || (mob->LastChange() >= cLastUpdate))
&& (!it->second->IsClient() || !it->second->CastToClient()->GMHideMe(client))
&& (it->second->ShouldISpawnFor(client))
) {
if (
update_range == 0

View File

@ -549,6 +549,7 @@ public:
void SendPosition();
void SetSpawned() { spawned = true; };
bool Spawned() { return spawned; };
virtual bool ShouldISpawnFor(Client *c) { return true; }
void SetFlyMode(uint8 flymode);
inline void Teleport(glm::vec3 NewPosition) { m_Position.x = NewPosition.x; m_Position.y = NewPosition.y;
m_Position.z = NewPosition.z; };