Node definition names
[oweals/minetest.git] / src / nodedef.h
index d63f8df9d04dc2be12d452333a8c0d6bfa06e9bc..055ed7a4b46b571d52539388aa9232b665152077 100644 (file)
@@ -32,28 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 class ITextureSource;
 class IGameDef;
 
-/*
-       TODO: Rename to nodedef.h
-*/
-
-#if 0
-
-/*
-       Content feature list
-       
-       Used for determining properties of MapNodes by content type without
-       storing such properties in the nodes itself.
-*/
-
-/*
-       Initialize content feature table.
-
-       Must be called before accessing the table.
-*/
-void init_contentfeatures(ITextureSource *tsrc);
-
-#endif
-
 enum ContentParamType
 {
        CPT_NONE,
@@ -160,13 +138,12 @@ struct ContentFeatures
        // the texture atlas
        std::set<std::string> used_texturenames;
        
-       // True if this actually contains non-default data
-       bool modified;
-
        /*
                Actual data
        */
 
+       std::string name; // "" = undefined node
+
        // Visual definition
        enum NodeDrawType drawtype;
        float visual_scale; // Misc. scale parameter
@@ -229,6 +206,8 @@ struct ContentFeatures
        NodeBox selection_box;
        MaterialProperties material;
        std::string cookresult_item;
+       float furnace_cooktime;
+       float furnace_burntime;
 
        /*
                Methods
@@ -274,6 +253,7 @@ public:
        // Get node definition
        virtual const ContentFeatures& get(content_t c) const=0;
        virtual const ContentFeatures& get(const MapNode &n) const=0;
+       virtual bool getId(const std::string &name, content_t &result) const=0;
        
        virtual void serialize(std::ostream &os)=0;
 };
@@ -287,10 +267,16 @@ public:
        // Get node definition
        virtual const ContentFeatures& get(content_t c) const=0;
        virtual const ContentFeatures& get(const MapNode &n) const=0;
+       virtual bool getId(const std::string &name, content_t &result) const=0;
                
        // Register node definition
        virtual void set(content_t c, const ContentFeatures &def)=0;
-       virtual ContentFeatures* getModifiable(content_t c)=0;
+       // Register node definition by name (allocate an id)
+       // If returns CONTENT_IGNORE, could not allocate id
+       virtual content_t set(const std::string &name,
+                       const ContentFeatures &def)=0;
+       // If returns CONTENT_IGNORE, could not allocate id
+       virtual content_t allocateDummy(const std::string &name)=0;
 
        /*
                Update tile textures to latest return values of TextueSource.