From 6062c3f5e0a4670d2164a4264756fe525fb7b40f Mon Sep 17 00:00:00 2001 From: jp Date: Thu, 3 Dec 2015 12:45:35 +0100 Subject: [PATCH] Random painting on placing --- crafts.lua | 2 +- nodes.lua | 30 +++++++++++++++++++++++++----- textures/xdecor_painting.png | Bin 252 -> 0 bytes textures/xdecor_painting_1.png | Bin 0 -> 246 bytes textures/xdecor_painting_2.png | Bin 0 -> 409 bytes textures/xdecor_painting_3.png | Bin 0 -> 437 bytes textures/xdecor_painting_4.png | Bin 0 -> 409 bytes 7 files changed, 26 insertions(+), 6 deletions(-) delete mode 100644 textures/xdecor_painting.png create mode 100644 textures/xdecor_painting_1.png create mode 100644 textures/xdecor_painting_2.png create mode 100644 textures/xdecor_painting_3.png create mode 100644 textures/xdecor_painting_4.png diff --git a/crafts.lua b/crafts.lua index a540a30..a5e0e9f 100644 --- a/crafts.lua +++ b/crafts.lua @@ -251,7 +251,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "xdecor:painting", + output = "xdecor:painting_1", recipe = { {"default:sign_wall", "dye:blue"} } diff --git a/nodes.lua b/nodes.lua index 8cda504..1637e9e 100644 --- a/nodes.lua +++ b/nodes.lua @@ -483,20 +483,40 @@ for _, f in pairs(flowers) do }) end -xdecor.register("painting", { +xdecor.register("painting_1", { description = "Painting", drawtype = "signlike", - tiles = {"xdecor_painting.png"}, - inventory_image = "xdecor_painting.png", + tiles = {"xdecor_painting_1.png"}, + inventory_image = "xdecor_painting_1.png", paramtype2 = "wallmounted", legacy_wallmounted = true, walkable = false, on_rotate = screwdriver.rotate_simple, - wield_image = "xdecor_painting.png", + wield_image = "xdecor_painting_1.png", selection_box = {type="wallmounted"}, - groups = {dig_immediate=3, flammable=3, attached_node=1} + groups = {dig_immediate=3, flammable=3, attached_node=1}, + after_place_node = function(pos, _, _, _) + local node = minetest.get_node(pos) + minetest.set_node(pos, {name = "xdecor:painting_"..math.random(1,4), param2 = node.param2}) + end }) +minetest.register_alias("xdecor:painting", "xdecor:painting_1") + +for i = 2, 4 do + xdecor.register("painting_"..i, { + drawtype = "signlike", + tiles = {"xdecor_painting_"..i..".png"}, + paramtype2 = "wallmounted", + legacy_wallmounted = true, + walkable = false, + on_rotate = screwdriver.rotate_simple, + drop = "xdecor:painting_1", + selection_box = {type="wallmounted"}, + groups = {dig_immediate=3, flammable=3, attached_node=1, not_in_creative_inventory=1} + }) +end + for _, b in pairs({{"cactus", "cactus"}, {"moon", "stone"}}) do xdecor.register(b[1].."brick", { drawtype = "normal", diff --git a/textures/xdecor_painting.png b/textures/xdecor_painting.png deleted file mode 100644 index ebbdc9b97cac07f05f0719b0dd2978de115c706f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Wq?nJE09i}aeQHhW88#2whh*G zVdfS7hRxB|tBQT6C)*VJt7bT>Y}l}2(fs+AW#%OwT00xVf4|-oYbSfA_2C7eX2y~r zzhDN3XE)M-oI+0*#}J9jt-XPKhZT67!<~aXu3dWjuYIoVGS9y&elaZE6LIo!*YmP< z=BtA1PjOCIt1ML|b5`ZfnY-bSwD&Fg^HJ}kUaF%0KA)}+n_j$#3Re2Qs>O%x=!U(1 x!K-Dxc)H|^HKxyc5Otl0c@gs;1Bb%X?9&b~OPAWdH3M4C;OXk;vd$@?2>`3CVWt28 diff --git a/textures/xdecor_painting_1.png b/textures/xdecor_painting_1.png new file mode 100644 index 0000000000000000000000000000000000000000..424fbd938a14c81c99336409ffe81a6d17102a0f GIT binary patch literal 246 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!S%6Q7E09i}al9eIVqu13+=M;0 z4b~O@hO3HwrzhJK`>SR+t8Cb?VbT2gmSyH89$Gsa!+*ct6l*6NCUaW~sFSfI$S;_| z;n|HeASch$#W6(Ua%)dC-ys7YmX~>tjx6(i_-}e@uV9e9z~uI)A5U$MzwRbbmXV)|H+;yW)kb$BwPK{&77%M=lyqREtS^_#(CH_{>h# qj|-VED8V(1=Hx=)Y;P2!iv(s zfY-cwxq(+RTPZG24+R?x0uc(`_43#3?B49=)8yXD=G)Qa+12CK$luV%*2&M>x7)^< z*2a+6$b{CyfxxYIeW7rFh*W8JEJ#}{EKMvdcOhLq9Y$3fkWLgKL=+D!6l{MFHgFG5 zN)IeR4-`2MnKlK9Ck2o>0TP~Y82|tP0d!JMQvg8b*k%9#0G3HaK~xyig^fiL!$1rK zBgqSnnH^?khW|e-+W6!{Dt%F@rJ8B{qUqFkhgI!f$qE21Bq#w=r2>s0L?W^nvfwMi zFz5%vQI@Sp8nL(Sb+@-YEguK1StuIVomP8uzn%*e=0iu*NwOGUa=*}ug^RN|^1RzI z_jj0@4|g6X@7L2S{jv(>QZ#TanG6I_5`YJ|z~V0-IdKTmoof=%00000NkvXXu0mjf DO5~?d literal 0 HcmV?d00001 diff --git a/textures/xdecor_painting_3.png b/textures/xdecor_painting_3.png new file mode 100644 index 0000000000000000000000000000000000000000..a21e9a5435dc0ab218ea5362f8692fae148e42f6 GIT binary patch literal 437 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbMfv;dzF*E`paFU)YP3p20qH(Xuf z+Z=5@J=vz%Up2#7<=nBo8#ZiMG=Kj30{0ku-4YM2YuB!wJ9qBdxxMGk?Y*{l@41~j z&mG%(Z0p)pt5$AZyL8v4g*zL=XBN3k@UsgxGYeJMjJK9KckI~iU3-u11u9#*cFxk4 zwzlS~rn_!@hljQC0!qCAg>jC6&7I;J!Gca%qgD@k*tT_@uLG}_)Usv|~Jj~n%!s|osRRV=( zc)B=-NL+61Jt@{?z~ef5Nr^+3k+PA+d5wSn&)-}mEhhI~?fKm&dknrY*PER+`!)G* zcprm?ove(3cmX#VrO@OD2u-F9l5U`G`IR+OuRqowF84D!mdKI;Vst08V$YNB{r; literal 0 HcmV?d00001 diff --git a/textures/xdecor_painting_4.png b/textures/xdecor_painting_4.png new file mode 100644 index 0000000000000000000000000000000000000000..855b9501fce7f55e1b76bd64b8d14316ce413208 GIT binary patch literal 409 zcmV;K0cQS*P)?tWNm5-t9ZUQV{{R300d!JMQvg8b*k%9#0G3HaK~xyig^fiL0znK# zNkR+bF1Wip-2Y&tnbj;P-X@io)c=iNw4D0xu&UiFSplGh1SLSKQlJrpNJLGBn(!5t zz09)P*|KtyM!Y-z#9v(UG(Bm}LeXZsi=w_a9C;|rhqmqKzS|CZ!AdI@E+*5*@imWU zafqe)aFg+Uus&RiBCJBW6b)QUCIbPK1mFQKu=vXdG-(LkFyut%00000NkvXXu0mjf DA;`A8 literal 0 HcmV?d00001