From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 11:12:56 +0000 (+0200) Subject: + paper, book, bookshelf X-Git-Tag: 0.2.20110922~81^2~35^2~51 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1bd25925cb8b4f96f5d5deec348db1214f3da525;p=oweals%2Fminetest.git + paper, book, bookshelf --- diff --git a/data/book.png b/data/book.png new file mode 100644 index 000000000..176fb6aa9 Binary files /dev/null and b/data/book.png differ diff --git a/data/bookshelf.png b/data/bookshelf.png new file mode 100644 index 000000000..5ecc50ff3 Binary files /dev/null and b/data/bookshelf.png differ diff --git a/data/paper.png b/data/paper.png new file mode 100644 index 000000000..ae5c06bc6 Binary files /dev/null and b/data/paper.png differ diff --git a/src/inventory.cpp b/src/inventory.cpp index 3f83c7419..cb398a537 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -156,6 +156,10 @@ video::ITexture * CraftItem::getImage() if(m_subname == "Stick") name = "stick.png"; + else if(m_subname == "paper") + name = "paper.png"; + else if(m_subname == "book") + name = "book.png"; else if(m_subname == "lump_of_coal") name = "lump_of_coal.png"; else if(m_subname == "lump_of_iron") diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 954c85f2f..7e97a8d04 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -251,6 +251,17 @@ void init_mapnode() 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; diff --git a/src/mapnode.h b/src/mapnode.h index 52d0199c4..57335b741 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -106,6 +106,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_BRICK 24 #define CONTENT_CLAY 25 #define CONTENT_PAPYRUS 26 +#define CONTENT_BOOKSHELF 27 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index e95ca7ba9..7815f593e 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -80,6 +80,7 @@ void initializeMaterialProperties() setWoodLikeDiggingProperties(CONTENT_GLASS, 0.15); setWoodLikeDiggingProperties(CONTENT_FENCE, 0.75); setWoodLikeDiggingProperties(CONTENT_WOOD, 0.75); + setWoodLikeDiggingProperties(CONTENT_BOOKSHELF, 0.75); setWoodLikeDiggingProperties(CONTENT_CHEST, 1.0); g_material_properties[CONTENT_SIGN_WALL].setDiggingProperties("", diff --git a/src/server.cpp b/src/server.cpp index e9875456c..f40ed05a5 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4017,6 +4017,54 @@ void Server::UpdateCrafting(u16 peer_id) found = true; } } + + // Paper + if(!found) + { + ItemSpec specs[9]; + specs[3] = ItemSpec(ITEM_MATERIAL, CONTENT_PAPYRUS); + specs[4] = ItemSpec(ITEM_MATERIAL, CONTENT_PAPYRUS); + specs[5] = ItemSpec(ITEM_MATERIAL, CONTENT_PAPYRUS); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new CraftItem("paper", 1)); + found = true; + } + } + + // Book + if(!found) + { + ItemSpec specs[9]; + specs[1] = ItemSpec(ITEM_CRAFT, "paper"); + specs[4] = ItemSpec(ITEM_CRAFT, "paper"); + specs[7] = ItemSpec(ITEM_CRAFT, "paper"); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new CraftItem("book", 1)); + found = true; + } + } + + // Book shelf + if(!found) + { + ItemSpec specs[9]; + specs[0] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[1] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[2] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[3] = ItemSpec(ITEM_CRAFT, "book"); + specs[4] = ItemSpec(ITEM_CRAFT, "book"); + specs[5] = ItemSpec(ITEM_CRAFT, "book"); + specs[6] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[7] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + specs[8] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD); + if(checkItemCombination(items, specs)) + { + rlist->addItem(new MaterialItem(CONTENT_BOOKSHELF, 1)); + found = true; + } + } } } // if creative_mode == false @@ -4112,6 +4160,7 @@ void setCreativeInventory(Player *player) CONTENT_LEAVES, CONTENT_CACTUS, CONTENT_PAPYRUS, + CONTENT_BOOKSHELF, CONTENT_GLASS, CONTENT_FENCE, CONTENT_MESE, diff --git a/src/tile.cpp b/src/tile.cpp index c77262c49..c703e147c 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -518,6 +518,7 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("cactus_side.png"); sourcelist.push_back("cactus_top.png"); sourcelist.push_back("papyrus.png"); + sourcelist.push_back("bookshelf.png"); sourcelist.push_back("glass.png"); sourcelist.push_back("mud.png^grass_side.png"); sourcelist.push_back("cobble.png");