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";
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;
}
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);