diff options
author | Lars Müller <34514239+appgurueu@users.noreply.github.com> | 2022-06-11 20:00:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-11 20:00:40 +0200 |
commit | f4a53f7ee6fb5482f8193353c35be54b40533d6f (patch) | |
tree | fbbf1f323a0f0340e9f07c851bfba7c23e30b670 /src/server.cpp | |
parent | 3eafcab64ecaf8d00a9264b441e996825a6a31bd (diff) | |
download | minetest-f4a53f7ee6fb5482f8193353c35be54b40533d6f.tar.gz minetest-f4a53f7ee6fb5482f8193353c35be54b40533d6f.tar.bz2 minetest-f4a53f7ee6fb5482f8193353c35be54b40533d6f.zip |
No damage effects on hp_max change (#11846)
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/server.cpp b/src/server.cpp index 013c039c3..97d2b69b4 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1107,7 +1107,7 @@ PlayerSAO* Server::StageTwoClientInit(session_t peer_id) SendInventory(playersao, false); // Send HP - SendPlayerHP(playersao); + SendPlayerHP(playersao, false); // Send death screen if (playersao->isDead()) @@ -1374,7 +1374,7 @@ void Server::SendMovement(session_t peer_id) void Server::HandlePlayerHPChange(PlayerSAO *playersao, const PlayerHPChangeReason &reason) { m_script->player_event(playersao, "health_changed"); - SendPlayerHP(playersao); + SendPlayerHP(playersao, reason.type != PlayerHPChangeReason::SET_HP_MAX); // Send to other clients playersao->sendPunchCommand(); @@ -1383,15 +1383,15 @@ void Server::HandlePlayerHPChange(PlayerSAO *playersao, const PlayerHPChangeReas HandlePlayerDeath(playersao, reason); } -void Server::SendPlayerHP(PlayerSAO *playersao) +void Server::SendPlayerHP(PlayerSAO *playersao, bool effect) { - SendHP(playersao->getPeerID(), playersao->getHP()); + SendHP(playersao->getPeerID(), playersao->getHP(), effect); } -void Server::SendHP(session_t peer_id, u16 hp) +void Server::SendHP(session_t peer_id, u16 hp, bool effect) { - NetworkPacket pkt(TOCLIENT_HP, 1, peer_id); - pkt << hp; + NetworkPacket pkt(TOCLIENT_HP, 3, peer_id); + pkt << hp << effect; Send(&pkt); } |