aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorLars Müller <34514239+appgurueu@users.noreply.github.com>2022-06-11 20:00:40 +0200
committerGitHub <noreply@github.com>2022-06-11 20:00:40 +0200
commitf4a53f7ee6fb5482f8193353c35be54b40533d6f (patch)
treefbbf1f323a0f0340e9f07c851bfba7c23e30b670 /src/server
parent3eafcab64ecaf8d00a9264b441e996825a6a31bd (diff)
downloadminetest-f4a53f7ee6fb5482f8193353c35be54b40533d6f.tar.gz
minetest-f4a53f7ee6fb5482f8193353c35be54b40533d6f.tar.bz2
minetest-f4a53f7ee6fb5482f8193353c35be54b40533d6f.zip
No damage effects on hp_max change (#11846)
Diffstat (limited to 'src/server')
-rw-r--r--src/server/player_sao.cpp2
-rw-r--r--src/server/player_sao.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/server/player_sao.cpp b/src/server/player_sao.cpp
index 27759ba9d..c5f6d0a24 100644
--- a/src/server/player_sao.cpp
+++ b/src/server/player_sao.cpp
@@ -495,7 +495,7 @@ void PlayerSAO::setHP(s32 target_hp, const PlayerHPChangeReason &reason, bool fr
m_hp = hp;
m_env->getGameDef()->HandlePlayerHPChange(this, reason);
} else if (from_client)
- m_env->getGameDef()->SendPlayerHP(this);
+ m_env->getGameDef()->SendPlayerHP(this, true);
}
void PlayerSAO::setBreath(const u16 breath, bool send)
diff --git a/src/server/player_sao.h b/src/server/player_sao.h
index b84bf1e82..5f48cae67 100644
--- a/src/server/player_sao.h
+++ b/src/server/player_sao.h
@@ -235,6 +235,7 @@ struct PlayerHPChangeReason
enum Type : u8
{
SET_HP,
+ SET_HP_MAX, // internal type to allow distinguishing hp reset and damage (for effects)
PLAYER_PUNCH,
FALL,
NODE_DAMAGE,
@@ -277,6 +278,7 @@ struct PlayerHPChangeReason
{
switch (type) {
case PlayerHPChangeReason::SET_HP:
+ case PlayerHPChangeReason::SET_HP_MAX:
return "set_hp";
case PlayerHPChangeReason::PLAYER_PUNCH:
return "punch";