mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Fix damage flash when damage disabled
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user