mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Don't send an InventoryAction at each setInventoryModified, we only need one SendInventory per inventory modification
Client doesn't like to receive multiples SendInventory for one action, this can trigger glitches on clients (sometimes due to incorrect UDP packet ordering due to UDP protocol) This fix issue #2544
This commit is contained in:
parent
9fbc3a8ca3
commit
7851c4f7a2
5 changed files with 15 additions and 10 deletions
|
@ -1290,13 +1290,16 @@ Inventory* Server::getInventory(const InventoryLocation &loc)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
void Server::setInventoryModified(const InventoryLocation &loc)
|
||||
void Server::setInventoryModified(const InventoryLocation &loc, bool playerSend)
|
||||
{
|
||||
switch(loc.type){
|
||||
case InventoryLocation::UNDEFINED:
|
||||
break;
|
||||
case InventoryLocation::PLAYER:
|
||||
{
|
||||
if (!playerSend)
|
||||
return;
|
||||
|
||||
Player *player = m_env->getPlayer(loc.name.c_str());
|
||||
if(!player)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue