From 56b57ba5949410b023b57f1cdefd7b9f6e7ccc69 Mon Sep 17 00:00:00 2001 From: darkrose Date: Wed, 6 Jan 2016 21:34:07 +1000 Subject: [PATCH] dirtlike dig drops --- data/textures/mineral_salt.png | Bin 0 -> 2148 bytes data/textures/salt.png | Bin 0 -> 998 bytes src/content_craftitem.cpp | 8 ++++++++ src/content_craftitem.h | 1 + src/content_mapblock.cpp | 4 +++- src/mineral.cpp | 8 ++++++++ src/mineral.h | 1 + src/server.cpp | 22 +++++++++++++++++++++- 8 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 data/textures/mineral_salt.png create mode 100644 data/textures/salt.png diff --git a/data/textures/mineral_salt.png b/data/textures/mineral_salt.png new file mode 100644 index 0000000000000000000000000000000000000000..0209c1e37a2c957880a8c97ee034af5aa1ccd129 GIT binary patch literal 2148 zcmV-q2%GnbP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^Rb0R{^X6V2##z5oCR_DMuRR9M4Z zm&D0SJ2uXS{{RUoLPDA-3#)sB z5?Dl8W*wGUkch2Pt_f~x@>M?C@tJKw9r|vzk@0{;Y zNZOYpQAQ!lTq&0~!1Ezd1{04&8AG5_N+C<7T8T0eWz6L$RI#U2i84OYF~8Pb=5p*Q zBb8Gkr%D++lV;E6y_8`DW?zn&W(^VF+zbF1@57A`Q(Yu54##+FOt-E*R|D{?>nQ<4 zz>rW90(0O3p+33&iMf2`3TMCy79p0lmMCr%%rV3uAwwbCYjmI)YwK{J83&r-YPA+; zu<0=bb|w>6V@Q=#$dbzGGo9%pInGq7P(`7NR8D(xe5#XkR-ehSC&yjQxv6`YLKXmr z13-wUua5Y5+atN2u(%>#1)$_7R16T1Vi^%&I+<#K22xIKJS;T<9=5gG#{&d-Kv)bg zXL5L0A|MCe1GUNYtv8WAO2*Faj80Orwk#0woY14fxM$!X*X(JoQ4%tv6Ew z0xYIg(^E-hh9C>Z>omXHdf*uzA>0ZHd5wrynNDMJN&s$SsKM-$o6pFx2oDR02v47{ zraaP`BE+4yn!UrVkQj?afEZ$+HNeX$1n?zdgoqH=R5P8v1iT1L@EHSvE&wr}9wFjU z!ag(=DFwM%#c&sh2r(1@#29v-tMPvKDlzX-QJNA_qUPl$$x;$!R7zRfZsOws!w5o} zggcW%wxW>5)#7~}!jFGMq9YO=vk1#X8TXX2wtXJTYwIvq$`?wtuUz+(VNT^RzyKty z5#sxsBi`OU!e^;ZP9Oi={a-oZNtQSUKF2bo;;R^7tN}9M;V93&*JM*b4f4Q1iRa_^ z#nh*!G(J9J$lJRaHOsug9S&Mo`8b3aKQSgH^IFdI`1e zodXd*f%Ztu*LX-dl>s=V&@y2QS6FJj>2Q2Xz!iiC-=V*_-)r$UxOmTMbODZ^ReskJJOUt&6qFuaTbMug_;JWLLRw_nG{ z=M*qlER{+MV<@B}<_USBnG9+8A5@qGSH4GkD{NTz(wb^w^m+v3@9O zC?1<$FJHBup^_zSSxdu;Qo6(W$4-CfnH>6J-Zz_0zES!?vL(vcnN0cy_8aYy=$K&y zM+@v|ZM_MTsgyFHnT z%Y^0tp_U~*bu}j3YWTr@G6D=KwMkoA=7IiA!N(k%s8jYMxbrt--s{r;!E%{9&5j>>8GJY8J9QUrtVS5vbPY9 zE+k!P-kD7LW;2)LP=!=heR#TLb!|bLwR2;#FdrT&(|tM2T zs3=KK(}ukU@$yHz@IoZ1R)D! zcH?TRS`8d6!>A3<<4x!6TzPHMWVGkQ&-6ETCXGs6815=1(J_^BQssQ1RG;XOy@fpz aW&960Wh_2XLvzgl0000znC literal 0 HcmV?d00001 diff --git a/data/textures/salt.png b/data/textures/salt.png new file mode 100644 index 0000000000000000000000000000000000000000..9a8c0a348a2d2678dabc04c6f9d0c228858e5b4d GIT binary patch literal 998 zcmVPx#32;bRa{vGf6951U69E94oEQKA00(qQO+^Rb0R{^dH$ld0v;Y7A9cffpbVF}# zZDnqB0000007G(RVRU6=Aa`kWXdp*PO;BVmWd{HN15ZgrK~z}7?UqfBl|>YWpZc%c z_jc2Q_^-i%QzK!Zi7Rl}i*O5u#2`i!aStwnrMLhRNeltv1=`!)_f~!NcN}zjAOxC5 z)JeaysydaN^Hja33eI(|bDis4|FhItf`8E(fX5=-5#h;G>$hJa0ejXBU-Xsa)gfPX z$fGi*#(c5G&E0p^zeeDs@-NFumg#`qFo)it4azzZoF^OM*6w@itR(cy23|``Nu#h6 zW|Ur;`H0dQ<^km_QCq%S-jml#;H2`aWhvSi^fV9+W2#J}ad9^1C}p-|BuU4VK`xn} z-u&>TNt{aH>gs_QXDJB~7Slq9FJVIygpjpcDncmP*tH5se0JY+qKVx#YPnxK$g9YaKHLC4*oc zeRK$pIywvOu->tfiWSW&CoZ_ilrrBh@5%6nk|utB=ZZR&z)9twZwXBHz(22wl4YRqDb=seMTu0OmhFFbX=Ngt zL9PYcK?|gVL(s6}B6!2PBrZLbz~4rDPvN<_e_u@LG^1#(VVuWl4bH+;Kq-uOI>ouYjJ1)@8u`x=iXsr;y zq8JLs7!(FG8}PuYWTJKa_|`}2_E}r;-gD+}Jh~^0L2C_<=16sReWXr>rWMv&YH!?n z`^u?}=#`$(J>Z*%zscNqTnub_rHdf7p{-`t6*n$_pl-kJ56Nj{cnu$vbN%P~3k0IE UQ1}|QZvX%Q07*qoM6N<$g0&vO$p8QV literal 0 HcmV?d00001 diff --git a/src/content_craftitem.cpp b/src/content_craftitem.cpp index b51f740..123860f 100644 --- a/src/content_craftitem.cpp +++ b/src/content_craftitem.cpp @@ -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); } diff --git a/src/content_craftitem.h b/src/content_craftitem.h index 2a999b0..e3fe5a8 100644 --- a/src/content_craftitem.h +++ b/src/content_craftitem.h @@ -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 diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index d1905d7..01330eb 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -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); } diff --git a/src/mineral.cpp b/src/mineral.cpp index 360017f..8b50234 100644 --- a/src/mineral.cpp +++ b/src/mineral.cpp @@ -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; } diff --git a/src/mineral.h b/src/mineral.h index 1cdf199..b2d0cbd 100644 --- a/src/mineral.h +++ b/src/mineral.h @@ -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; diff --git a/src/server.cpp b/src/server.cpp index 95c5fdf..717f4a7 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -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) {