diff options
author | red-001 <red-001@outlook.ie> | 2017-06-08 14:30:09 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-08 15:30:09 +0200 |
commit | 4221c1b4412f2bf889bd603a26424003f5367f6a (patch) | |
tree | 622775e473bf073ed704afded90b050b51d63266 /src/server.cpp | |
parent | 5bd33a158688f5fb950613278eefb95b0594a765 (diff) | |
download | minetest-4221c1b4412f2bf889bd603a26424003f5367f6a.tar.gz minetest-4221c1b4412f2bf889bd603a26424003f5367f6a.tar.bz2 minetest-4221c1b4412f2bf889bd603a26424003f5367f6a.zip |
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
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp index b2fdecfa9..0351fa13b 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -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(); |