diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2019-02-11 00:03:26 +0100 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2019-02-10 23:03:26 +0000 |
commit | ffb17f1c9a203fea6de70159b461f52d104e05b9 (patch) | |
tree | ca2c9f26515b8c6dad2a42b7e09f5d2a91d6f398 /src/content_sao.h | |
parent | ba5a9f2b361a2fa01d1a3396999a5833983c0f4a (diff) | |
download | minetest-ffb17f1c9a203fea6de70159b461f52d104e05b9.tar.gz minetest-ffb17f1c9a203fea6de70159b461f52d104e05b9.tar.bz2 minetest-ffb17f1c9a203fea6de70159b461f52d104e05b9.zip |
Consistent HP and damage types (#8167)
Remove deprecated HUDs and chat message handling.
Remove unused m_damage variable (compat break).
HP: s32 for setter/calculations, u16 for getter.
Diffstat (limited to 'src/content_sao.h')
-rw-r--r-- | src/content_sao.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/content_sao.h b/src/content_sao.h index 6d2f55b70..14f959e30 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -39,7 +39,7 @@ public: // Deprecated f32 getRadYawDep() const { return (m_rotation.Y + 90.) * core::DEGTORAD; } - s16 getHP() const { return m_hp; } + u16 getHP() const { return m_hp; } // Use a function, if isDead can be defined by other conditions bool isDead() const { return m_hp == 0; } @@ -64,7 +64,7 @@ public: ObjectProperties* accessObjectProperties(); void notifyObjectPropertiesModified(); protected: - s16 m_hp = -1; + u16 m_hp = 1; v3f m_rotation; @@ -127,8 +127,8 @@ public: void moveTo(v3f pos, bool continuous); float getMinimumSavedMovement(); std::string getDescription(); - void setHP(s16 hp, const PlayerHPChangeReason &reason); - s16 getHP() const; + void setHP(s32 hp, const PlayerHPChangeReason &reason); + u16 getHP() const; /* LuaEntitySAO-specific */ void setVelocity(v3f velocity); void addVelocity(v3f velocity) @@ -258,8 +258,8 @@ public: ServerActiveObject *puncher, float time_from_last_punch); void rightClick(ServerActiveObject *clicker) {} - void setHP(s16 hp, const PlayerHPChangeReason &reason); - void setHPRaw(s16 hp) { m_hp = hp; } + void setHP(s32 hp, const PlayerHPChangeReason &reason); + void setHPRaw(u16 hp) { m_hp = hp; } s16 readDamage(); u16 getBreath() const { return m_breath; } void setBreath(const u16 breath, bool send = true); @@ -351,7 +351,6 @@ private: RemotePlayer *m_player = nullptr; session_t m_peer_id = 0; Inventory *m_inventory = nullptr; - s16 m_damage = 0; // Cheat prevention LagPool m_dig_pool; |