diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index ceb1a9c..2ab4e2e 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -2372,15 +2372,6 @@ minetest.register_craft( { }, }) -minetest.register_craft( { - output = "homedecor:bed_blue_foot", - recipe = { - { "group:stick", "", "group:stick" }, - { "wool:white", "wool:blue", "wool:blue" }, - { "group:wood", "", "group:wood" }, - }, -}) - minetest.register_craft( { output = "homedecor:pool_table", recipe = { @@ -2517,3 +2508,25 @@ minetest.register_craft( { { "moreblocks:slab_wood", "", "moreblocks:slab_wood" } }, }) + +local bedcolors = { + { "red", "red"}, + { "green", "dark_green"}, + { "blue", "blue"}, + { "violet", "violet"} +} + +for c in ipairs(bedcolors) do + local color = bedcolors[c][1] + local woolcolor = bedcolors[c][2] + + minetest.register_craft( { + output = "homedecor:bed_"..color.."_foot", + recipe = { + { "group:stick", "", "group:stick" }, + { "wool:white", "wool:"..woolcolor, "wool:"..woolcolor }, + { "group:wood", "", "group:wood" }, + }, + }) + +end diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index 1d577b0..edc4d70 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -240,45 +240,12 @@ minetest.register_node(":homedecor:openframe_bookshelf", { } }) --- decorative bed and wardrobe, models by jp - -minetest.register_node("homedecor:bed_blue_head", { - tiles = { - "homedecor_bed_blue_top1.png", - "homedecor_bed_bottom1.png", - "homedecor_bed_blue_side1.png", - "homedecor_bed_blue_side1.png^[transformFX", - "homedecor_bed_blue_head1.png", - "homedecor_bed_blue_head2.png" - }, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - groups = {snappy=3, not_in_creative_inventory=1}, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, 0.4375, -0.375, 0.5, 0.5}, -- NodeBox1 - {0.375, -0.5, 0.4375, 0.5, 0.5, 0.5}, -- NodeBox2 - {-0.5, 0.25, 0.4375, 0.5, 0.4375, 0.5}, -- NodeBox3 - {-0.5, 0, 0.4375, 0.5, 0.1875, 0.5}, -- NodeBox4 - {-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5}, -- NodeBox5 - {-0.4375, -0.375, -0.5, -0.375, -0.125, 0.5}, -- NodeBox6 - {0.375, -0.375, -0.5, 0.4375, -0.125, 0.5}, -- NodeBox7 - {-0.375, -0.375, 0.25, 0.375, -0.3125, 0.375}, -- NodeBox8 - {-0.375, -0.375, 0.0625, 0.375, -0.3125, 0.1875}, -- NodeBox9 - {-0.375, -0.375, -0.125, 0.375, -0.3125, 0}, -- NodeBox10 - {-0.375, -0.375, -0.3125, 0.375, -0.3125, -0.1875}, -- NodeBox11 - {-0.375, -0.375, -0.5, 0.375, -0.3125, -0.375}, -- NodeBox12 - {-0.375, -0.3125, -0.5, 0.375, -0.0625, 0.4375}, -- NodeBox13 - {-0.3125, -0.125, 0.0625, 0.3125, 0.0625, 0.4375}, -- NodeBox14 - } - }, - selection_box = { - type = "fixed", - fixed = { 0, 0, 0, 0, 0, 0 } - } -}) +local bedcolors = { + "red", + "green", + "blue", + "violet", +} local fdir_to_fwd = { { 0, 1 }, @@ -287,78 +254,120 @@ local fdir_to_fwd = { { -1, 0 }, } -minetest.register_node("homedecor:bed_blue_foot", { - tiles = { - "homedecor_bed_blue_top2.png", - "homedecor_bed_bottom2.png", - "homedecor_bed_blue_side2.png", - "homedecor_bed_blue_side2.png^[transformFX", - "homedecor_bed_blue_foot2.png", - "homedecor_bed_blue_foot1.png" - }, - inventory_image = "homedecor_bed_blue_inv.png", - description = "Bed", - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - groups = {snappy=3}, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, -0.375, 0.1875, -0.4375}, -- NodeBox1 - {0.375, -0.5, -0.5, 0.5, 0.1875, -0.4375}, -- NodeBox2 - {-0.5, 0, -0.5, 0.5, 0.125, -0.4375}, -- NodeBox3 - {-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375}, -- NodeBox4 - {-0.4375, -0.375, -0.5, -0.375, -0.125, 0.5}, -- NodeBox5 - {0.375, -0.375, -0.5, 0.4375, -0.125, 0.5}, -- NodeBox6 - {-0.375, -0.375, 0.3125, 0.375, -0.3125, 0.4375}, -- NodeBox7 - {-0.375, -0.375, 0.125, 0.375, -0.3125, 0.25}, -- NodeBox8 - {-0.375, -0.375, -0.0625, 0.375, -0.3125, 0.0625}, -- NodeBox9 - {-0.375, -0.375, -0.25, 0.375, -0.3125, -0.125}, -- NodeBox10 - {-0.375, -0.375, -0.4375, 0.375, -0.3125, -0.3125}, -- NodeBox11 - {-0.375, -0.3125, -0.4375, 0.375, -0.0625, 0.5}, -- NodeBox12 +for _, color in ipairs(bedcolors) do + + minetest.register_node("homedecor:bed_"..color.."_head", { + tiles = { + "homedecor_bed_"..color.."_top1.png", + "homedecor_bed_bottom1.png", + "homedecor_bed_"..color.."_side1.png", + "homedecor_bed_"..color.."_side1.png^[transformFX", + "homedecor_bed_"..color.."_head1.png", + "homedecor_bed_"..color.."_head2.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=3, not_in_creative_inventory=1}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4375, -0.375, 0.5, 0.5}, -- NodeBox1 + {0.375, -0.5, 0.4375, 0.5, 0.5, 0.5}, -- NodeBox2 + {-0.5, 0.25, 0.4375, 0.5, 0.4375, 0.5}, -- NodeBox3 + {-0.5, 0, 0.4375, 0.5, 0.1875, 0.5}, -- NodeBox4 + {-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5}, -- NodeBox5 + {-0.4375, -0.375, -0.5, -0.375, -0.125, 0.5}, -- NodeBox6 + {0.375, -0.375, -0.5, 0.4375, -0.125, 0.5}, -- NodeBox7 + {-0.375, -0.375, 0.25, 0.375, -0.3125, 0.375}, -- NodeBox8 + {-0.375, -0.375, 0.0625, 0.375, -0.3125, 0.1875}, -- NodeBox9 + {-0.375, -0.375, -0.125, 0.375, -0.3125, 0}, -- NodeBox10 + {-0.375, -0.375, -0.3125, 0.375, -0.3125, -0.1875}, -- NodeBox11 + {-0.375, -0.375, -0.5, 0.375, -0.3125, -0.375}, -- NodeBox12 + {-0.375, -0.3125, -0.5, 0.375, -0.0625, 0.4375}, -- NodeBox13 + {-0.3125, -0.125, 0.0625, 0.3125, 0.0625, 0.4375}, -- NodeBox14 + } + }, + selection_box = { + type = "fixed", + fixed = { 0, 0, 0, 0, 0, 0 } } - }, - selection_box = { - type = "fixed", - fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 1.5 } - }, - on_place = function(itemstack, placer, pointed_thing) - local pos = pointed_thing.under - local pnode = minetest.get_node(pointed_thing.under) - local rnodedef = minetest.registered_nodes[pnode.name] + }) - if not rnodedef["buildable_to"] then - pos = pointed_thing.above - end + minetest.register_node("homedecor:bed_"..color.."_foot", { + tiles = { + "homedecor_bed_"..color.."_top2.png", + "homedecor_bed_bottom2.png", + "homedecor_bed_"..color.."_side2.png", + "homedecor_bed_"..color.."_side2.png^[transformFX", + "homedecor_bed_"..color.."_foot2.png", + "homedecor_bed_"..color.."_foot1.png" + }, + inventory_image = "homedecor_bed_"..color.."_inv.png", + description = S("Bed (%s)"):format(color), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=3}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, -0.375, 0.1875, -0.4375}, -- NodeBox1 + {0.375, -0.5, -0.5, 0.5, 0.1875, -0.4375}, -- NodeBox2 + {-0.5, 0, -0.5, 0.5, 0.125, -0.4375}, -- NodeBox3 + {-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375}, -- NodeBox4 + {-0.4375, -0.375, -0.5, -0.375, -0.125, 0.5}, -- NodeBox5 + {0.375, -0.375, -0.5, 0.4375, -0.125, 0.5}, -- NodeBox6 + {-0.375, -0.375, 0.3125, 0.375, -0.3125, 0.4375}, -- NodeBox7 + {-0.375, -0.375, 0.125, 0.375, -0.3125, 0.25}, -- NodeBox8 + {-0.375, -0.375, -0.0625, 0.375, -0.3125, 0.0625}, -- NodeBox9 + {-0.375, -0.375, -0.25, 0.375, -0.3125, -0.125}, -- NodeBox10 + {-0.375, -0.375, -0.4375, 0.375, -0.3125, -0.3125}, -- NodeBox11 + {-0.375, -0.3125, -0.4375, 0.375, -0.0625, 0.5}, -- NodeBox12 + } + }, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 1.5 } + }, + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local pnode = minetest.get_node(pointed_thing.under) + local rnodedef = minetest.registered_nodes[pnode.name] - local fdir = minetest.dir_to_facedir(placer:get_look_dir()) - local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] } + if not rnodedef["buildable_to"] then + pos = pointed_thing.above + end - local tnode = minetest.get_node(pos) - local tnode2 = minetest.get_node(pos2) + local fdir = minetest.dir_to_facedir(placer:get_look_dir()) + local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] } - if homedecor.get_nodedef_field(tnode.name, "buildable_to") - and homedecor.get_nodedef_field(tnode2.name, "buildable_to") - and not minetest.is_protected(pos, placer:get_player_name()) - and not minetest.is_protected(pos2, placer:get_player_name()) then - minetest.add_node(pos, { name = "homedecor:bed_blue_foot", param2 = fdir }) - minetest.add_node(pos2, { name = "homedecor:bed_blue_head", param2 = fdir }) - if not homedecor.expect_infinite_stacks then - itemstack:take_item() - return itemstack + local tnode = minetest.get_node(pos) + local tnode2 = minetest.get_node(pos2) + + if homedecor.get_nodedef_field(tnode.name, "buildable_to") + and homedecor.get_nodedef_field(tnode2.name, "buildable_to") + and not minetest.is_protected(pos, placer:get_player_name()) + and not minetest.is_protected(pos2, placer:get_player_name()) then + minetest.add_node(pos, { name = "homedecor:bed_"..color.."_foot", param2 = fdir }) + minetest.add_node(pos2, { name = "homedecor:bed_"..color.."_head", param2 = fdir }) + if not homedecor.expect_infinite_stacks then + itemstack:take_item() + return itemstack + end + end + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local fdir = oldnode.param2 + if not fdir or fdir > 3 then return end + local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] } + if minetest.get_node(pos2).name == "homedecor:bed_"..color.."_head" then + minetest.remove_node(pos2) end end - end, - after_dig_node = function(pos, oldnode, oldmetadata, digger) - local fdir = oldnode.param2 - if not fdir or fdir > 3 then return end - local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] } - if minetest.get_node(pos2).name == "homedecor:bed_blue_head" then - minetest.remove_node(pos2) - end - end -}) + }) + +end minetest.register_node("homedecor:wardrobe_top", { tiles = { @@ -371,8 +380,8 @@ minetest.register_node("homedecor:wardrobe_top", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", - groups = {snappy=3, not_in_creative_inventory=1}, + paramtype2 = "facedir", + groups = {snappy=3, not_in_creative_inventory=1}, node_box = { type = "fixed", fixed = { diff --git a/homedecor/textures/homedecor_bed_green_foot1.png b/homedecor/textures/homedecor_bed_green_foot1.png new file mode 100644 index 0000000..013f3b0 Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_foot1.png differ diff --git a/homedecor/textures/homedecor_bed_green_foot2.png b/homedecor/textures/homedecor_bed_green_foot2.png new file mode 100644 index 0000000..f8da3f0 Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_foot2.png differ diff --git a/homedecor/textures/homedecor_bed_green_head1.png b/homedecor/textures/homedecor_bed_green_head1.png new file mode 100644 index 0000000..1149855 Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_head1.png differ diff --git a/homedecor/textures/homedecor_bed_green_head2.png b/homedecor/textures/homedecor_bed_green_head2.png new file mode 100644 index 0000000..10bb593 Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_head2.png differ diff --git a/homedecor/textures/homedecor_bed_green_inv.png b/homedecor/textures/homedecor_bed_green_inv.png new file mode 100644 index 0000000..5e014c3 Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_inv.png differ diff --git a/homedecor/textures/homedecor_bed_green_side1.png b/homedecor/textures/homedecor_bed_green_side1.png new file mode 100644 index 0000000..483c22f Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_side1.png differ diff --git a/homedecor/textures/homedecor_bed_green_side2.png b/homedecor/textures/homedecor_bed_green_side2.png new file mode 100644 index 0000000..dd30cc2 Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_side2.png differ diff --git a/homedecor/textures/homedecor_bed_green_top1.png b/homedecor/textures/homedecor_bed_green_top1.png new file mode 100644 index 0000000..6a1fb46 Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_top1.png differ diff --git a/homedecor/textures/homedecor_bed_green_top2.png b/homedecor/textures/homedecor_bed_green_top2.png new file mode 100644 index 0000000..44aacdf Binary files /dev/null and b/homedecor/textures/homedecor_bed_green_top2.png differ diff --git a/homedecor/textures/homedecor_bed_red_foot1.png b/homedecor/textures/homedecor_bed_red_foot1.png new file mode 100644 index 0000000..9bbe930 Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_foot1.png differ diff --git a/homedecor/textures/homedecor_bed_red_foot2.png b/homedecor/textures/homedecor_bed_red_foot2.png new file mode 100644 index 0000000..f8da3f0 Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_foot2.png differ diff --git a/homedecor/textures/homedecor_bed_red_head1.png b/homedecor/textures/homedecor_bed_red_head1.png new file mode 100644 index 0000000..fd0a2ca Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_head1.png differ diff --git a/homedecor/textures/homedecor_bed_red_head2.png b/homedecor/textures/homedecor_bed_red_head2.png new file mode 100644 index 0000000..9f33ddf Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_head2.png differ diff --git a/homedecor/textures/homedecor_bed_red_inv.png b/homedecor/textures/homedecor_bed_red_inv.png new file mode 100644 index 0000000..c4c040a Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_inv.png differ diff --git a/homedecor/textures/homedecor_bed_red_side1.png b/homedecor/textures/homedecor_bed_red_side1.png new file mode 100644 index 0000000..9796ee8 Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_side1.png differ diff --git a/homedecor/textures/homedecor_bed_red_side2.png b/homedecor/textures/homedecor_bed_red_side2.png new file mode 100644 index 0000000..ffefa24 Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_side2.png differ diff --git a/homedecor/textures/homedecor_bed_red_top1.png b/homedecor/textures/homedecor_bed_red_top1.png new file mode 100644 index 0000000..f39f7ff Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_top1.png differ diff --git a/homedecor/textures/homedecor_bed_red_top2.png b/homedecor/textures/homedecor_bed_red_top2.png new file mode 100644 index 0000000..6d010e8 Binary files /dev/null and b/homedecor/textures/homedecor_bed_red_top2.png differ diff --git a/homedecor/textures/homedecor_bed_violet_foot1.png b/homedecor/textures/homedecor_bed_violet_foot1.png new file mode 100644 index 0000000..98ac857 Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_foot1.png differ diff --git a/homedecor/textures/homedecor_bed_violet_foot2.png b/homedecor/textures/homedecor_bed_violet_foot2.png new file mode 100644 index 0000000..f8da3f0 Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_foot2.png differ diff --git a/homedecor/textures/homedecor_bed_violet_head1.png b/homedecor/textures/homedecor_bed_violet_head1.png new file mode 100644 index 0000000..9bd90a6 Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_head1.png differ diff --git a/homedecor/textures/homedecor_bed_violet_head2.png b/homedecor/textures/homedecor_bed_violet_head2.png new file mode 100644 index 0000000..9671046 Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_head2.png differ diff --git a/homedecor/textures/homedecor_bed_violet_inv.png b/homedecor/textures/homedecor_bed_violet_inv.png new file mode 100644 index 0000000..cab3862 Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_inv.png differ diff --git a/homedecor/textures/homedecor_bed_violet_side1.png b/homedecor/textures/homedecor_bed_violet_side1.png new file mode 100644 index 0000000..df93f06 Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_side1.png differ diff --git a/homedecor/textures/homedecor_bed_violet_side2.png b/homedecor/textures/homedecor_bed_violet_side2.png new file mode 100644 index 0000000..ca0666f Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_side2.png differ diff --git a/homedecor/textures/homedecor_bed_violet_top1.png b/homedecor/textures/homedecor_bed_violet_top1.png new file mode 100644 index 0000000..1e93634 Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_top1.png differ diff --git a/homedecor/textures/homedecor_bed_violet_top2.png b/homedecor/textures/homedecor_bed_violet_top2.png new file mode 100644 index 0000000..1276cea Binary files /dev/null and b/homedecor/textures/homedecor_bed_violet_top2.png differ