diff --git a/src/network/packethandlers/server.cpp b/src/network/packethandlers/server.cpp index d24e8df5b3f9e0431f92d382e7f2da0a1ebe850c..b188bb931ac3be6da049411e5a22671aac3d5813 100644 --- a/src/network/packethandlers/server.cpp +++ b/src/network/packethandlers/server.cpp @@ -916,6 +916,15 @@ void Server::handleCommand_Breath(NetworkPacket* pkt) return; } + /* + * If player is dead, we don't need to update the breath + * He is dead ! + */ + if (player->isDead()) { + return; + } + + PlayerSAO *playersao = player->getPlayerSAO(); if (playersao == NULL) { errorstream << "Server::ProcessData(): Cancelling: " diff --git a/src/player.h b/src/player.h index 4459b421a29477d2c1af770e8d040def196c6f34..def428847e35d5f90655869a360a15a950c4d8ff 100644 --- a/src/player.h +++ b/src/player.h @@ -238,6 +238,9 @@ class Player inventory.setModified(x); } + // Use a function, if isDead can be defined by other conditions + bool isDead() { return hp == 0; } + bool touching_ground; // This oscillates so that the player jumps a bit above the surface bool in_liquid;