]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/nodedef.h
Tool progress bar tweaking
[dragonfireclient.git] / src / nodedef.h
index a29626b10fff7ed1aaea3327231c811c3d1bde97..598ad7fb391555eeac7f122189caf479e0fc89b4 100644 (file)
@@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "tile.h"
 #endif
 #include "materials.h" // MaterialProperties
+class IItemDefManager;
 class ITextureSource;
 class IGameDef;
 
@@ -124,7 +125,6 @@ struct ContentFeatures
        // 0     1     2     3     4     5
        // up    down  right left  back  front 
        TileSpec tiles[6];
-       video::ITexture *inventory_texture;
        // Special material/texture
        // - Currently used for flowing liquids
        video::SMaterial *special_materials[CF_SPECIAL_COUNT];
@@ -133,11 +133,7 @@ struct ContentFeatures
        u8 visual_solidness; // When solidness=0, this tells how it looks like
        bool backface_culling;
 #endif
-       
-       // List of textures that are used and are wanted to be included in
-       // the texture atlas
-       std::set<std::string> used_texturenames;
-       
+
        /*
                Actual data
        */
@@ -148,7 +144,6 @@ struct ContentFeatures
        enum NodeDrawType drawtype;
        float visual_scale; // Misc. scale parameter
        std::string tname_tiles[6];
-       std::string tname_inventory;
        MaterialSpec mspec_special[CF_SPECIAL_COUNT]; // Use setter methods
        u8 alpha;
 
@@ -174,13 +169,6 @@ struct ContentFeatures
        // If true, param2 is set to direction when placed. Used for torches.
        // NOTE: the direction format is quite inefficient and should be changed
        bool wall_mounted;
-       // If true, node is equivalent to air. Torches are, air is. Water is not.
-       // Is used for example to check whether a mud block can have grass on.
-       bool air_equivalent;
-       // Whether this content type often contains mineral.
-       // Used for texture atlas creation.
-       // Currently only enabled for CONTENT_STONE.
-       bool often_contains_mineral;
        // Inventory item string as which the node appears in inventory when dug.
        // Mineral overrides this.
        std::string dug_item;
@@ -188,14 +176,14 @@ struct ContentFeatures
        std::string extra_dug_item;
        // Usual get interval for extra dug item
        s32 extra_dug_item_rarity;
-       // Initial metadata is cloned from this
-       NodeMetadata *initial_metadata;
+       // Metadata name of node (eg. "furnace")
+       std::string metadata_name;
        // Whether the node is non-liquid, source liquid or flowing liquid
        enum LiquidType liquid_type;
        // If the content is liquid, this is the flowing version of the liquid.
-       content_t liquid_alternative_flowing;
+       std::string liquid_alternative_flowing;
        // If the content is liquid, this is the source version of the liquid.
-       content_t liquid_alternative_source;
+       std::string liquid_alternative_source;
        // Viscosity for fluid flow, ranging from 1 to 7, with
        // 1 giving almost instantaneous propagation and 7 being
        // the slowest possible
@@ -205,9 +193,6 @@ struct ContentFeatures
        u32 damage_per_second;
        NodeBox selection_box;
        MaterialProperties material;
-       std::string cookresult_item;
-       float furnace_cooktime;
-       float furnace_burntime;
 
        /*
                Methods
@@ -217,22 +202,8 @@ struct ContentFeatures
        ~ContentFeatures();
        void reset();
        void serialize(std::ostream &os);
-       void deSerialize(std::istream &is, IGameDef *gamedef);
+       void deSerialize(std::istream &is);
 
-       /*
-               Texture setters.
-               
-       */
-       
-       // Texture setters. They also add stuff to used_texturenames.
-       void setTexture(u16 i, std::string name);
-       void setAllTextures(std::string name);
-       void setSpecialMaterial(u16 i, const MaterialSpec &mspec);
-
-       void setInventoryTexture(std::string imgname);
-       void setInventoryTextureCube(std::string top,
-                       std::string left, std::string right);
-       
        /*
                Some handy methods
        */
@@ -253,6 +224,9 @@ class INodeDefManager
        // 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 content_t getId(const std::string &name) const=0;
+       virtual const ContentFeatures& get(const std::string &name) const=0;
        
        virtual void serialize(std::ostream &os)=0;
 };
@@ -266,10 +240,25 @@ class IWritableNodeDefManager : public INodeDefManager
        // 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 content_t getId(const std::string &name) const=0;
+       // If not found, returns the features of CONTENT_IGNORE
+       virtual const ContentFeatures& get(const std::string &name) 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 item alias mapping.
+               Call after updating item definitions.
+       */
+       virtual void updateAliases(IItemDefManager *idef)=0;
 
        /*
                Update tile textures to latest return values of TextueSource.
@@ -278,7 +267,7 @@ class IWritableNodeDefManager : public INodeDefManager
        virtual void updateTextures(ITextureSource *tsrc)=0;
 
        virtual void serialize(std::ostream &os)=0;
-       virtual void deSerialize(std::istream &is, IGameDef *gamedef)=0;
+       virtual void deSerialize(std::istream &is)=0;
 };
 
 IWritableNodeDefManager* createNodeDefManager();