Don't send position update packet if player is dead
authorANAND <ClobberXD@gmail.com>
Sat, 4 May 2019 07:33:51 +0000 (13:03 +0530)
committerSmallJoker <mk939@ymail.com>
Tue, 20 Aug 2019 16:49:06 +0000 (18:49 +0200)
src/client/client.cpp

index e78b9bb8afa872a59aebfc0c60d26536f8dbcddf..36d7fd251a4591d3b2233db3f82cdc3b113bc618 100644 (file)
@@ -1244,8 +1244,12 @@ void Client::sendPlayerPos()
        u8 camera_fov    = map.getCameraFov();
        u8 wanted_range  = map.getControl().wanted_range;
 
-       // Save bandwidth by only updating position when something changed
-       if(myplayer->last_position        == myplayer->getPosition() &&
+       // Save bandwidth by only updating position when
+       // player is not dead and something changed
+       if (myplayer->isDead())
+               return;
+
+       if (myplayer->last_position == myplayer->getPosition() &&
                        myplayer->last_speed        == myplayer->getSpeed()    &&
                        myplayer->last_pitch        == myplayer->getPitch()    &&
                        myplayer->last_yaw          == myplayer->getYaw()      &&