aboutsummaryrefslogtreecommitdiff
path: root/src/serverobject.h
Commit message (Expand)AuthorAge
* Revert "Detach the player from entities on death." (#5087)Loïc Blot2017-01-21
* Detach the player from entities on death. (#5077)red-0012017-01-21
* Fix missing const in ServerActiveObject::getStaticDataLoic Blot2017-01-14
* Optimize SAO getStaticData by using std::string pointer instead of return copyLoic Blot2017-01-13
* Performance fix + SAO factorizationRogier2017-01-11
* PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul2016-10-30
* Attached particle spawnersraymoo2016-10-13
* Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)Loic Blot2016-10-08
* Prevent attached models from disappearing during parent reload (#4128)Foghrye42016-10-08
* Fix invisible player when the attached entity is removedTeTpaAka2015-07-18
* Fix some issues with animations, and allow non-looped animations to be definedMirceaKitsune2015-06-22
* Fix typo in variable nameKahrl2015-05-28
* Add some missing getter functions to the lua APITeTpaAka2015-05-28
* Consistent const string paramsest312015-05-27
* Remove Queue class which uses std::list and use native std::queueLoic Blot2015-03-05
* SAO: re-add old ActiveObjectTypes for a future migration layerLoic Blot2015-02-17
* SAO work: ActiveObject types & SAO cleanup * Replace u8 types with ActiveObje...Loic Blot2015-02-17
* Replace setting unlimited_player_transfer_distance with player_transfer_distanceSmallJoker2014-11-08
* Remove remenants of mob codePavel Puchkin2014-10-23
* Allow modifying movement speed, jump height and gravity per-player via the Lu...MirceaKitsune2013-04-05
* Migrate to STL containers/algorithms.Ilya Zhuravlev2013-03-11
* Update Copyright YearsSfan52013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* Full protocol 13 compatibility on server sidePerttu Ahola2012-11-29
* A bunch of fixesMirceaKitsune2012-11-25
* Update attachments at the ending of the addToScene function for parents. And ...MirceaKitsune2012-11-25
* Framework for the attachment system, new object property which allows changin...MirceaKitsune2012-11-25
* Get the new animation framework properly workingMirceaKitsune2012-11-25
* Add dtime_s to entity activationPerttu Ahola2012-09-09
* Optimize headersPerttu Ahola2012-06-17
* Properly and efficiently use split utility headersPerttu Ahola2012-06-17
* Switch the license to be LGPLv2/later, with small parts still remaining as GP...Perttu Ahola2012-06-05
* ObjectRef:set_armor_groups() and ObjectRef:set_properties() - works on player...Perttu Ahola2012-03-30
* Add GenericCAO and player armor groups, but don't use them yetPerttu Ahola2012-03-29
* added PlayerSAO and RemotePlayer, removed ServerRemotePlayerKahrl2012-03-29
* Entity damage system WIP; Remove C++ mobsPerttu Ahola2012-03-10
* Fix some warnings on some compilersGiuseppe Bilotta2012-02-02
* The huge item definition and item namespace unification patch (itemdef), see ...Kahrl2012-01-12
* Make players be again visible from a long distancePerttu Ahola2011-12-02
* Players are more like objects + related stuffPerttu Ahola2011-12-01
* Player-is-SAO WIPPerttu Ahola2011-12-01
* Add ServerActiveObject::removingFromEnvironment()Perttu Ahola2011-12-01
* CraftItem rework and Lua interfaceKahrl2011-11-29
* Create framework for getting rid of global definitions of node/tool/item/what...Perttu Ahola2011-11-29
* Scripting WIP: dynamic object stuffPerttu Ahola2011-11-29
* ServerRemotePlayer implements ServerActiveObjectPerttu Ahola2011-11-29
* Scripting WIPPerttu Ahola2011-11-29
* Scripting WIPPerttu Ahola2011-11-29
* Scripting WIPPerttu Ahola2011-11-29
* Scripting WIPPerttu Ahola2011-11-29
v; } /* Some more dynamic interface */ virtual void setPos(const v3f &pos) { setBasePosition(pos); } // continuous: if true, object does not stop immediately at pos virtual void moveTo(v3f pos, bool continuous) { setBasePosition(pos); } // If object has moved less than this and data has not changed, // saving to disk may be omitted virtual float getMinimumSavedMovement(); virtual std::string getDescription(){return "SAO";} /* Step object in time. Messages added to messages are sent to client over network. send_recommended: True at around 5-10 times a second, same for all objects. This is used to let objects send most of the data at the same time so that the data can be combined in a single packet. */ virtual void step(float dtime, bool send_recommended){} /* The return value of this is passed to the client-side object when it is created */ virtual std::string getClientInitializationData(u16 protocol_version){return "";} /* The return value of this is passed to the server-side object when it is created (converted from static to active - actually the data is the static form) */ virtual void getStaticData(std::string *result) const { assert(isStaticAllowed()); *result = ""; } /* Return false in here to never save and instead remove object on unload. getStaticData() will not be called in that case. */ virtual bool isStaticAllowed() const {return true;} // Returns tool wear virtual int punch(v3f dir, const ToolCapabilities *toolcap=NULL, ServerActiveObject *puncher=NULL, float time_from_last_punch=1000000) { return 0; } virtual void rightClick(ServerActiveObject *clicker) {} virtual void setHP(s16 hp) {} virtual s16 getHP() const { return 0; } virtual void setArmorGroups(const ItemGroupList &armor_groups) {} virtual const ItemGroupList &getArmorGroups() { static const ItemGroupList rv; return rv; } virtual void setPhysicsOverride(float physics_override_speed, float physics_override_jump, float physics_override_gravity) {} virtual void setAnimation(v2f frames, float frame_speed, float frame_blend, bool frame_loop) {} virtual void getAnimation(v2f *frames, float *frame_speed, float *frame_blend, bool *frame_loop) {} virtual void setBonePosition(const std::string &bone, v3f position, v3f rotation) {} virtual void getBonePosition(const std::string &bone, v3f *position, v3f *lotation) {} virtual void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation) {} virtual void getAttachment(int *parent_id, std::string *bone, v3f *position, v3f *rotation) {} virtual void addAttachmentChild(int child_id) {} virtual void removeAttachmentChild(int child_id) {} virtual const UNORDERED_SET<int> &getAttachmentChildIds() { static const UNORDERED_SET<int> rv; return rv; } virtual ObjectProperties* accessObjectProperties() { return NULL; } virtual void notifyObjectPropertiesModified() {} // Inventory and wielded item virtual Inventory* getInventory() { return NULL; } virtual const Inventory* getInventory() const { return NULL; } virtual InventoryLocation getInventoryLocation() const { return InventoryLocation(); } virtual void setInventoryModified() {} virtual std::string getWieldList() const { return ""; } virtual int getWieldIndex() const { return 0; } virtual ItemStack getWieldedItem() const; virtual bool setWieldedItem(const ItemStack &item); inline void attachParticleSpawner(u32 id) { m_attached_particle_spawners.insert(id); } inline void detachParticleSpawner(u32 id) { m_attached_particle_spawners.erase(id); } /* Number of players which know about this object. Object won't be deleted until this is 0 to keep the id preserved for the right object. */ u16 m_known_by_count; /* - Whether this object is to be removed when nobody knows about it anymore. - Removal is delayed to preserve the id for the time during which it could be confused to some other object by some client. - This is set to true by the step() method when the object wants to be deleted. - This can be set to true by anything else too. */ bool m_removed; /* This is set to true when an object should be removed from the active object list but couldn't be removed because the id has to be reserved for some client. The environment checks this periodically. If this is true and also m_known_by_count is true, object is deleted from the active object list. */ bool m_pending_deactivation; /* Whether the object's static data has been stored to a block */ bool m_static_exists; /* The block from which the object was loaded from, and in which a copy of the static data resides. */ v3s16 m_static_block; /* Queue of messages to be sent to the client */ std::queue<ActiveObjectMessage> m_messages_out; protected: // Used for creating objects based on type typedef ServerActiveObject* (*Factory) (ServerEnvironment *env, v3f pos, const std::string &data); static void registerType(u16 type, Factory f); ServerEnvironment *m_env; v3f m_base_position; UNORDERED_SET<u32> m_attached_particle_spawners; private: // Used for creating objects based on type static std::map<u16, Factory> m_types; }; #endif