This commit is contained in:
Menche 2014-02-14 16:11:57 -08:00 committed by darkrose
parent da4dc1187d
commit f0277415a1
11 changed files with 100 additions and 22 deletions

BIN
data/textures/book_back.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

BIN
data/textures/book_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

BIN
data/textures/book_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

View File

@ -59,14 +59,6 @@ void content_craftitem_init()
f->description = "Paper";
crafting::setRow1Recipe(CONTENT_PAPYRUS,CONTENT_CRAFTITEM_PAPER);
i = CONTENT_CRAFTITEM_BOOK;
f = &g_content_craftitem_features[i];
f->content = CONTENT_CRAFTITEM_BOOK;
f->texture = "book.png";
f->name = "book";
f->description = "Book";
crafting::setCol1Recipe(CONTENT_CRAFTITEM_PAPER,CONTENT_CRAFTITEM_BOOK);
i = CONTENT_CRAFTITEM_CHARCOAL;
f = &g_content_craftitem_features[i];
f->content = CONTENT_CRAFTITEM_CHARCOAL;

View File

@ -38,7 +38,6 @@ CraftItemFeatures & content_craftitem_features(content_t i);
CraftItemFeatures & content_craftitem_features(std::string subname);
#define CONTENT_CRAFTITEM_PAPER (CONTENT_CRAFTITEM_MASK | 0x01)
#define CONTENT_CRAFTITEM_BOOK (CONTENT_CRAFTITEM_MASK | 0x02)
#define CONTENT_CRAFTITEM_CHARCOAL (CONTENT_CRAFTITEM_MASK | 0x03)
#define CONTENT_CRAFTITEM_COAL (CONTENT_CRAFTITEM_MASK | 0x04)
#define CONTENT_CRAFTITEM_IRON (CONTENT_CRAFTITEM_MASK | 0x05)

View File

@ -771,6 +771,56 @@ static void content_mapnode_nodebox_guide(ContentFeatures *f)
));
}
static void content_mapnode_nodebox_book(ContentFeatures *f)
{
// lower cover
f->setNodeBox(core::aabbox3d<f32>(
0,
-0.5*BS,
// -6 / 16
-0.375*BS,
// 7 / 16
0.4375*BS,
// -7 / 16
-0.4375*BS,
// 3 / 16
0.1875*BS
));
// pages
f->addNodeBox(core::aabbox3d<f32>(
0,
// -7 / 16
-0.4375*BS,
// -6 / 16
-0.375*BS,
// 6 / 16
0.375*BS,
// -5 / 16
-0.3125*BS,
// 3 / 16
0.1875*BS
));
// top cover
f->addNodeBox(core::aabbox3d<f32>(
0,
// -5 / 16
-0.3125*BS,
// -6 / 16
-0.375*BS,
// 7 / 16
0.4375*BS,
// -4 / 16
-0.25*BS,
// 3 / 16
0.1875*BS
));
}
/*
A conversion table for backwards compatibility.
Maps <=v19 content types to current ones.
@ -1933,7 +1983,7 @@ void content_mapnode_init()
{
u16 r[9] = {
CONTENT_WOOD, CONTENT_WOOD, CONTENT_WOOD,
CONTENT_CRAFTITEM_BOOK, CONTENT_CRAFTITEM_BOOK, CONTENT_CRAFTITEM_BOOK,
CONTENT_BOOK, CONTENT_BOOK, CONTENT_BOOK,
CONTENT_WOOD, CONTENT_WOOD, CONTENT_WOOD
};
crafting::setRecipe(r,CONTENT_BOOKSHELF,1);
@ -1941,7 +1991,7 @@ void content_mapnode_init()
{
u16 r[9] = {
CONTENT_JUNGLEWOOD, CONTENT_JUNGLEWOOD, CONTENT_JUNGLEWOOD,
CONTENT_CRAFTITEM_BOOK, CONTENT_CRAFTITEM_BOOK, CONTENT_CRAFTITEM_BOOK,
CONTENT_BOOK, CONTENT_BOOK, CONTENT_BOOK,
CONTENT_JUNGLEWOOD, CONTENT_JUNGLEWOOD, CONTENT_JUNGLEWOOD
};
crafting::setRecipe(r,CONTENT_BOOKSHELF,1);
@ -3441,6 +3491,30 @@ void content_mapnode_init()
f->type = CMT_DIRT;
f->hardness = 0.3;
i = CONTENT_BOOK;
f = &content_features(i);
f->description = std::string("Book");
f->setTexture(0, "book_top.png");
f->setTexture(1, "book_bottom.png");
f->setTexture(2, "book_side.png");
f->setTexture(3, "book_binding.png");
f->setTexture(4, "book_back.png");
f->setTexture(5, "book_front.png");
f->param_type = CPT_LIGHT;
f->param2_type = CPT_FACEDIR_SIMPLE;
f->draw_type = CDT_NODEBOX;
f->rotate_tile_with_nodebox = true;
f->light_propagates = true;
f->air_equivalent = true;
f->flammable = 1;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->solidness = 0;
content_mapnode_nodebox_book(f);
f->setInventoryTextureNodeBox(i, "book_top.png", "book_front.png", "book_side.png");
f->type = CMT_DIRT;
f->hardness = 1.0;
crafting::setCol1Recipe(CONTENT_CRAFTITEM_PAPER,i);
i = CONTENT_CRAFT_GUIDE;
f = &content_features(i);
f->description = std::string("Craft Guide");
@ -3454,8 +3528,9 @@ void content_mapnode_init()
f->draw_type = CDT_NODEBOX;
f->rotate_tile_with_nodebox = true;
f->light_propagates = true;
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->air_equivalent = true;
f->flammable = 1;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BOOK)+" 1";
f->solidness = 0;
content_mapnode_nodebox_guide(f);
f->setInventoryTextureNodeBox(i, "craft_guide_top.png", "craft_guide_end.png", "craft_guide_side.png");
@ -3463,14 +3538,6 @@ void content_mapnode_init()
f->hardness = 1.0;
if (f->initial_metadata == NULL)
f->initial_metadata = new CraftGuideNodeMetadata();
{
content_t r[9] = {
CONTENT_CRAFTITEM_STICK, CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE,
CONTENT_IGNORE, CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE,
CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE, CONTENT_IGNORE
};
crafting::setRecipe(r,CONTENT_CRAFT_GUIDE,1);
}
i = CONTENT_COTTON;
f = &content_features(i);

View File

@ -250,8 +250,9 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_FARM_COTTON_2 0x94D
#define CONTENT_FARM_COTTON_3 0x94E
#define CONTENT_FARM_COTTON 0x94F
// FREE 950-9FE
// FREE 950-9FD
//bwahaha!
#define CONTENT_BOOK 0x9FE
#define CONTENT_CRAFT_GUIDE 0x9FF
// slabs

View File

@ -2488,6 +2488,25 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
continue;
client->SetBlocksNotSent(modified_blocks);
}
}else if (n.getContent() == CONTENT_BOOK || n.getContent() == CONTENT_CRAFT_GUIDE) {
n.setContent((n.getContent() == CONTENT_BOOK) ? (CONTENT_CRAFT_GUIDE) : (CONTENT_BOOK));
core::list<u16> far_players;
sendAddNode(p_under, n, 0, &far_players, 30);
core::map<v3s16, MapBlock*> modified_blocks;
{
MapEditEventIgnorer ign(&m_ignore_map_edit_events);
std::string p_name = std::string(player->getName());
m_env.getMap().addNodeAndUpdate(p_under, n, modified_blocks, p_name);
}
for(core::list<u16>::Iterator i = far_players.begin(); i != far_players.end(); i++) {
u16 peer_id = *i;
RemoteClient *client = getClient(peer_id);
if (client == NULL)
continue;
client->SetBlocksNotSent(modified_blocks);
}
}else if (content_features(n).flammable > 1) {
InventoryItem *wield = (InventoryItem*)player->getWieldItem();
if (wield && wield->getContent() == CONTENT_TOOLITEM_FIRESTARTER) {