From 065ff29402de7a716d0f6cba0b5c528f0869471f Mon Sep 17 00:00:00 2001 From: kilbith Date: Sat, 20 Sep 2014 13:05:07 +0200 Subject: [PATCH] Openable medicine cabinet Openable medicine cabinet (on punch) : https://cdn.mediacru.sh/JQcxf58tptfP.png Textures : http://mamadou3.free.fr/medicine_cabinet_open_textures.zip --- homedecor/misc-bathroom.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/homedecor/misc-bathroom.lua b/homedecor/misc-bathroom.lua index 9d742605..78b0d862 100644 --- a/homedecor/misc-bathroom.lua +++ b/homedecor/misc-bathroom.lua @@ -88,6 +88,10 @@ minetest.register_node('homedecor:medicine_cabinet', { }, groups = { snappy = 3 }, sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher, pointed_thing) + local fdir = node.param2 + minetest.set_node(pos, { name = "homedecor:medicine_cabinet_open", param2 = fdir }) + end, on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", @@ -123,6 +127,33 @@ minetest.register_node('homedecor:medicine_cabinet', { end, }) +minetest.register_node("homedecor:medicine_cabinet_open", { + tiles = { + 'homedecor_medicine_cabinet_tb.png', + 'homedecor_medicine_cabinet_tb.png', + "homedecor_medicine_cabinet_open_right.png", + 'homedecor_medicine_cabinet_sides.png', + 'homedecor_medicine_cabinet_back.png', + "homedecor_medicine_cabinet_open_front.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = { snappy = 3, not_in_creative_inventory=1 }, + node_box = { + type = "fixed", + fixed = { + {-0.3125, -0.1875, 0.375, 0.3125, 0.5, 0.5}, -- NodeBox1 + {0.28, -0.1875, -0.1875, 0.3125, 0.5, 0.375}, -- NodeBox2 + } + }, + drop = "homedecor:medicine_cabinet", + on_punch = function(pos, node, puncher, pointed_thing) + local fdir = node.param2 + minetest.set_node(pos, { name = "homedecor:medicine_cabinet", param2 = fdir }) + end, +}) + minetest.register_node("homedecor:toilet_paper", { description = S("Toilet paper"), tiles = {