dirtlike dig drops

This commit is contained in:
darkrose 2016-01-06 21:34:07 +10:00
parent a568a306c2
commit 56b57ba594
8 changed files with 42 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
data/textures/salt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

View File

@ -1556,4 +1556,12 @@ void content_craftitem_init()
f->name = "lump_of_sunstone";
f->description = wgettext("Sunstone");
lists::add("creative",i);
i = CONTENT_CRAFTITEM_SALT;
f = &g_content_craftitem_features[i];
f->content = i;
f->texture = "salt.png";
f->name = "salt_dust";
f->description = wgettext("Salt");
lists::add("creative",i);
}

View File

@ -234,5 +234,6 @@ CraftItemFeatures & content_craftitem_features(std::string subname);
#define CONTENT_CRAFTITEM_AMETHYST (CONTENT_CRAFTITEM_MASK | 0x84)
#define CONTENT_CRAFTITEM_SAPPHIRE (CONTENT_CRAFTITEM_MASK | 0x85)
#define CONTENT_CRAFTITEM_SUNSTONE (CONTENT_CRAFTITEM_MASK | 0x86)
#define CONTENT_CRAFTITEM_SALT (CONTENT_CRAFTITEM_MASK | 0x87)
#endif

View File

@ -1178,8 +1178,10 @@ void meshgen_dirtlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &sel
case 0:
default:;
}
if (effect == 1)
if ((effect&0x01) == 0x01)
tex += "^footsteps.png";
if ((effect&0x02) == 0x02)
tex += "^mineral_salt.png";
toptile.texture = g_texturesource->getTexture(tex);
}

View File

@ -183,4 +183,12 @@ void init_mineral()
f->dug_item = CONTENT_CRAFTITEM_SUNSTONE;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_SALT;
f = &mineral_features(i);
f->description = wgettext("Salt");
f->texture = "mineral_salt.png";
f->dug_item = CONTENT_CRAFTITEM_SALT;
f->min_level = 1;
f->dug_count_max = 2;
}

View File

@ -43,6 +43,7 @@
#define MINERAL_AMETHYST 11
#define MINERAL_SAPPHIRE 12
#define MINERAL_SUNSTONE 13
#define MINERAL_SALT 14
struct MineralFeatures {
std::wstring description;

View File

@ -3328,7 +3328,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
std::string &dug_s = selected_node_features.dug_item;
if (wielded_tool_features.type != TT_NONE && enchantment_have(wielditem->getData(),ENCHANTMENT_DONTBREAK)) {
u16 data = 0;
if (selected_node_features.param_type == CPT_MINERAL)
if (selected_node_features.param_type == CPT_MINERAL || selected_node_features.param_type == CPT_BLOCKDATA)
data = selected_node.param1;
item = InventoryItem::create(selected_content,1,0,data);
}else if (
@ -3341,6 +3341,26 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
}else if (dug_s != "") {
std::istringstream is(dug_s, std::ios::binary);
item = InventoryItem::deSerialize(is);
if (selected_node_features.draw_type == CDT_DIRTLIKE) {
content_t extra = CONTENT_IGNORE;
switch (selected_node.param1&0x0F) {
case 0x01:
case 0x02:
extra = CONTENT_WILDGRASS_SHORT;
break;
case 0x04:
extra = CONTENT_CRAFTITEM_SNOW_BALL;
break;
default:;
}
if (extra == CONTENT_IGNORE) {
if ((selected_node.param1&0x20) == 0x20)
mineral = MINERAL_SALT;
}else if (myrand_range(0,5) == 0) {
InventoryItem *eitem = InventoryItem::create(extra,1,0);
player->inventory.addItem("main", eitem);
}
}
}else if (selected_node_features.param2_type == CPT_PLANTGROWTH) {
if (selected_node_features.draw_type == CDT_PLANTLIKE) {
if (p2 && p2 < 8) {