mirror of
https://github.com/minetest/minetest.git
synced 2024-11-24 00:23:46 +01:00
Use the new Player::isDead function when it's the case
This commit is contained in:
parent
7c19933a8c
commit
4e63c977c7
@ -2563,9 +2563,11 @@ void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp)
|
|||||||
LocalPlayer *lplayer = getLocalPlayer();
|
LocalPlayer *lplayer = getLocalPlayer();
|
||||||
assert(lplayer);
|
assert(lplayer);
|
||||||
|
|
||||||
if(handle_hp){
|
if(handle_hp) {
|
||||||
if (lplayer->hp == 0) // Don't damage a dead player
|
// Don't damage a dead player
|
||||||
|
if (lplayer->isDead())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(lplayer->hp > damage)
|
if(lplayer->hp > damage)
|
||||||
lplayer->hp -= damage;
|
lplayer->hp -= damage;
|
||||||
else
|
else
|
||||||
|
@ -556,7 +556,9 @@ void Server::handleCommand_PlayerPos(NetworkPacket* pkt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If player is dead we don't care of this packet
|
// If player is dead we don't care of this packet
|
||||||
if (player->hp == 0) {
|
if (player->isDead()) {
|
||||||
|
verbosestream << "TOSERVER_PLAYERPOS: " << player->getName()
|
||||||
|
<< " is dead. Ignoring packet";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,6 +923,8 @@ void Server::handleCommand_Breath(NetworkPacket* pkt)
|
|||||||
* He is dead !
|
* He is dead !
|
||||||
*/
|
*/
|
||||||
if (player->isDead()) {
|
if (player->isDead()) {
|
||||||
|
verbosestream << "TOSERVER_BREATH: " << player->getName()
|
||||||
|
<< " is dead. Ignoring packet";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,7 +1055,7 @@ void Server::handleCommand_Respawn(NetworkPacket* pkt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->hp != 0 || !g_settings->getBool("enable_damage"))
|
if (!player->isDead() || !g_settings->getBool("enable_damage"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RespawnPlayer(pkt->getPeerId());
|
RespawnPlayer(pkt->getPeerId());
|
||||||
@ -1108,9 +1112,9 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->hp == 0) {
|
if (player->isDead()) {
|
||||||
verbosestream << "TOSERVER_INTERACT: " << player->getName()
|
verbosestream << "TOSERVER_INTERACT: " << player->getName()
|
||||||
<< " tried to interact, but is dead!" << std::endl;
|
<< " is dead. Ignoring packet";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1106,7 +1106,7 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
|
|||||||
SendPlayerBreath(peer_id);
|
SendPlayerBreath(peer_id);
|
||||||
|
|
||||||
// Show death screen if necessary
|
// Show death screen if necessary
|
||||||
if(player->hp == 0)
|
if(player->isDead())
|
||||||
SendDeathscreen(peer_id, false, v3f(0,0,0));
|
SendDeathscreen(peer_id, false, v3f(0,0,0));
|
||||||
|
|
||||||
// Note things in chat if not in simple singleplayer mode
|
// Note things in chat if not in simple singleplayer mode
|
||||||
|
Loading…
Reference in New Issue
Block a user