From d42f38484009bf45106b4574465fd7ed7826f75b Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Thu, 26 Jun 2014 00:28:21 -0400 Subject: [PATCH] add cardboard box with small inventory --- homedecor/misc_nodes.lua | 67 ++++++++++++++++++ .../textures/homedecor_cardboard_box.png | Bin 0 -> 573 bytes .../homedecor_cardboard_box_sides.png | Bin 0 -> 573 bytes .../textures/homedecor_cardboard_box_tb.png | Bin 0 -> 528 bytes 4 files changed, 67 insertions(+) create mode 100644 homedecor/textures/homedecor_cardboard_box.png create mode 100644 homedecor/textures/homedecor_cardboard_box_sides.png create mode 100644 homedecor/textures/homedecor_cardboard_box_tb.png diff --git a/homedecor/misc_nodes.lua b/homedecor/misc_nodes.lua index 7675db75..51a32c5e 100644 --- a/homedecor/misc_nodes.lua +++ b/homedecor/misc_nodes.lua @@ -422,4 +422,71 @@ minetest.register_node("homedecor:fishtank", { sounds = default.node_sound_glass_defaults(), }) +minetest.register_node('homedecor:cardboard_box', { + drawtype = "nodebox", + description = S("Cardboard box"), + tiles = { + 'homedecor_cardboard_box_tb.png', + 'homedecor_cardboard_box_tb.png', + 'homedecor_cardboard_box_sides.png' + }, + sunlight_propagates = false, + paramtype = "light", + paramtype2 = "facedir", + walkable = true, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } + }, + node_box = { + type = "fixed", + fixed = { + {0.1875, -0.5, -0.25, 0.25, 0, 0.25}, + {-0.25, -0.5, -0.25, -0.1875, 0, 0.25}, + {-0.25, -0.5, 0.1875, 0.25, 0, 0.25}, + {-0.25, -0.5, -0.25, 0.25, 0, -0.1875}, + {-0.25, -0.5, -0.25, 0.25, -0.4375, 0.25}, + {0.1875, -0.0625, -0.25, 0.5, 0, 0.25}, + {-0.5, -0.0625, -0.25, -0.1875, 0, 0.25}, + {-0.25, -0.0625, 0.1875, 0.25, 0, 0.5}, + {-0.25, -0.0625, -0.5, 0.25, 0, -0.1875}, + } + }, + groups = { snappy = 3 }, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "size[8,6]".. + "list[current_name;main;2,0;4,1;]".. + "list[current_player;main;0,2;8,4;]") + meta:set_string("infotext", S("Cardboard box")) + local inv = meta:get_inventory() + inv:set_size("main", 8) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", S("%s moves stuff in cardboard box at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", S("%s moves stuff to cardboard box at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", S("%s takes stuff from cardboard box at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) + end, +}) diff --git a/homedecor/textures/homedecor_cardboard_box.png b/homedecor/textures/homedecor_cardboard_box.png new file mode 100644 index 0000000000000000000000000000000000000000..616f14e105f6bc9536d7184bc40e76bf0e0a9a0b GIT binary patch literal 573 zcmV-D0>b@?P)~pNbRt7@QH%0=vU>cRe%9AB*G*gcOPhpa1>z;ktc&e!bl; zrL=#ZZqMKEfBkv=^7ZBE>GtK@kB_(aKY#6ifBfUe%j2>x*oU!lin=bEYu)#9mJ&h$ z0K(9lvGV9%ThC`@ModxnqXY_b&da(mApn%z%xCK(E!ul`_cbaj10t5(F5A*t3n2`5 zWJJK)dcdi|(`HmTa|uM#reMH1XDwY-=bY1Q+Du7rw+jFOfP)Y7ZB1hg2X_EWku|aq z5z!-8WZaL^hxKMJ_hWkS;VhhM7pC3}yIDT#k+YcrfOSK}n(LfXgtkqWHJaNJarj32JseiY#lle|#_1s|@F&CJY%2@#1Xs^n7fECmtG=CA!Uvk=11`x&DMQ*FIB z^WoRa`Z#h*I(*>tKtim1-PV#DB5q0B7{^gB>jD5X%+eYY?zu#X=B&s%BG+7nhDU00000 LNkvXXu0mjf5oiZo literal 0 HcmV?d00001 diff --git a/homedecor/textures/homedecor_cardboard_box_sides.png b/homedecor/textures/homedecor_cardboard_box_sides.png new file mode 100644 index 0000000000000000000000000000000000000000..616f14e105f6bc9536d7184bc40e76bf0e0a9a0b GIT binary patch literal 573 zcmV-D0>b@?P)~pNbRt7@QH%0=vU>cRe%9AB*G*gcOPhpa1>z;ktc&e!bl; zrL=#ZZqMKEfBkv=^7ZBE>GtK@kB_(aKY#6ifBfUe%j2>x*oU!lin=bEYu)#9mJ&h$ z0K(9lvGV9%ThC`@ModxnqXY_b&da(mApn%z%xCK(E!ul`_cbaj10t5(F5A*t3n2`5 zWJJK)dcdi|(`HmTa|uM#reMH1XDwY-=bY1Q+Du7rw+jFOfP)Y7ZB1hg2X_EWku|aq z5z!-8WZaL^hxKMJ_hWkS;VhhM7pC3}yIDT#k+YcrfOSK}n(LfXgtkqWHJaNJarj32JseiY#lle|#_1s|@F&CJY%2@#1Xs^n7fECmtG=CA!Uvk=11`x&DMQ*FIB z^WoRa`Z#h*I(*>tKtim1-PV#DB5q0B7{^gB>jD5X%+eYY?zu#X=B&s%BG+7nhDU00000 LNkvXXu0mjf5oiZo literal 0 HcmV?d00001 diff --git a/homedecor/textures/homedecor_cardboard_box_tb.png b/homedecor/textures/homedecor_cardboard_box_tb.png new file mode 100644 index 0000000000000000000000000000000000000000..86314e207e3e9ebc31baee290971907fb0d46098 GIT binary patch literal 528 zcmV+r0`L8aP)tZ_%$BSqu(qnkQ3l;>s+bosPN0D z5AZwV2haou2=$uyKyqntw3e0WeT(Gt|XPy3^}GeIxj@s zFxJLMU71P?Gs{B0-aagsbnK^_n1WBcwl5iT%yZl1nCr^;5XFZuOjC%75C9;BL_}_M zr4*(3@>16`bNBs6h715k8xfJ!YgX_91E| zn_VZ~$MyE$T_gl#M8s`7yjv}lu=64Klw*E)YLRgoy)jDaO3!Z^07$ufyM3fNT~^x1 z*!ON>uhwuVSl+Iz^Fb|M?RK3o)4uIbyD~Egv7i>oIkT`ZDW%%O007ez