RemveSpawn changes

- REmove spawn distance slightly increased to distance from send spawn distance.  Secondly widgets/signs/doors all stay, only NPCs will be removed/added back to reduce lag in client (reduce loading!)
This commit is contained in:
Image 2020-04-19 12:16:43 -04:00
parent f2c72f60b1
commit 59dc1e49d4
2 changed files with 7 additions and 3 deletions

View file

@ -1129,7 +1129,11 @@ void ZoneServer::CheckRemoveSpawnFromClient(Spawn* spawn) {
packet = configReader.getStruct("WS_DestroyGhostCmd", packet_version);
}
if(spawn && spawn != client->GetPlayer() && client->GetPlayer()->WasSentSpawn(spawn->GetID()) && client->GetPlayer()->WasSpawnRemoved(spawn) == false && (spawn_range_map.Get(client)->Get(spawn->GetID()) > REMOVE_SPAWN_DISTANCE && !spawn->IsWidget())){
if(spawn && spawn != client->GetPlayer() &&
client->GetPlayer()->WasSentSpawn(spawn->GetID()) &&
client->GetPlayer()->WasSpawnRemoved(spawn) == false &&
(spawn_range_map.Get(client)->Get(spawn->GetID()) > REMOVE_SPAWN_DISTANCE &&
!spawn->IsSign() && !spawn->IsObject() && !spawn->IsWidget())){
SendRemoveSpawn(client, spawn, packet);
}
@ -3537,7 +3541,7 @@ bool ZoneServer::SendRemoveSpawn(Client* client, Spawn* spawn, PacketStruct* pac
int32 cur_id = client->GetPlayer()->GetIDWithPlayerSpawn(spawn);
if(packet && index > 0 && client->GetPlayer()->WasSpawnRemoved(spawn) == false)
{
LogWrite(ZONE__DEBUG, 7, "Zone", "Processing SendRemoveSpawn for spawn index %u...", index);
LogWrite(ZONE__DEBUG, 7, "Zone", "Processing SendRemoveSpawn for spawn index %u (%s)...cur_id: %i", index,spawn->GetName(), cur_id);
packet->setDataByName("spawn_index", index);
client->GetPlayer()->GetPlayerSpawnMap()->erase(index);
client->GetPlayer()->GetPlayerSpawnIndexMap()->erase(spawn);

View file

@ -98,7 +98,7 @@ class Bot;
#define SEND_SPAWN_DISTANCE 250 /* when spawns appear visually to the client */
#define HEAR_SPAWN_DISTANCE 30 /* max distance a client can be from a spawn to 'hear' it */
#define MAX_CHASE_DISTANCE 80
#define REMOVE_SPAWN_DISTANCE 280
#define REMOVE_SPAWN_DISTANCE 300 // increased distance between send/remove is ideal, this makes sure there is no overlap if a 'fast' client (AKA GM warp speed)
#define SEND_SPAWN_INBULK_DISTANCE (SEND_SPAWN_DISTANCE+REMOVE_SPAWN_DISTANCE)/2
#define TRACKING_STOP 0