]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapnode.h
* better glass graphics
[minetest.git] / src / mapnode.h
index ce233e8e39e4c87a5321a1e95d6b8a6312d46661..ad256585ff425aaa3c2f232c0fa709546b5bbac0 100644 (file)
@@ -27,8 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "exceptions.h"
 #include "serialization.h"
 #include "tile.h"
-#include "iirrlichtwrapper.h"
-#include "nodemetadata.h"
 
 /*
        Initializes all kind of stuff in here.
@@ -99,6 +97,11 @@ void init_content_inventory_texture_paths();
 #define CONTENT_CHEST 15
 #define CONTENT_FURNACE 16
 //#define CONTENT_WORKBENCH 17
+#define CONTENT_COBBLE 18
+#define CONTENT_STEEL 19
+#define CONTENT_GLASS 20
+#define CONTENT_FENCE 21
+#define CONTENT_SANDSTONE 22
 
 /*
        Content feature list
@@ -121,6 +124,7 @@ enum LiquidType
 };
 
 class MapNode;
+class NodeMetadata;
 
 struct ContentFeatures
 {
@@ -146,14 +150,23 @@ struct ContentFeatures
        bool light_propagates;
        bool sunlight_propagates;
        u8 solidness; // Used when choosing which face is drawn
+       // This is used for collision detection.
+       // Also for general solidness queries.
        bool walkable;
+       // Player can point to these
        bool pointable;
+       // Player can dig these
        bool diggable;
+       // Player can build on these
        bool buildable_to;
+       // Whether the node has no liquid, source liquid or flowing liquid
        enum LiquidType liquid_type;
-       // If true, param2 is set to direction when placed
+       // 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;
        
        // Inventory item string as which the node appears in inventory when dug.
        // Mineral overrides this.
@@ -179,6 +192,7 @@ struct ContentFeatures
                buildable_to = false;
                liquid_type = LIQUID_NONE;
                wall_mounted = false;
+               air_equivalent = false;
                dug_item = "";
                initial_metadata = NULL;
        }
@@ -512,7 +526,7 @@ struct MapNode
                // Select the brightest of [light source, propagated light]
                u8 lightday = 0;
                u8 lightnight = 0;
-               if(light_propagates())
+               if(content_features(d).param_type == CPT_LIGHT)
                {
                        lightday = param & 0x0f;
                        lightnight = (param>>4)&0x0f;
@@ -533,7 +547,7 @@ struct MapNode
        {
                // Select the brightest of [light source, propagated light]
                u8 light = 0;
-               if(light_propagates())
+               if(content_features(d).param_type == CPT_LIGHT)
                {
                        if(bank == LIGHTBANK_DAY)
                                light = param & 0x0f;
@@ -575,8 +589,8 @@ struct MapNode
 
        void setLight(enum LightBank bank, u8 a_light)
        {
-               // If not transparent, can't set light
-               if(light_propagates() == false)
+               // If node doesn't contain light data, ignore this
+               if(content_features(d).param_type != CPT_LIGHT)
                        return;
                if(bank == LIGHTBANK_DAY)
                {