mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Send ActiveObjects once right after Init2
This commit is contained in:
parent
9acd36bf99
commit
81c7f0ae04
6 changed files with 141 additions and 119 deletions
|
@ -463,6 +463,10 @@ void Client::handleCommand_ActiveObjectRemoveAdd(NetworkPacket* pkt)
|
|||
infostream << "handleCommand_ActiveObjectRemoveAdd: " << e.what()
|
||||
<< ". The packet is unreliable, ignoring" << std::endl;
|
||||
}
|
||||
|
||||
// m_activeobjects_received is false before the first
|
||||
// TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD packet is received
|
||||
m_activeobjects_received = true;
|
||||
}
|
||||
|
||||
void Client::handleCommand_ActiveObjectMessages(NetworkPacket* pkt)
|
||||
|
|
|
@ -298,9 +298,6 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
|
|||
infostream << "Server: Sending content to "
|
||||
<< getPlayerName(pkt->getPeerId()) << std::endl;
|
||||
|
||||
// Send player movement settings
|
||||
SendMovement(pkt->getPeerId());
|
||||
|
||||
// Send item definitions
|
||||
SendItemDef(pkt->getPeerId(), m_itemdef, protocol_version);
|
||||
|
||||
|
@ -312,9 +309,25 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
|
|||
// Send media announcement
|
||||
sendMediaAnnouncement(pkt->getPeerId(), lang);
|
||||
|
||||
RemoteClient *client;
|
||||
{
|
||||
MutexAutoLock(m_con);
|
||||
client = getClient(pkt->getPeerId(), CS_InitDone);
|
||||
}
|
||||
|
||||
// Send active objects
|
||||
{
|
||||
PlayerSAO *sao = getPlayerSAO(pkt->getPeerId());
|
||||
if (client && sao)
|
||||
SendActiveObjectRemoveAdd(client, sao);
|
||||
}
|
||||
|
||||
// Send detached inventories
|
||||
sendDetachedInventories(pkt->getPeerId(), false);
|
||||
|
||||
// Send player movement settings
|
||||
SendMovement(pkt->getPeerId());
|
||||
|
||||
// Send time of day
|
||||
u16 time = m_env->getTimeOfDay();
|
||||
float time_speed = g_settings->getFloat("time_speed");
|
||||
|
@ -323,11 +336,10 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
|
|||
SendCSMRestrictionFlags(pkt->getPeerId());
|
||||
|
||||
// Warnings about protocol version can be issued here
|
||||
if (getClient(pkt->getPeerId())->net_proto_version < LATEST_PROTOCOL_VERSION) {
|
||||
if (client->net_proto_version < LATEST_PROTOCOL_VERSION) {
|
||||
SendChatMessage(pkt->getPeerId(), ChatMessage(CHATMESSAGE_TYPE_SYSTEM,
|
||||
L"# Server: WARNING: YOUR CLIENT'S VERSION MAY NOT BE FULLY COMPATIBLE "
|
||||
L"WITH THIS SERVER!"));
|
||||
|
||||
L"# Server: WARNING: YOUR CLIENT'S VERSION MAY NOT BE FULLY COMPATIBLE "
|
||||
L"WITH THIS SERVER!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue