From 8835433b5ef23c22b3b84045af6f97dc52883ef1 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 13:12:56 +0200 Subject: [PATCH] + paper, book, bookshelf --- data/book.png | Bin 0 -> 292 bytes data/bookshelf.png | Bin 0 -> 597 bytes data/paper.png | Bin 0 -> 242 bytes src/inventory.cpp | 4 ++++ src/mapnode.cpp | 11 ++++++++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++ src/tile.cpp | 1 + 9 files changed, 67 insertions(+) create mode 100644 data/book.png create mode 100644 data/bookshelf.png create mode 100644 data/paper.png diff --git a/data/book.png b/data/book.png new file mode 100644 index 0000000000000000000000000000000000000000..176fb6aa96154614c7edb3a7ed80064d23a8fceb GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRt!3HF+tk*dLq!^2X+?^QKos)S9vL>4nJ za0`PlBg3pY5H=O_SORIEGl9PEL@>IN;&oSg&%qUSfB_ zPkXmTybjkocrNfJsx0|IqP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RW1_J>KEte|7$^ZZX=Sf6CR4C7- zQq61Aa2S5_%bTRBSzR$8Oxw#ktsn{=dYK1hc-f@`Jq&vAQkVp9$~^3%;1IkCK_-Yy z{{TTz4}P#BC?RO4;$ea^u~tzlOJ`!+^q0g#Yn>f};B$I;-mi!Ed4+S+qr`|ezq=uE zCIeB!t4CqT;435|qQrnEO9WChO(jVoZF6#=fNO8|;SYp>R~QS};^K4D zuuQ`OaCL{}==omBDckDBj-Ge){Ib17nVs8zq^<)<7bo%P_rP?qoV5Yq@X+}Ej}MO@ z3<1!)ENj(k@ybNJGSMr|4JUHLU4@;^reV#O*nElkjWyfN>6xcC zfESbFqpE$eJ~vpqdFh0W2Y51g7Qg{OO{VGYt;e&MPj(uvL>4nJ za0`PlBg3pY5H=O_SKve#96}gV#iqlw;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 52d0199..57335b7 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 e95ca7b..7815f59 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 e987545..f40ed05 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 c77262c..c703e14 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");