Move tool stuff to tool.{h,cpp}
[oweals/minetest.git] / src / mapnode_contentfeatures.h
index 86eceeab636f6c4de3be0ce22812a7f6755881f6..68342c1f85f41ea33ce337737f4170e6c17236a1 100644 (file)
@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef SERVER
 #include "tile.h"
 #endif
+#include "materials.h" // MaterialProperties
 
 /*
        Content feature list
@@ -57,6 +58,35 @@ enum LiquidType
        LIQUID_SOURCE
 };
 
+enum NodeBoxType
+{
+       NODEBOX_REGULAR, // Regular block; allows buildable_to
+       NODEBOX_FIXED, // Static separately defined box
+       NODEBOX_WALLMOUNTED, // Box for wall_mounted nodes; (top, bottom, side)
+};
+
+struct NodeBox
+{
+       enum NodeBoxType type;
+       // NODEBOX_REGULAR (no parameters)
+       // NODEBOX_FIXED
+       core::aabbox3d<f32> fixed;
+       // NODEBOX_WALLMOUNTED
+       core::aabbox3d<f32> wall_top;
+       core::aabbox3d<f32> wall_bottom;
+       core::aabbox3d<f32> wall_side; // being at the -X side
+
+       NodeBox():
+               type(NODEBOX_REGULAR),
+               // default is rail-like
+               fixed(-BS/2, -BS/2, -BS/2, BS/2, -BS/2+BS/16., BS/2),
+               // default is sign/ladder-like
+               wall_top(-BS/2, BS/2-BS/16., -BS/2, BS/2, BS/2, BS/2),
+               wall_bottom(-BS/2, -BS/2, -BS/2, BS/2, -BS/2+BS/16., BS/2),
+               wall_side(-BS/2, -BS/2, -BS/2, -BS/2+BS/16., BS/2, BS/2)
+       {}
+};
+
 struct MapNode;
 class NodeMetadata;
 
@@ -86,7 +116,8 @@ struct ContentFeatures
 #endif
 
        // List of all block textures that have been used (value is dummy)
-       // Exists on server too for cleaner code in content_mapnode.cpp
+       // Used for texture atlas making.
+       // Exists on server too for cleaner code in content_mapnode.cpp.
        core::map<std::string, bool> used_texturenames;
        
        // Type of MapNode::param1
@@ -108,8 +139,6 @@ struct ContentFeatures
        bool climbable;
        // 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. Used for torches.
        // NOTE: the direction format is quite inefficient and should be changed
        bool wall_mounted;
@@ -132,8 +161,9 @@ struct ContentFeatures
        // Initial metadata is cloned from this
        NodeMetadata *initial_metadata;
        
+       // 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.
-       // If content is liquid, this is the same content.
        content_t liquid_alternative_flowing;
        // If the content is liquid, this is the source version of the liquid.
        content_t liquid_alternative_source;
@@ -145,10 +175,11 @@ struct ContentFeatures
        // Amount of light the node emits
        u8 light_source;
        
-       // Digging properties for different tools
-       DiggingPropertiesList digging_properties;
-
        u32 damage_per_second;
+
+       NodeBox selection_box;
+
+       MaterialProperties material;
        
        // NOTE: Move relevant properties to here from elsewhere
 
@@ -174,18 +205,19 @@ struct ContentFeatures
                diggable = true;
                climbable = false;
                buildable_to = false;
-               liquid_type = LIQUID_NONE;
                wall_mounted = false;
                air_equivalent = false;
                often_contains_mineral = false;
                dug_item = "";
                initial_metadata = NULL;
+               liquid_type = LIQUID_NONE;
                liquid_alternative_flowing = CONTENT_IGNORE;
                liquid_alternative_source = CONTENT_IGNORE;
                liquid_viscosity = 0;
                light_source = 0;
-               digging_properties.clear();
                damage_per_second = 0;
+               selection_box = NodeBox();
+               material = MaterialProperties();
        }
 
        ContentFeatures()