From c9c3820ed4746a23e5456ed0d50c0830a2cd0ef5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 12 Jan 2017 04:37:36 +0100 Subject: [PATCH] Add lily pad --- mods/flowers/init.lua | 55 ++++++++++++++++++ mods/flowers/textures/flowers_waterlily.png | Bin 300 -> 520 bytes .../textures/flowers_waterlily_22.5.png | Bin 425 -> 0 bytes .../flowers/textures/flowers_waterlily_45.png | Bin 442 -> 0 bytes .../textures/flowers_waterlily_67.5.png | Bin 429 -> 0 bytes 5 files changed, 55 insertions(+) delete mode 100644 mods/flowers/textures/flowers_waterlily_22.5.png delete mode 100644 mods/flowers/textures/flowers_waterlily_45.png delete mode 100644 mods/flowers/textures/flowers_waterlily_67.5.png diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index 5726f28512..75f05138f1 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -331,6 +331,61 @@ minetest.register_node("flowers:pot",{ end, }) +-- Lily Pad +minetest.register_node("flowers:waterlily", { + description = "Lily Pad", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"flowers_waterlily.png", "flowers_waterlily.png"}, + inventory_image = "flowers_waterlily.png", + wield_image = "flowers_waterlily.png", + liquids_pointable = true, + walkable = true, + sunlight_propagates = true, + groups = {dig_immediate = 3, dig_by_water = 1, }, + sounds = default.node_sound_leaves_defaults(), + node_placement_prediction = "", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -15 / 32, 0.5} + }, + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, -15 / 32, 7 / 16} + }, + + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.above + local node = minetest.get_node(pointed_thing.under).name + local def = minetest.registered_nodes[node] + local node_above = minetest.get_node(pointed_thing.above).name + local def_above = minetest.registered_nodes[node_above] + local player_name = placer:get_player_name() + + if def and + pointed_thing.under.x == pointed_thing.above.x and + pointed_thing.under.z == pointed_thing.above.z then + if ((def.liquidtype == "source" and minetest.get_item_group(node, "water") > 0) or + (node == "default:ice") or + (minetest.get_item_group(node, "frosted_ice") > 0)) and + (def_above.buildable_to and minetest.get_item_group(node_above, "liquid") == 0) then + if not minetest.is_protected(pos, player_name) then + minetest.set_node(pos, {name = "flowers:waterlily", + param2 = math.random(0, 3)}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + else + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos, player_name) + end + end + end + + return itemstack + end +}) local time_to_load= os.clock() - init print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load)) diff --git a/mods/flowers/textures/flowers_waterlily.png b/mods/flowers/textures/flowers_waterlily.png index 0ff66a322a5f136e676879578c80314d7ad9dc3c..491ebfdcc936e0429284b9312dd927f37412955b 100644 GIT binary patch literal 520 zcmV+j0{8uiP)Px#24YJ`L;(K)0000pCw%h&000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2jKw> z0~Ht0S}6qp00D?eL_t(o!`)ZGYQr!LwT=b55*zlvw#_j*)52vrM+La!GqhQD9o*wx{Elv!NII zGNMjHdm)6lpRcGr3cx$FLm!td0|K%)y8{YBl?JCyYHx>LY){9CmTD0~4%5=B+hcwg znAW(l(N)<``wgoKtO}^xBl=Q@9x#@5E*VV)4o{dB_7BG{TLI5y7<}4qSWdl7t`cLT zf6<^RXIM$iHw|N>qyM-9oZSUcbzUYAJOsk*4)p-I9CLM`N<^4*3}v<$1r(oDrqutc zM%C0s#i2`axWtr=WyrcWxLmPCRnUSU0NYu4KVMlvAn{=>2tCVx)`nHDVQpJhy#<~I zeHp>vT<4)3HWi^22szF@NKjQ4c?-N4OK-VUBeQ416a)tdlsPpOlY4>ftb9&B!OWN5 zf~iKlhN}01+`{1p(2v)*9}w?Klq@jC0CHeTgDwK#-z=xA1Na1S2@`(hrxZB=0000< KMNUMnLSTZUNzV`f literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}PJmB{E0EU9X3)=NFe+j&&Sx+# zVzBLEaGc2CIGMo-h^8<&SMs?`XKhYCS0JsE!Jw1LpbJD<40_oN zdN~Ywc?|kF4EnhY20&E6V3^NfSjb>l#9&;;U{cCpTESpe$zWE+U{=jwR>NRk!(i3S zVBOAO14JDRwp|Q%-3)fU4ECj*4igw0CNVfpWN@6s;53E7c`AeRGzOP4A(!b4E;ATh zCo#CrWN@9$;5L`R9f;;JxX)+sXchFB&){7x?LC9ldjXU0Lgt_)Y{5O!9s9jH_gYRq zOARgUESsSGl zKi(Bsum6x_QLLn>_p$cBgH!UHMIC+DFYn?%nWQMldF#@#vre08glbIqS{EE>OEH`u zs{K<>-7aLJ##UbjzU3Rz6aqIWPG!I7;@)-h%@xxn8hd5-z5MZ(Gi?iBZD7W6AE4tH NJYD@<);T3K0RU8Pmhb=o diff --git a/mods/flowers/textures/flowers_waterlily_45.png b/mods/flowers/textures/flowers_waterlily_45.png deleted file mode 100644 index cf16b65a5f436fdea6bcfa853aff3a5bcd584514..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbMfjR2nzS0JsE!Jw1LpbJD<47%A2 zdN~aGSq%EQ4ElKt2DuCdK(c_rppe0+h{3po!MK#cxQxN1kjbQs!L)+Gtct-Lh-w+k z>lrK>87zUQiNUg&!3v047_3_uY}y!X+8OM78SMKQoF+3kPiJtR!Qe8T!L@_6;6#cY0&Gk#S_y{fZ zI4cq1=6tCA&Zf?dUz6mT{j;oGj+igMEx7O0gcgN;`}e)Gu9%{;dHEsLy1E!Qe}<2F z7j>ThdRJDuLG8neOx6ZHi}^DvS-g@R{bUs{$64h{HfA(N%1SD(T^_Dl6DZ78SHWCY W!LRo#-W-=H_`sNdb^tM5IZ{owJO2QL;sf3fVvi?$TA$Vi}n7)yfuf*Bm1-ADs+`aNA7 zLnOkJ6BPJ17_d6Jrx=)mOT;}Pe`%CNzN&u2yUFF~Nw O7(8A5T-G@yGywojI*dgC