mirror of
https://github.com/minetest/minetest.git
synced 2024-11-24 00:23:46 +01:00
handleCommand_Breath mustn't update breath is player is dead. A dead player doesn't breath.
Add Player::isDead function to check player is dead
This commit is contained in:
parent
3067d78216
commit
afb19f3a1f
@ -916,6 +916,15 @@ void Server::handleCommand_Breath(NetworkPacket* pkt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If player is dead, we don't need to update the breath
|
||||||
|
* He is dead !
|
||||||
|
*/
|
||||||
|
if (player->isDead()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PlayerSAO *playersao = player->getPlayerSAO();
|
PlayerSAO *playersao = player->getPlayerSAO();
|
||||||
if (playersao == NULL) {
|
if (playersao == NULL) {
|
||||||
errorstream << "Server::ProcessData(): Cancelling: "
|
errorstream << "Server::ProcessData(): Cancelling: "
|
||||||
|
@ -238,6 +238,9 @@ public:
|
|||||||
inventory.setModified(x);
|
inventory.setModified(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use a function, if isDead can be defined by other conditions
|
||||||
|
bool isDead() { return hp == 0; }
|
||||||
|
|
||||||
bool touching_ground;
|
bool touching_ground;
|
||||||
// This oscillates so that the player jumps a bit above the surface
|
// This oscillates so that the player jumps a bit above the surface
|
||||||
bool in_liquid;
|
bool in_liquid;
|
||||||
|
Loading…
Reference in New Issue
Block a user