summaryrefslogtreecommitdiff
path: root/src/serverenvironment.cpp
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2019-08-25 10:55:27 +0200
committerSmallJoker <mk939@ymail.com>2019-09-09 19:19:54 +0200
commitfae6242d4ef6ca34d131054484acf5efc2fcba70 (patch)
tree46d865c5f8af0bb7e67e0c105db85be210891fe1 /src/serverenvironment.cpp
parenta57f951e021efb11fb7d5779d63aa36ede7a41b4 (diff)
downloadminetest-fae6242d4ef6ca34d131054484acf5efc2fcba70.tar.gz
minetest-fae6242d4ef6ca34d131054484acf5efc2fcba70.tar.bz2
minetest-fae6242d4ef6ca34d131054484acf5efc2fcba70.zip
Send cumulated inventory changes only each step (#8856)
Applies to player and detached inventories
Diffstat (limited to 'src/serverenvironment.cpp')
-rw-r--r--src/serverenvironment.cpp13
1 files changed, 13 insertions, 0 deletions
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)