Tooltips: Unify the tooltip[] and list[] description tooltip display functions (...
[oweals/minetest.git] / src / serverobject.h
index cfe2b6bcc20a366c9dc72f8774d3bfac0cb7fc95..38204980e439b57beda6722863a6d16d73166c97 100644 (file)
@@ -85,7 +85,7 @@ public:
                Some more dynamic interface
        */
 
-       virtual void setPos(v3f pos)
+       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)
@@ -119,10 +119,10 @@ public:
                when it is created (converted from static to active - actually
                the data is the static form)
        */
-       virtual std::string getStaticData()
+       virtual void getStaticData(std::string *result) const
        {
                assert(isStaticAllowed());
-               return "";
+               *result = "";
        }
        /*
                Return false in here to never save and instead remove object
@@ -146,8 +146,8 @@ public:
 
        virtual void setArmorGroups(const ItemGroupList &armor_groups)
        {}
-       virtual ItemGroupList getArmorGroups()
-       { return ItemGroupList(); }
+       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)
@@ -166,8 +166,8 @@ public:
        {}
        virtual void removeAttachmentChild(int child_id)
        {}
-       virtual UNORDERED_SET<int> getAttachmentChildIds()
-       { return UNORDERED_SET<int>(); }
+       virtual const UNORDERED_SET<int> &getAttachmentChildIds()
+       { static const UNORDERED_SET<int> rv; return rv; }
        virtual ObjectProperties* accessObjectProperties()
        { return NULL; }
        virtual void notifyObjectPropertiesModified()
@@ -188,6 +188,15 @@ public:
        { 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
@@ -242,6 +251,7 @@ protected:
 
        ServerEnvironment *m_env;
        v3f m_base_position;
+       UNORDERED_SET<u32> m_attached_particle_spawners;
 
 private:
        // Used for creating objects based on type