1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Fix damage flash when damage disabled

This commit is contained in:
kwolekr 2015-07-10 15:58:32 -04:00
parent 8eb272cea3
commit 1a1774a105
4 changed files with 25 additions and 15 deletions

View file

@ -1108,7 +1108,7 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
SendInventory(playersao);
// Send HP
SendPlayerHPOrDie(peer_id, playersao->getHP() == 0);
SendPlayerHPOrDie(playersao);
// Send Breath
SendPlayerBreath(peer_id);
@ -1487,6 +1487,20 @@ void Server::SendMovement(u16 peer_id)
Send(&pkt);
}
void Server::SendPlayerHPOrDie(PlayerSAO *playersao)
{
if (!g_settings->getBool("enable_damage"))
return;
u16 peer_id = playersao->getPeerID();
bool is_alive = playersao->getHP() > 0;
if (is_alive)
SendPlayerHP(peer_id);
else
DiePlayer(peer_id);
}
void Server::SendHP(u16 peer_id, u8 hp)
{
DSTACK(__FUNCTION_NAME);