aboutsummaryrefslogtreecommitdiff
path: root/src/clientserver.h
Commit message (Expand)AuthorAge
* Fix buttons not working for Lua-triggered formspecssapier2013-01-07
* Add TOCLIENT_SHOW_FORMSPEC to display formspecs at client from luasapier2013-01-02
* Added ability to fetch media from remote server (using cURL library)Ilya Zhuravlev2012-12-16
* Allow server to accept protocol 13 clients altough they don't work too wellPerttu Ahola2012-11-29
* Ranged support of protocol version on server sidePerttu Ahola2012-11-29
* Default server step to 0.1s and sync object/player update intervals to itPerttu Ahola2012-11-26
* Move a function from clientserver.h to clientserver.cppPerttu Ahola2012-11-26
* New PROTOCOL_VERSION scheme (allow client to support a range of versions)Perttu Ahola2012-11-26
* RealBadAngel's patch which allows the lua api to read pressed player keys. Th...MirceaKitsune2012-11-25
* A bunch of fixesMirceaKitsune2012-11-25
* Version 0.4.3-rc0; increase PROTOCOL_VERSION due to backwards-incompatible In...Perttu Ahola2012-09-05
* Detached inventoriesPerttu Ahola2012-07-24
* Fix map deserialization and remove old serialization codePerttu Ahola2012-07-23
* minetest.register_on_player_receive_fields()Perttu Ahola2012-07-22
* Allow defining player's inventory form in LuaPerttu Ahola2012-07-19
* Increment protocol versionPerttu Ahola2012-06-17
* Properly and efficiently use split utility headersPerttu Ahola2012-06-17
* Node texture animationPerttu Ahola2012-06-16
* Switch the license to be LGPLv2/later, with small parts still remaining as GP...Perttu Ahola2012-06-05
* Implement sign using form field protocolPerttu Ahola2012-06-03
* Add 'fly' and 'fast' privileges and the underlying privileges-to-client systemPerttu Ahola2012-03-31
* added PlayerSAO and RemotePlayer, removed ServerRemotePlayerKahrl2012-03-29
* Raise PROTOCOL_VERSION to 9, as this is not compatible with earlier versionsPerttu Ahola2012-03-25
* Texture cache -> Media cache WIPPerttu Ahola2012-03-25
* Lua API for playing soundsPerttu Ahola2012-03-24
* Dynamic sky, fog and cloud colors; sun and moonPerttu Ahola2012-03-18
* Digging time groups WIPPerttu Ahola2012-03-10
* The huge item definition and item namespace unification patch (itemdef), see ...Kahrl2012-01-12
* Add missing checks to texture cachingPerttu Ahola2012-01-04
* Texture cache on client (mostly made by sapier) (breaks network compatibility)Perttu Ahola2012-01-02
* Remove stuff made obsolete by making players more ActiveObject-like and raise...Perttu Ahola2011-12-01
* CraftItem rework and Lua interfaceKahrl2011-11-29
* Improve loading screen and protocolPerttu Ahola2011-11-29
* Node definitions transferPerttu Ahola2011-11-29
* Sending of textures WIPPerttu Ahola2011-11-29
* Tool definition transfer to clientPerttu Ahola2011-11-29
* strict_protocol_version_checking setting; PROTOCOL_VERSION in clientserver.h;...Perttu Ahola2011-10-15
* Handle death and respawn betterPerttu Ahola2011-10-15
* dissector branch: fix description of TOCLIENT_PLAYERITEM in clientserver.hKahrl2011-08-25
* Fixed some protocol comment errors in clientserver.h and elsewherePerttu Ahola2011-08-22
* Notify other players of wielded item changeGiuseppe Bilotta2011-08-11
* Clients inform server on wielded itemGiuseppe Bilotta2011-08-11
* Added network protocol version number in protocolPerttu Ahola2011-07-30
* map unloading is now a whole lot betterPerttu Ahola2011-06-27
* player passwords and privileges in world/auth.txtPerttu Ahola2011-05-29
* Added the ability to change your password (via pause menu)Ciaran Gultnieks2011-05-22
* Passwords - password entry at main menu, stored and checked by serverCiaran Gultnieks2011-05-20
* Some work-in-progress in hp and mobs and a frightening amount of random fixes.Perttu Ahola2011-04-21
* new object systemPerttu Ahola2011-04-10
* fully implemented the sign with the new frameworkPerttu Ahola2011-04-04
class="hl opt">); ActiveObjectType getType() const { return ACTIVEOBJECT_TYPE_PLAYER; } ActiveObjectType getSendType() const { return ACTIVEOBJECT_TYPE_GENERIC; } std::string getDescription(); /* Active object <-> environment interface */ void addedToEnvironment(u32 dtime_s); void removingFromEnvironment(); bool isStaticAllowed() const { return false; } bool shouldUnload() const { return false; } std::string getClientInitializationData(u16 protocol_version); void getStaticData(std::string *result) const; void step(float dtime, bool send_recommended); void setBasePosition(const v3f &position); void setPos(const v3f &pos); void moveTo(v3f pos, bool continuous); void setPlayerYaw(const float yaw); // Data should not be sent at player initialization void setPlayerYawAndSend(const float yaw); void setLookPitch(const float pitch); // Data should not be sent at player initialization void setLookPitchAndSend(const float pitch); f32 getLookPitch() const { return m_pitch; } f32 getRadLookPitch() const { return m_pitch * core::DEGTORAD; } // Deprecated f32 getRadLookPitchDep() const { return -1.0 * m_pitch * core::DEGTORAD; } void setFov(const float pitch); f32 getFov() const { return m_fov; } void setWantedRange(const s16 range); s16 getWantedRange() const { return m_wanted_range; } /* Interaction interface */ u16 punch(v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher, float time_from_last_punch); void rightClick(ServerActiveObject *clicker); void setHP(s32 hp, const PlayerHPChangeReason &reason); void setHPRaw(u16 hp) { m_hp = hp; } u16 getBreath() const { return m_breath; } void setBreath(const u16 breath, bool send = true); /* Inventory interface */ Inventory *getInventory() const; InventoryLocation getInventoryLocation() const; void setInventoryModified() {} std::string getWieldList() const { return "main"; } u16 getWieldIndex() const; ItemStack getWieldedItem(ItemStack *selected, ItemStack *hand = nullptr) const; bool setWieldedItem(const ItemStack &item); /* PlayerSAO-specific */ void disconnected(); RemotePlayer *getPlayer() { return m_player; } session_t getPeerID() const { return m_peer_id; } // Cheat prevention v3f getLastGoodPosition() const { return m_last_good_position; } float resetTimeFromLastPunch() { float r = m_time_from_last_punch; m_time_from_last_punch = 0.0; return r; } void noCheatDigStart(const v3s16 &p) { m_nocheat_dig_pos = p; m_nocheat_dig_time = 0; } v3s16 getNoCheatDigPos() { return m_nocheat_dig_pos; } float getNoCheatDigTime() { return m_nocheat_dig_time; } void noCheatDigEnd() { m_nocheat_dig_pos = v3s16(32767, 32767, 32767); } LagPool &getDigPool() { return m_dig_pool; } void setMaxSpeedOverride(const v3f &vel); // Returns true if cheated bool checkMovementCheat(); // Other void updatePrivileges(const std::set<std::string> &privs, bool is_singleplayer) { m_privs = privs; m_is_singleplayer = is_singleplayer; } bool getCollisionBox(aabb3f *toset) const; bool getSelectionBox(aabb3f *toset) const; bool collideWithObjects() const { return true; } void finalize(RemotePlayer *player, const std::set<std::string> &privs); v3f getEyePosition() const { return m_base_position + getEyeOffset(); } v3f getEyeOffset() const; float getZoomFOV() const; inline Metadata &getMeta() { return m_meta; } private: std::string getPropertyPacket(); void unlinkPlayerSessionAndSave(); std::string generateUpdatePhysicsOverrideCommand() const; RemotePlayer *m_player = nullptr; session_t m_peer_id = 0; // Cheat prevention LagPool m_dig_pool; LagPool m_move_pool; v3f m_last_good_position; float m_time_from_last_teleport = 0.0f; float m_time_from_last_punch = 0.0f; v3s16 m_nocheat_dig_pos = v3s16(32767, 32767, 32767); float m_nocheat_dig_time = 0.0f; float m_max_speed_override_time = 0.0f; v3f m_max_speed_override = v3f(0.0f, 0.0f, 0.0f); // Timers IntervalLimiter m_breathing_interval; IntervalLimiter m_drowning_interval; IntervalLimiter m_node_hurt_interval; bool m_position_not_sent = false; // Cached privileges for enforcement std::set<std::string> m_privs; bool m_is_singleplayer; u16 m_breath = PLAYER_MAX_BREATH_DEFAULT; f32 m_pitch = 0.0f; f32 m_fov = 0.0f; s16 m_wanted_range = 0.0f; Metadata m_meta; public: float m_physics_override_speed = 1.0f; float m_physics_override_jump = 1.0f; float m_physics_override_gravity = 1.0f; bool m_physics_override_sneak = true; bool m_physics_override_sneak_glitch = false; bool m_physics_override_new_move = true; bool m_physics_override_sent = false; }; struct PlayerHPChangeReason { enum Type : u8 { SET_HP, PLAYER_PUNCH, FALL, NODE_DAMAGE, DROWNING, RESPAWN }; Type type = SET_HP; bool from_mod = false; int lua_reference = -1; // For PLAYER_PUNCH ServerActiveObject *object = nullptr; // For NODE_DAMAGE std::string node; inline bool hasLuaReference() const { return lua_reference >= 0; } bool setTypeFromString(const std::string &typestr) { if (typestr == "set_hp") type = SET_HP; else if (typestr == "punch") type = PLAYER_PUNCH; else if (typestr == "fall") type = FALL; else if (typestr == "node_damage") type = NODE_DAMAGE; else if (typestr == "drown") type = DROWNING; else if (typestr == "respawn") type = RESPAWN; else return false; return true; } std::string getTypeAsString() const { switch (type) { case PlayerHPChangeReason::SET_HP: return "set_hp"; case PlayerHPChangeReason::PLAYER_PUNCH: return "punch"; case PlayerHPChangeReason::FALL: return "fall"; case PlayerHPChangeReason::NODE_DAMAGE: return "node_damage"; case PlayerHPChangeReason::DROWNING: return "drown"; case PlayerHPChangeReason::RESPAWN: return "respawn"; default: return "?"; } } PlayerHPChangeReason(Type type) : type(type) {} PlayerHPChangeReason(Type type, ServerActiveObject *object) : type(type), object(object) { } PlayerHPChangeReason(Type type, std::string node) : type(type), node(node) {} };