1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Send cumulated inventory changes only each step (#8856)

Applies to player and detached inventories
This commit is contained in:
SmallJoker 2019-08-25 10:55:27 +02:00
parent a57f951e02
commit fae6242d4e
5 changed files with 35 additions and 27 deletions

View file

@ -313,7 +313,7 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
sendMediaAnnouncement(pkt->getPeerId(), lang);
// Send detached inventories
sendDetachedInventories(pkt->getPeerId());
sendDetachedInventories(pkt->getPeerId(), false);
// Send time of day
u16 time = m_env->getTimeOfDay();
@ -608,10 +608,9 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
ma->from_inv.applyCurrentPlayer(player->getName());
ma->to_inv.applyCurrentPlayer(player->getName());
setInventoryModified(ma->from_inv, false);
if (ma->from_inv != ma->to_inv) {
setInventoryModified(ma->to_inv, false);
}
setInventoryModified(ma->from_inv);
if (ma->from_inv != ma->to_inv)
setInventoryModified(ma->to_inv);
bool from_inv_is_current_player =
(ma->from_inv.type == InventoryLocation::PLAYER) &&
@ -676,7 +675,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
da->from_inv.applyCurrentPlayer(player->getName());
setInventoryModified(da->from_inv, false);
setInventoryModified(da->from_inv);
/*
Disable dropping items out of craftpreview
@ -712,7 +711,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
ca->craft_inv.applyCurrentPlayer(player->getName());
setInventoryModified(ca->craft_inv, false);
setInventoryModified(ca->craft_inv);
//bool craft_inv_is_current_player =
// (ca->craft_inv.type == InventoryLocation::PLAYER) &&
@ -731,8 +730,6 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
a->apply(this, playersao, this);
// Eat the action
delete a;
SendInventory(playersao, true);
}
void Server::handleCommand_ChatMessage(NetworkPacket* pkt)