mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Don't send player position from client to server if the player hasn't moved
This commit is contained in:
parent
eeb0900291
commit
15b86a6b9b
4 changed files with 30 additions and 3 deletions
|
@ -1976,10 +1976,24 @@ void Client::sendPlayerPos()
|
|||
{
|
||||
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
|
||||
|
||||
Player *myplayer = m_env.getLocalPlayer();
|
||||
LocalPlayer *myplayer = m_env.getLocalPlayer();
|
||||
if(myplayer == NULL)
|
||||
return;
|
||||
|
||||
|
||||
// Save bandwidth by only updating position when something changed
|
||||
if(myplayer->last_position == myplayer->getPosition() &&
|
||||
myplayer->last_speed == myplayer->getSpeed() &&
|
||||
myplayer->last_pitch == myplayer->getPitch() &&
|
||||
myplayer->last_yaw == myplayer->getYaw() &&
|
||||
myplayer->last_keyPressed == myplayer->keyPressed)
|
||||
return;
|
||||
|
||||
myplayer->last_position = myplayer->getPosition();
|
||||
myplayer->last_speed = myplayer->getSpeed();
|
||||
myplayer->last_pitch = myplayer->getPitch();
|
||||
myplayer->last_yaw = myplayer->getYaw();
|
||||
myplayer->last_keyPressed = myplayer->keyPressed;
|
||||
|
||||
u16 our_peer_id;
|
||||
{
|
||||
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue