diff --git a/homedecor/locked.lua b/homedecor/locked.lua index 088a703a..923ef231 100644 --- a/homedecor/locked.lua +++ b/homedecor/locked.lua @@ -139,6 +139,8 @@ local items = { "Nightstand" }, { "nightstand_mahogany_two_drawers", "Nightstand" }, + { "filing_cabinet", + "Filing cabinet" }, { "oven", "Oven" }, { "oven_active", diff --git a/homedecor/misc_nodes.lua b/homedecor/misc_nodes.lua index f2adebb9..43e20782 100644 --- a/homedecor/misc_nodes.lua +++ b/homedecor/misc_nodes.lua @@ -524,3 +524,65 @@ minetest.register_node("homedecor:dvd_cd_cabinet", { sounds = default.node_sound_wood_defaults(), }) +minetest.register_node('homedecor:filing_cabinet', { + drawtype = "nodebox", + description = S("Filing Cabinet"), + tiles = { + 'homedecor_filing_cabinet_top.png', + 'homedecor_filing_cabinet_bottom.png', + 'homedecor_filing_cabinet_sides.png', + 'homedecor_filing_cabinet_sides.png^[transformFX', + 'homedecor_filing_cabinet_back.png', + 'homedecor_filing_cabinet_front.png' + }, + sunlight_propagates = false, + paramtype = "light", + paramtype2 = "facedir", + walkable = true, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + node_box = { + type = "fixed", + fixed = { + { -8/16, -8/16, -30/64, 8/16, 8/16, 8/16 }, -- main body + { -7/16, -7/16, -8/16, 7/16, 7/16, 8/16 }, -- drawer + } + }, + 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,7]".. + "list[current_name;main;0,0;8,2;]".. + "list[current_player;main;0,3;8,4;]") + meta:set_string("infotext", S("Filing cabinet")) + local inv = meta:get_inventory() + inv:set_size("main", 16) + 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 filing cabinet 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 filing cabinet 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 filing cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) + end, +}) diff --git a/homedecor/textures/homedecor_filing_cabinet_back.png b/homedecor/textures/homedecor_filing_cabinet_back.png new file mode 100644 index 00000000..d6fb9386 Binary files /dev/null and b/homedecor/textures/homedecor_filing_cabinet_back.png differ diff --git a/homedecor/textures/homedecor_filing_cabinet_bottom.png b/homedecor/textures/homedecor_filing_cabinet_bottom.png new file mode 100644 index 00000000..19513532 Binary files /dev/null and b/homedecor/textures/homedecor_filing_cabinet_bottom.png differ diff --git a/homedecor/textures/homedecor_filing_cabinet_front.png b/homedecor/textures/homedecor_filing_cabinet_front.png new file mode 100644 index 00000000..b434932a Binary files /dev/null and b/homedecor/textures/homedecor_filing_cabinet_front.png differ diff --git a/homedecor/textures/homedecor_filing_cabinet_sides.png b/homedecor/textures/homedecor_filing_cabinet_sides.png new file mode 100644 index 00000000..fcbfe2bb Binary files /dev/null and b/homedecor/textures/homedecor_filing_cabinet_sides.png differ diff --git a/homedecor/textures/homedecor_filing_cabinet_top.png b/homedecor/textures/homedecor_filing_cabinet_top.png new file mode 100644 index 00000000..5a0a9fc4 Binary files /dev/null and b/homedecor/textures/homedecor_filing_cabinet_top.png differ