diff options
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp index 19aaa3e7a..9d70ad7b7 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -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); |