From 355fffa2eca24163f035c93b2449b75bce88ef2d Mon Sep 17 00:00:00 2001 From: jp Date: Sun, 5 Jul 2015 01:38:12 +0200 Subject: [PATCH] Add Hive and Rust Bars --- crafts.lua | 19 +++++++++-- hive.lua | 56 +++++++++++++++++++++++++++++++++ init.lua | 1 + nodes.lua | 18 ++++++++++- textures/xdecor_hive_front.png | Bin 0 -> 479 bytes textures/xdecor_hive_side.png | Bin 0 -> 463 bytes textures/xdecor_hive_top.png | Bin 0 -> 375 bytes textures/xdecor_honey.png | Bin 0 -> 154 bytes textures/xdecor_ivy.png | Bin 242 -> 192 bytes textures/xdecor_rust_bars.png | Bin 0 -> 190 bytes 10 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 hive.lua create mode 100644 textures/xdecor_hive_front.png create mode 100644 textures/xdecor_hive_side.png create mode 100644 textures/xdecor_hive_top.png create mode 100644 textures/xdecor_honey.png create mode 100644 textures/xdecor_rust_bars.png diff --git a/crafts.lua b/crafts.lua index 7f2dca2..7215e30 100644 --- a/crafts.lua +++ b/crafts.lua @@ -134,11 +134,26 @@ minetest.register_craftitem("xdecor:hammer", { inventory_image = "xdecor_hammer.png" }) +minetest.register_craft({ + output = "xdecor:hive", + recipe = { + {"default:paper", "default:paper", "default:paper"}, + {"default:paper", "", "default:paper"}, + {"default:paper", "default:paper", "default:paper"} + } +}) + +minetest.register_craftitem("xdecor:honey", { + description = "Honey", + inventory_image = "xdecor_honey.png", + on_use = minetest.item_eat(2) +}) + minetest.register_craft({ output = "xdecor:ivy 2", recipe = { - {"group:leaves", "group:stick"}, - {"group:stick", "group:leaves"} + {"group:leaves"}, + {"group:leaves"} } }) diff --git a/hive.lua b/hive.lua new file mode 100644 index 0000000..265e264 --- /dev/null +++ b/hive.lua @@ -0,0 +1,56 @@ +local function hive_construct(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "size[8,5;]"..xdecor.fancy_gui.. + "label[1.5,0;Bees are making honey\nwith pollen around...]".. + "list[current_name;honey;5,0;1,1;]".. + "list[current_player;main;0,1.35;8,4;]") + meta:set_string("infotext", "Artificial Hive") + local inv = meta:get_inventory() + inv:set_size("honey", 1) +end + +local function hive_dig(pos, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if not inv:is_empty("honey") then + return false + end + return true +end + +xdecor.register("hive", { + description = "Artificial Hive", + tiles = { + "xdecor_hive_top.png", + "xdecor_hive_top.png", + "xdecor_hive_side.png", + "xdecor_hive_side.png", + "xdecor_hive_side.png", + "xdecor_hive_front.png", + }, + groups = {choppy=3, flammable=1}, + on_construct = hive_construct, + can_dig = hive_dig, + on_punch = function(pos, node, puncher, pointed_thing) + local health = puncher:get_hp() + puncher:set_hp(health-4) + end +}) + +minetest.register_abm({ + nodenames = {"xdecor:hive"}, + interval = 10, chance = 10, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + + local radius = 16 + local minp = {x=pos.x-radius, y=pos.y-radius, z=pos.z-radius} + local maxp = {x=pos.x+radius, y=pos.y+radius, z=pos.z+radius} + local flowers = minetest.find_nodes_in_area(minp, maxp, "group:flower") + + if #flowers >= 4 then + inv:add_item("honey", "xdecor:honey") + end + end +}) diff --git a/init.lua b/init.lua index 61250fd..0b3c285 100644 --- a/init.lua +++ b/init.lua @@ -4,6 +4,7 @@ modpath = minetest.get_modpath("xdecor") dofile(modpath.."/handlers/nodeboxes.lua") dofile(modpath.."/handlers/registration.lua") dofile(modpath.."/crafts.lua") +dofile(modpath.."/hive.lua") dofile(modpath.."/itemframes.lua") dofile(modpath.."/mailbox.lua") dofile(modpath.."/rope.lua") diff --git a/nodes.lua b/nodes.lua index e75b957..b3c0e26 100644 --- a/nodes.lua +++ b/nodes.lua @@ -318,7 +318,7 @@ for _, f in ipairs(flowerstype) do xdecor.register("potted_"..f, { description = "Potted Flowers ("..f..")", walkable = false, - groups = {dig_immediate=3, flammable=3, plant=1}, + groups = {dig_immediate=3, flammable=3, plant=1, flower=1}, tiles = {"xdecor_"..f.."_pot.png"}, inventory_image = "xdecor_"..f.."_pot.png", drawtype = "plantlike", @@ -380,6 +380,22 @@ xdecor.register("multishelf", { sounds = xdecor.wood }) +xpanes.register_pane("rust_bar", { + description = "Rust Bars", + tiles = {"xdecor_rust_bars.png"}, + drawtype = "airlike", + paramtype = "light", + sunlight_propagates = true, + textures = {"xdecor_rust_bars.png", "xdecor_rust_bars.png", + "xpanes_space.png"}, + inventory_image = "xdecor_rust_bars.png", + wield_image = "xdecor_rust_bars.png", + groups = {snappy=2, pane=1}, + recipe = { + {"xpanes:bar", "default:dirt"} + } +}) + xdecor.register("stereo", { description = "Stereo", groups = {snappy=2}, diff --git a/textures/xdecor_hive_front.png b/textures/xdecor_hive_front.png new file mode 100644 index 0000000000000000000000000000000000000000..6d0af3b9543a5dba323fa1185580707b226b2338 GIT binary patch literal 479 zcmV<50U-W~P)a)S zOrw@eqLfPE)_&vHeB94=*T`$x%W2ohWxlXgrJ7N(ph4x@f!@-2*~@d=&2G)RRL8hf z$hA<#vrfsjO~$iJosdbjrA35!HKdU<+|G2-#A?>ZXSu3T%D7Oys!3i~E!4zj$F^O; zvs8q9Lb;|vm5M>CnLx6fJ&%Gtd~PzGi7{qgFe@G%p#T5?-AP12R2b6@&Q-3%FaSi+ zF@)_fHH=Nulpo{%msM+|`8>KPuV*(oWgSh8q&xd1*4ng)ZJV$i%kt_K+sDkpNx$ni zHnIEnhTlL2T<}Y3XK}mKv^hGLo$HQLk4gCpKOkJGaKK`Ux^P V6Jme#NoN26002ovPDHLkV1hJNz+uwEWzxZ6&b?vAvrM6sO5xUi+|PE~&2HDo zYuU?b)y8Mn$Ysj8UcRtZsh(A#l}*8{NwJ?m<=TPc*L>N_bHKA$&AU{`xKyN>QN*xJ zqnAs-tV*4bNwuX#gn2cjku%)RbkW3W$hcd=wpz-#P^Xfg4#{d8T*-1n}R2b70&R4F3FcbvPv5oB*Oik!LK!Ehu z%l;P@qbuE!=HqCPzFmla4jNKhesgJ4%%!cUu{c<^D#dErI#-HVizf5E@ zm!6O!7rD3KMhLO2s;Nxu2x;*S4I0w}=$<06uh@qXB83DL)J{|kK1_@o*S))pxgCSd zJTZqECY;e1&`^WNo z@{XPq=1Xz>UeKl_2zJESXUh-L8_M}ZN7TVpJCW*tK3^E_5o9g%e8vC(002ovPDHLk FV1l#c<9Gl7 literal 0 HcmV?d00001 diff --git a/textures/xdecor_hive_top.png b/textures/xdecor_hive_top.png new file mode 100644 index 0000000000000000000000000000000000000000..14365ddee8009e582726492cb66ae522da74159b GIT binary patch literal 375 zcmV--0f_#IP)Bub<@LS%(_#^wM)vmUbCZ2v7koZ(stI! zYs$Az#vnG>9P^%TiJ?_(sy$vD1wl_R>kIOqI1(gJJh+9lD>>>>%Ip{PAF;$I+4;-|iJV{hm{Wh!Qe(-=_2L_xxBm4#V#=i?NwSMTy5C#-)l8ZO81A99y>s z$72Y@bi0nWhiso(kJJ75q42w5Ua6Vx$)K(LkhHJvuKh(h880;{R0`m V3wJK-Tj>A*002ovPDHLkV1h=it(gD- literal 0 HcmV?d00001 diff --git a/textures/xdecor_honey.png b/textures/xdecor_honey.png new file mode 100644 index 0000000000000000000000000000000000000000..6d4dd04156bed445008a8e858befc3b23e415ac5 GIT binary patch literal 154 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ1=4F5dpy2TuxPq%X{J(s zlI)wuZLH2KJb)66B|(0{3=Yq3qyag`o-U3d9M_W-ggC4mGSXC?g$mdKI;Vst080KX<^TWy literal 0 HcmV?d00001 diff --git a/textures/xdecor_ivy.png b/textures/xdecor_ivy.png index 65c65f9ebfdc8e3b4009876faa6ab52ff0fad0ff..d540e1839b57d439a034d38c563590f19cff7b87 100644 GIT binary patch delta 164 zcmeywcz|(&O1(sYPlzi61A}{`gI%VDdAwo5{0QF;H&su?kcmDkj?GjB$}yG%`2{mL zJiCzwyDG%;&<5tIUPhED4ZKB!_ QfmSehy85}Sb4q9e03K#DH2?qr delta 214 zcmX@W_=$0XO1*A?Plzi61A||^s$;QeRTA@re9`6{KFb`Q&UBvSNp_Q}Bz2P*rj$v} zuU76W6Nye@JR!drq=B&{$S;_|;n|HeAg9>V#W95AdNKnev%o}_BTvsbI0ZC1cF3x1 z@#+ZdRAe~uKqw{T0S|-r)`SNsY!{u5@q|lAut-Q;^^dUOc8HP?o*{2w;H6<;U?^eC zX~@+mVrigaq}eEOj;AZ(?HL{R2$_RHJQt7k^d_);Ndem=~X1xhfM1o;IsI6S+N2IPc$x;Tb#TzBp1gY1^du9dEr>%*4q*z-_h`U(p}Cr-_>8MA$NFE={m i{P|gD;mjLbEbX6f=c-@7xabMc3I