]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mapnode.cpp
+ paper, book, bookshelf
[dragonfireclient.git] / src / mapnode.cpp
index 187689c6fc3c038bba9256b88ad5cd0fe42949b7..7e97a8d04e22ba2e85688a9bb37d3e018585da01 100644 (file)
@@ -31,6 +31,8 @@ ContentFeatures::~ContentFeatures()
 {
        if(translate_to)
                delete translate_to;
+       if(initial_metadata)
+               delete initial_metadata;
 }
 
 void ContentFeatures::setTexture(u16 i, std::string name, u8 alpha)
@@ -128,6 +130,9 @@ void init_mapnode()
        for(u16 i=0; i<256; i++)
        {
                ContentFeatures *f = &g_content_features[i];
+               // Re-initialize
+               *f = ContentFeatures();
+
                for(u16 j=0; j<6; j++)
                        f->tiles[j].material_type = initial_material_type;
        }
@@ -141,7 +146,7 @@ void init_mapnode()
        f->setInventoryTextureCube("stone.png", "stone.png", "stone.png");
        f->param_type = CPT_MINERAL;
        f->is_ground_content = true;
-       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       f->dug_item = std::string("MaterialItem ")+itos(CONTENT_COBBLE)+" 1";
        
        i = CONTENT_GRASS;
        f = &g_content_features[i];
@@ -176,6 +181,30 @@ void init_mapnode()
        f->is_ground_content = true;
        f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
        
+       i = CONTENT_SANDSTONE;
+       f = &g_content_features[i];
+       f->setAllTextures("sandstone.png");
+       f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
+       f->param_type = CPT_MINERAL;
+       f->is_ground_content = true;
+       f->dug_item = std::string("MaterialItem ")+itos(CONTENT_SAND)+" 1";
+       
+       i = CONTENT_CLAY;
+       f = &g_content_features[i];
+       f->setAllTextures("clay.png");
+       f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
+       f->param_type = CPT_MINERAL;
+       f->is_ground_content = true;
+       f->dug_item = std::string("CraftItem lump_of_clay 4");
+       
+       i = CONTENT_BRICK;
+       f = &g_content_features[i];
+       f->setAllTextures("brick.png");
+       f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
+       f->param_type = CPT_MINERAL;
+       f->is_ground_content = true;
+       f->dug_item = std::string("CraftItem clay_brick 4");
+       
        i = CONTENT_TREE;
        f = &g_content_features[i];
        f->setAllTextures("tree.png");
@@ -201,7 +230,57 @@ void init_mapnode()
                f->setAllTextures("[noalpha:leaves.png");
        }
        f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
-       
+
+       i = CONTENT_CACTUS;
+       f = &g_content_features[i];
+       f->setAllTextures("cactus_side.png");
+       f->setTexture(0, "cactus_top.png");
+       f->setTexture(1, "cactus_top.png");
+       f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
+       f->param_type = CPT_MINERAL;
+       f->is_ground_content = true;
+       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+
+       i = CONTENT_PAPYRUS;
+       f = &g_content_features[i];
+       f->setInventoryTexture("papyrus.png");
+       f->light_propagates = true;
+       f->param_type = CPT_LIGHT;
+       f->is_ground_content = true;
+       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       f->solidness = 0; // drawn separately, makes no faces
+       f->walkable = false;
+
+       i = CONTENT_BOOKSHELF;
+       f = &g_content_features[i];
+       f->setAllTextures("bookshelf.png");
+       f->setTexture(0, "wood.png");
+       f->setTexture(1, "wood.png");
+       // FIXME: setInventoryTextureCube() only cares for the first texture
+       f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
+       //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
+       f->param_type = CPT_MINERAL;
+       f->is_ground_content = true;
+
+       i = CONTENT_GLASS;
+       f = &g_content_features[i];
+       f->light_propagates = true;
+       f->param_type = CPT_LIGHT;
+       f->is_ground_content = true;
+       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       f->solidness = 0; // drawn separately, makes no faces
+       f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
+
+       i = CONTENT_FENCE;
+       f = &g_content_features[i];
+       f->setInventoryTexture("fence.png");
+       f->light_propagates = true;
+       f->param_type = CPT_LIGHT;
+       f->is_ground_content = true;
+       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       f->solidness = 0; // drawn separately, makes no faces
+       f->air_equivalent = true; // grass grows underneath
+
        // Deprecated
        i = CONTENT_COALSTONE;
        f = &g_content_features[i];
@@ -237,6 +316,7 @@ void init_mapnode()
        f->pointable = false;
        f->diggable = false;
        f->buildable_to = true;
+       f->air_equivalent = true;
        
        i = CONTENT_WATER;
        f = &g_content_features[i];
@@ -284,9 +364,11 @@ void init_mapnode()
        f->setInventoryTexture("torch_on_floor.png");
        f->param_type = CPT_LIGHT;
        f->light_propagates = true;
+       f->sunlight_propagates = true;
        f->solidness = 0; // drawn separately, makes no faces
        f->walkable = false;
        f->wall_mounted = true;
+       f->air_equivalent = true;
        f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
        
        i = CONTENT_SIGN_WALL;
@@ -298,6 +380,7 @@ void init_mapnode()
        f->solidness = 0; // drawn separately, makes no faces
        f->walkable = false;
        f->wall_mounted = true;
+       f->air_equivalent = true;
        f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
        if(f->initial_metadata == NULL)
                f->initial_metadata = new SignNodeMetadata("Some sign");
@@ -321,10 +404,29 @@ void init_mapnode()
        f->setAllTextures("furnace_side.png");
        f->setTexture(5, "furnace_front.png"); // Z-
        f->setInventoryTexture("furnace_front.png");
-       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       //f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       f->dug_item = std::string("MaterialItem ")+itos(CONTENT_COBBLE)+" 6";
        if(f->initial_metadata == NULL)
                f->initial_metadata = new FurnaceNodeMetadata();
        
+       i = CONTENT_COBBLE;
+       f = &g_content_features[i];
+       f->setAllTextures("cobble.png");
+       f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
+       f->param_type = CPT_NONE;
+       f->is_ground_content = true;
+       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       
+       i = CONTENT_STEEL;
+       f = &g_content_features[i];
+       f->setAllTextures("steel_block.png");
+       f->setInventoryTextureCube("steel_block.png", "steel_block.png",
+                       "steel_block.png");
+       f->param_type = CPT_NONE;
+       f->is_ground_content = true;
+       f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+       
+       // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
 }
 
 v3s16 facedir_rotate(u8 facedir, v3s16 dir)