From fae6242d4ef6ca34d131054484acf5efc2fcba70 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 25 Aug 2019 10:55:27 +0200 Subject: Send cumulated inventory changes only each step (#8856) Applies to player and detached inventories --- src/serverenvironment.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/serverenvironment.cpp') diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index 1af3cf6d7..333d32ff5 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -1454,6 +1454,19 @@ void ServerEnvironment::step(float dtime) ++i; } } + + // Send outdated player inventories + for (RemotePlayer *player : m_players) { + if (player->getPeerId() == PEER_ID_INEXISTENT) + continue; + + PlayerSAO *sao = player->getPlayerSAO(); + if (sao && player->inventory.checkModified()) + m_server->SendInventory(sao, true); + } + + // Send outdated detached inventories + m_server->sendDetachedInventories(PEER_ID_INEXISTENT, true); } u32 ServerEnvironment::addParticleSpawner(float exptime) -- cgit v1.2.3