X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fnodemetadata.h;h=de682f9b61561374a92ef80769e33f47ab335295;hb=7aa72c56b6a3d3af8a7dbef36d3a71fa311a7242;hp=8877c266760fb96cbf7d34dd743c2fd9b041bec2;hpb=4a92df6ff021f1bfa645f97fd551c648d1ef8e3b;p=dragonfireclient.git diff --git a/src/nodemetadata.h b/src/nodemetadata.h index 8877c2667..de682f9b6 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -54,8 +54,17 @@ class NodeMetadata virtual u16 typeId() const = 0; virtual NodeMetadata* clone() = 0; virtual void serializeBody(std::ostream &os) = 0; - virtual std::string infoText() {return "";} + virtual std::string infoText() {return "";} virtual Inventory* getInventory() {return NULL;} + // This is called always after the inventory is modified, before + // the changes are copied elsewhere + virtual void inventoryModified(){} + // A step in time. Returns true if metadata changed. + virtual bool step(float dtime) {return false;} + virtual bool nodeRemovalDisabled(){return false;} + // Used to make custom inventory menus. + // See format in guiInventoryMenu.cpp. + virtual std::string getInventoryDrawSpecString(){return "";} protected: static void registerType(u16 id, Factory f); @@ -63,41 +72,9 @@ class NodeMetadata static core::map m_types; }; -class SignNodeMetadata : public NodeMetadata -{ -public: - SignNodeMetadata(std::string text); - //~SignNodeMetadata(); - - virtual u16 typeId() const; - static NodeMetadata* create(std::istream &is); - virtual NodeMetadata* clone(); - virtual void serializeBody(std::ostream &os); - virtual std::string infoText(); - - std::string getText(){ return m_text; } - void setText(std::string t){ m_text = t; } - -private: - std::string m_text; -}; - -class ChestNodeMetadata : public NodeMetadata -{ -public: - ChestNodeMetadata(); - ~ChestNodeMetadata(); - - virtual u16 typeId() const; - static NodeMetadata* create(std::istream &is); - virtual NodeMetadata* clone(); - virtual void serializeBody(std::ostream &os); - virtual std::string infoText(); - virtual Inventory* getInventory() {return m_inventory;} - -private: - Inventory *m_inventory; -}; +/* + List of metadata of all the nodes of a block +*/ class NodeMetadataList { @@ -113,6 +90,10 @@ class NodeMetadataList void remove(v3s16 p); // Deletes old data and sets a new one void set(v3s16 p, NodeMetadata *d); + + // A step in time. Returns true if something changed. + bool step(float dtime); + private: core::map m_data; };