X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fcontent_sao.h;h=63e8ef4601f3234a3c0170d67acac704dfa74337;hb=5ca336ea9281e87d8a2de95cef337e056266838d;hp=9640e5f0883d4a40bb708ebc86f7593acea62fcc;hpb=742614180cbbe598694a48bd9eb6f7b97a762243;p=dragonfireclient.git diff --git a/src/content_sao.h b/src/content_sao.h index 9640e5f08..63e8ef460 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "object_properties.h" ServerActiveObject* createItemSAO(ServerEnvironment *env, v3f pos, - const std::string itemstring); + const std::string &itemstring); /* LuaEntitySAO needs some internals exposed. @@ -37,7 +37,7 @@ class LuaEntitySAO : public ServerActiveObject { public: LuaEntitySAO(ServerEnvironment *env, v3f pos, - const std::string &name, const std::string &state); + const std::string &name, const std::string &state); ~LuaEntitySAO(); u8 getType() const { return ACTIVEOBJECT_TYPE_LUAENTITY; } @@ -124,30 +124,30 @@ class LuaEntitySAO : public ServerActiveObject class LagPool { - float pool; - float max; + float m_pool; + float m_max; public: - LagPool(): pool(15), max(15) + LagPool(): m_pool(15), m_max(15) {} void setMax(float new_max) { - max = new_max; - if(pool > new_max) - pool = new_max; + m_max = new_max; + if(m_pool > new_max) + m_pool = new_max; } void add(float dtime) { - pool -= dtime; - if(pool < 0) - pool = 0; + m_pool -= dtime; + if(m_pool < 0) + m_pool = 0; } bool grab(float dtime) { if(dtime <= 0) return true; - if(pool + dtime > max) + if(m_pool + dtime > m_max) return false; - pool += dtime; + m_pool += dtime; return true; } }; @@ -193,6 +193,7 @@ class PlayerSAO : public ServerActiveObject void rightClick(ServerActiveObject *clicker); s16 getHP() const; void setHP(s16 hp); + s16 readDamage(); u16 getBreath() const; void setBreath(u16 breath); void setArmorGroups(const ItemGroupList &armor_groups); @@ -262,7 +263,8 @@ class PlayerSAO : public ServerActiveObject { return m_dig_pool; } - void checkMovementCheat(); + // Returns true if cheated + bool checkMovementCheat(); // Other @@ -282,6 +284,7 @@ class PlayerSAO : public ServerActiveObject Player *m_player; u16 m_peer_id; Inventory *m_inventory; + s16 m_damage; // Cheat prevention LagPool m_dig_pool; @@ -327,6 +330,8 @@ class PlayerSAO : public ServerActiveObject float m_physics_override_speed; float m_physics_override_jump; float m_physics_override_gravity; + bool m_physics_override_sneak; + bool m_physics_override_sneak_glitch; bool m_physics_override_sent; };