]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapnode.h
mobv2
[minetest.git] / src / mapnode.h
index 3101a9fc142d752975f5f60aa08dc8173f22d4f8..5db3379490088893d57b19e04c2c2b05d5fb2011 100644 (file)
@@ -23,11 +23,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <iostream>
 #include "common_irrlicht.h"
 #include "light.h"
-#include "utility.h"
 #include "exceptions.h"
 #include "serialization.h"
-#include "tile.h"
 #include "materials.h"
+#ifndef SERVER
+#include "tile.h"
+#endif
 
 /*
        Naming scheme:
@@ -101,9 +102,7 @@ class NodeMetadata;
 
 struct ContentFeatures
 {
-       // Type of MapNode::param1
-       ContentParamType param_type;
-
+#ifndef SERVER
        /*
                0: up
                1: down
@@ -115,12 +114,24 @@ struct ContentFeatures
        TileSpec tiles[6];
        
        video::ITexture *inventory_texture;
-       
+
+       // Used currently for flowing liquids
+       u8 vertex_alpha;
+       // Post effect color, drawn when the camera is inside the node.
+       video::SColor post_effect_color;
+       // Special irrlicht material, used sometimes
+       video::SMaterial *special_material;
+       AtlasPointer *special_atlas;
+#endif
+
+       // Type of MapNode::param1
+       ContentParamType param_type;
        // True for all ground-like things like stone and mud, false for eg. trees
        bool is_ground_content;
        bool light_propagates;
        bool sunlight_propagates;
        u8 solidness; // Used when choosing which face is drawn
+       u8 visual_solidness; // When solidness=0, this tells how it looks like
        // This is used for collision detection.
        // Also for general solidness queries.
        bool walkable;
@@ -144,7 +155,11 @@ struct ContentFeatures
        // Inventory item string as which the node appears in inventory when dug.
        // Mineral overrides this.
        std::string dug_item;
-       
+
+       // Extra dug item and its rarity
+       std::string extra_dug_item;
+       s32 extra_dug_item_rarity;
+
        // Initial metadata is cloned from this
        NodeMetadata *initial_metadata;
        
@@ -153,11 +168,10 @@ struct ContentFeatures
        content_t liquid_alternative_flowing;
        // If the content is liquid, this is the source version of the liquid.
        content_t liquid_alternative_source;
-       // Used currently for flowing liquids
-       u8 vertex_alpha;
-       // Special irrlicht material, used sometimes
-       video::SMaterial *special_material;
-       AtlasPointer *special_atlas;
+       // Viscosity for fluid flow, ranging from 1 to 7, with
+       // 1 giving almost instantaneous propagation and 7 being
+       // the slowest possible
+       u8 liquid_viscosity;
        
        // Amount of light the node emits
        u8 light_source;
@@ -171,12 +185,20 @@ struct ContentFeatures
 
        void reset()
        {
-               param_type = CPT_NONE;
+#ifndef SERVER
                inventory_texture = NULL;
+               
+               vertex_alpha = 255;
+               post_effect_color = video::SColor(0, 0, 0, 0);
+               special_material = NULL;
+               special_atlas = NULL;
+#endif
+               param_type = CPT_NONE;
                is_ground_content = false;
                light_propagates = false;
                sunlight_propagates = false;
                solidness = 2;
+               visual_solidness = 0;
                walkable = true;
                pointable = true;
                diggable = true;
@@ -189,9 +211,7 @@ struct ContentFeatures
                initial_metadata = NULL;
                liquid_alternative_flowing = CONTENT_IGNORE;
                liquid_alternative_source = CONTENT_IGNORE;
-               vertex_alpha = 255;
-               special_material = NULL;
-               special_atlas = NULL;
+               liquid_viscosity = 0;
                light_source = 0;
                digging_properties.clear();
                damage_per_second = 0;
@@ -208,6 +228,12 @@ struct ContentFeatures
                Quickhands for simple materials
        */
        
+#ifdef SERVER
+       void setTexture(u16 i, std::string name, u8 alpha=255)
+       {}
+       void setAllTextures(std::string name, u8 alpha=255)
+       {}
+#else
        void setTexture(u16 i, std::string name, u8 alpha=255);
 
        void setAllTextures(std::string name, u8 alpha=255)
@@ -219,7 +245,9 @@ struct ContentFeatures
                // Force inventory texture too
                setInventoryTexture(name);
        }
+#endif
 
+#ifndef SERVER
        void setTile(u16 i, const TileSpec &tile)
        {
                tiles[i] = tile;
@@ -231,11 +259,20 @@ struct ContentFeatures
                        setTile(i, tile);
                }
        }
+#endif
 
+#ifdef SERVER
+       void setInventoryTexture(std::string imgname)
+       {}
+       void setInventoryTextureCube(std::string top,
+                       std::string left, std::string right)
+       {}
+#else
        void setInventoryTexture(std::string imgname);
        
        void setInventoryTextureCube(std::string top,
                        std::string left, std::string right);
+#endif
 };
 
 /*
@@ -424,6 +461,10 @@ enum LightBank
 #define LIQUID_LEVEL_MASK 0x07
 #define LIQUID_FLOW_DOWN_MASK 0x08
 
+/* maximum amount of liquid in a block */
+#define LIQUID_LEVEL_MAX LIQUID_LEVEL_MASK
+#define LIQUID_LEVEL_SOURCE (LIQUID_LEVEL_MAX+1)
+
 /*
        This is the stuff what the whole world consists of.
 */
@@ -614,6 +655,7 @@ struct MapNode
        }
        
        // In mapnode.cpp
+#ifndef SERVER
        /*
                Get tile of a face of the node.
                dir: direction of face
@@ -621,6 +663,7 @@ struct MapNode
                         which must be obeyed so that the texture atlas can be used.
        */
        TileSpec getTile(v3s16 dir);
+#endif
        
        /*
                Gets mineral content of node, if there is any.