mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Have the server send the player list to the client (#5924)
* Have the server send the player list to the client Currently the client generates the player list based on the Client active object list, the issue with this is that we can't be sure all player active objects will be sent to the client, so this could result in players showing up when someone run `/status` but auto complete not working with their nick and CSM not being aware of the player
This commit is contained in:
@@ -2787,6 +2787,12 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
|
||||
PlayerSAO *playersao = player->getPlayerSAO();
|
||||
assert(playersao);
|
||||
|
||||
// inform connected clients
|
||||
NetworkPacket notice(TOCLIENT_UPDATE_PLAYER_LIST, 0, PEER_ID_INEXISTENT);
|
||||
// (u16) 1 + std::string represents a vector serialization representation
|
||||
notice << (u8) PLAYER_LIST_REMOVE << (u16) 1 << std::string(playersao->getPlayer()->getName());
|
||||
m_clients.sendToAll(¬ice);
|
||||
// run scripts
|
||||
m_script->on_leaveplayer(playersao, reason == CDR_TIMEOUT);
|
||||
|
||||
playersao->disconnected();
|
||||
|
Reference in New Issue
Block a user