diff options
-rw-r--r-- | src/content_sao.cpp | 8 | ||||
-rw-r--r-- | src/content_sao.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index f2cd0ff11..4959ec569 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -566,7 +566,8 @@ int LuaEntitySAO::punch(v3f dir, if (!damage_handled) { if (result.did_punch) { - setHP(getHP() - result.damage); + setHP(getHP() - result.damage, + PlayerHPChangeReason(PlayerHPChangeReason::SET_HP)); if (result.damage > 0) { std::string punchername = puncher ? puncher->getDescription() : "nil"; @@ -634,9 +635,10 @@ std::string LuaEntitySAO::getDescription() return os.str(); } -void LuaEntitySAO::setHP(s16 hp) +void LuaEntitySAO::setHP(s16 hp, const PlayerHPChangeReason &reason) { - if(hp < 0) hp = 0; + if (hp < 0) + hp = 0; m_hp = hp; } diff --git a/src/content_sao.h b/src/content_sao.h index 10630014c..509f477dd 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -117,7 +117,7 @@ public: void moveTo(v3f pos, bool continuous); float getMinimumSavedMovement(); std::string getDescription(); - void setHP(s16 hp); + void setHP(s16 hp, const PlayerHPChangeReason &reason); s16 getHP() const; /* LuaEntitySAO-specific */ void setVelocity(v3f velocity); |