1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-10-31 23:40:27 +01:00
homedecor_modpack/homedecor/misc-bathroom.lua
Vanessa Ezekowitz 3ed1ea822a Add inventory images for medicine cabinet and toilet paper
add craft recipe for medicine cabinet, move it to misc-bathroom.lua
2014-08-01 21:26:04 -04:00

158 lines
4.7 KiB
Lua

local S = homedecor.gettext
local bathroom_tile_colors = {
{ "1", "white/grey" },
{ "2", "white/dark grey" },
{ "3", "white/black" },
{ "4", "black/dark grey" },
{ "red", "white/red" },
{ "green", "white/green" },
{ "blue", "white/blue" },
{ "yellow", "white/yellow" },
{ "tan", "white/tan" },
}
for i in ipairs(bathroom_tile_colors) do
local color = bathroom_tile_colors[i][1]
local shade = bathroom_tile_colors[i][2]
minetest.register_node("homedecor:tiles_"..color, {
description = "Bathroom/kitchen tiles ("..shade..")",
tiles = {
"homedecor_bathroom_tiles_"..color..".png",
"homedecor_bathroom_tiles_"..color..".png",
"homedecor_bathroom_tiles_"..color..".png",
"homedecor_bathroom_tiles_"..color..".png",
"homedecor_bathroom_tiles_"..color..".png^[transformR90",
"homedecor_bathroom_tiles_"..color..".png^[transformR90"
},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
end
minetest.register_node("homedecor:towel_rod", {
description = "Towel rod with towel",
drawtype = "nodebox",
tiles = {
"homedecor_towel_rod_top.png",
"homedecor_towel_rod_bottom.png",
"homedecor_towel_rod_sides.png",
"homedecor_towel_rod_sides.png^[transformFX",
"homedecor_towel_rod_fb.png",
"homedecor_towel_rod_fb.png"
},
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.375, 0.1875, 0.25, -0.3125, 0.375, 0.5},
{ 0.3125, 0.1875, 0.25, 0.375, 0.375, 0.5},
{-0.3125, 0.25, 0.3125, 0.3125, 0.375, 0.375},
{-0.3125, 0, 0.375, 0.3125, 0.34375, 0.4375},
{-0.3125, -0.3125, 0.25, 0.3125, 0.34375, 0.3125},
}
},
selection_box = {
type = "fixed",
fixed = { -0.375, -0.3125, 0.25, 0.375, 0.375, 0.5 }
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3},
sounds = default.node_sound_defaults(),
})
minetest.register_node('homedecor:medicine_cabinet', {
drawtype = "nodebox",
description = S("Medicine Cabinet"),
tiles = {
'homedecor_medicine_cabinet_tb.png',
'homedecor_medicine_cabinet_tb.png',
'homedecor_medicine_cabinet_sides.png',
'homedecor_medicine_cabinet_sides.png',
'homedecor_medicine_cabinet_back.png',
'homedecor_medicine_cabinet_front.png'
},
inventory_image = "homedecor_medicine_cabinet_inv.png",
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
selection_box = {
type = "fixed",
fixed = {-0.3125, -0.1875, 0.3125, 0.3125, 0.5, 0.5}
},
node_box = {
type = "fixed",
fixed = {-0.3125, -0.1875, 0.3125, 0.3125, 0.5, 0.5}
},
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;1,0;6,1;]"..
"list[current_player;main;0,3;8,4;]")
meta:set_string("infotext", S("Medicine 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 medicine 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 medicine 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 medicine cabinet at %s"):format(
player:get_player_name(),
minetest.pos_to_string(pos)
))
end,
})
minetest.register_node("homedecor:toilet_paper", {
description = S("Toilet paper"),
tiles = {
"homedecor_toilet_paper_tb.png",
"homedecor_toilet_paper_tb.png",
"homedecor_toilet_paper_sides.png",
"homedecor_toilet_paper_sides.png",
"homedecor_toilet_paper_back.png",
"homedecor_toilet_paper_front.png"
},
inventory_image = "homedecor_toilet_paper_inv.png",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0.1875, 0.25, -0.1875, 0.25, 0.5},
{0.125, 0.1875, 0.25, 0.1875, 0.25, 0.5},
{-0.1875, 0.0625, 0.125, 0.125, 0.375, 0.4375},
{-0.25, 0.125, 0.4375, -0.1875, 0.3125, 0.5},
{0.125, 0.125, 0.4375, 0.1875, 0.3125, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = { -0.25, 0.0625, 0.125, 0.1875, 0.375, 0.5}
},
groups = {snappy=2,oddly_breakable_by_hand=3,flammable=3},
sounds = default.node_sound_defaults(),
})