diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index 4e48a046..30fa37ea 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -2627,4 +2627,14 @@ minetest.register_craft({ }, }) +minetest.register_craft({ + output = "homedecor:deckchair_foot", + recipe = { + { "group:stick", "building_blocks:terrycloth_towel", "group:stick" }, + { "group:stick", "building_blocks:terrycloth_towel", "group:stick" }, + { "group:stick", "building_blocks:terrycloth_towel", "group:stick" } + }, +}) + + diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index bd2ebb27..46362d47 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -748,6 +748,117 @@ minetest.register_node("homedecor:bench_large_2_right", { }, }) +local fdir_to_fwd = { + { 0, 1 }, + { 1, 0 }, + { 0, -1 }, + { -1, 0 }, +} + +minetest.register_node("homedecor:deckchair_head", { + tiles = { + "homedecor_deckchair_top_c1.png", + "homedecor_deckchair_bottom.png", + "homedecor_deckchair_sides.png", + "homedecor_deckchair_sides.png^[transformFX", + "homedecor_deckchair_back.png", + "homedecor_deckchair_front.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = { snappy = 3, not_in_creative_inventory = 1 }, + node_box = { + type = "fixed", + fixed = { + {-0.375, -0.3125, -0.0625, 0.375, -0.25, 0}, -- NodeBox1 + {-0.375, -0.25, 0, 0.375, -0.1875, 0.0625}, -- NodeBox2 + {-0.375, -0.1875, 0.0625, 0.375, -0.125, 0.125}, -- NodeBox3 + {-0.375, -0.125, 0.125, 0.375, -0.0625, 0.1875}, -- NodeBox4 + {-0.375, -0.0625, 0.1875, 0.375, 0, 0.25}, -- NodeBox5 + {-0.375, 0, 0.25, 0.375, 0.0625, 0.3125}, -- NodeBox6 + {-0.375, 0.0625, 0.3125, 0.375, 0.125, 0.375}, -- NodeBox7 + {-0.375, 0.125, 0.375, 0.375, 0.1875, 0.4375}, -- NodeBox8 + {-0.375, 0.1875, 0.4375, 0.375, 0.25, 0.5}, -- NodeBox9 + {-0.375, -0.375, -0.5, 0.375, -0.3125, 0.0625}, -- NodeBox10 + {0.3125, -0.1875, -0.5, 0.4375, -0.1575, 0.0625}, -- NodeBox11 + {-0.4375, -0.1875, -0.5, -0.3125, -0.1575, 0.0625}, -- NodeBox12 + {0.3125, -0.5, 0, 0.375, -0.25, 0.0625}, -- NodeBox13 + {-0.375, -0.5, 0, -0.3125, -0.25, 0.0625}, -- NodeBox14 + } + }, + selection_box = { + type = "fixed", + fixed = { 0, 0, 0, 0, 0, 0 } + } +}) + +minetest.register_node("homedecor:deckchair_foot", { + tiles = { + "homedecor_deckchair_top_c2.png", + "homedecor_deckchair_bottom.png", + "homedecor_deckchair_sides.png", + "homedecor_deckchair_sides.png^[transformFX", + "homedecor_deckchair_front.png" + }, + inventory_image = "homedecor_deckchair_inv.png", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = { snappy = 3 }, + node_box = { + type = "fixed", + fixed = { + {-0.375, -0.375, -0.5, 0.375, -0.3125, 0.5}, -- NodeBox1 + {0.3125, -0.5, -0.5, 0.375, -0.375, -0.4375}, -- NodeBox2 + {-0.375, -0.5, -0.5, -0.3125, -0.375, -0.4375}, -- NodeBox3 + {0.3125, -0.1875, 0.3, 0.4375, -0.1575, 0.5}, -- NodeBox4 + {-0.4375, -0.1875, 0.3, -0.3125, -0.1575, 0.5}, -- NodeBox5 + {-0.365, -0.3125, 0.32, -0.3225, -0.1875, 0.4375}, -- NodeBox6 + {0.3225, -0.3125, 0.32, 0.365, -0.1875, 0.4375}, -- NodeBox7 + } + }, + selection_box = { + type = "fixed", + fixed = { -0.45, -0.5, -0.5, 0.45, 0.35, 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 + + 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] } + + 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:deckchair_foot", param2 = fdir }) + minetest.add_node(pos2, { name = "homedecor:deckchair_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:deckchair_head" then + minetest.remove_node(pos2) + end + end +}) + -- Aliases for 3dforniture mod. minetest.register_alias("3dforniture:table", "homedecor:table") diff --git a/homedecor/textures/homedecor_deckchair_back.png b/homedecor/textures/homedecor_deckchair_back.png new file mode 100644 index 00000000..7657666b Binary files /dev/null and b/homedecor/textures/homedecor_deckchair_back.png differ diff --git a/homedecor/textures/homedecor_deckchair_bottom.png b/homedecor/textures/homedecor_deckchair_bottom.png new file mode 100644 index 00000000..d70ab9cc Binary files /dev/null and b/homedecor/textures/homedecor_deckchair_bottom.png differ diff --git a/homedecor/textures/homedecor_deckchair_front.png b/homedecor/textures/homedecor_deckchair_front.png new file mode 100644 index 00000000..437ec1fd Binary files /dev/null and b/homedecor/textures/homedecor_deckchair_front.png differ diff --git a/homedecor/textures/homedecor_deckchair_inv.png b/homedecor/textures/homedecor_deckchair_inv.png new file mode 100644 index 00000000..1f67b57a Binary files /dev/null and b/homedecor/textures/homedecor_deckchair_inv.png differ diff --git a/homedecor/textures/homedecor_deckchair_sides.png b/homedecor/textures/homedecor_deckchair_sides.png new file mode 100644 index 00000000..b1f6ede2 Binary files /dev/null and b/homedecor/textures/homedecor_deckchair_sides.png differ diff --git a/homedecor/textures/homedecor_deckchair_top_c1.png b/homedecor/textures/homedecor_deckchair_top_c1.png new file mode 100644 index 00000000..9ec1b269 Binary files /dev/null and b/homedecor/textures/homedecor_deckchair_top_c1.png differ diff --git a/homedecor/textures/homedecor_deckchair_top_c2.png b/homedecor/textures/homedecor_deckchair_top_c2.png new file mode 100644 index 00000000..a103643b Binary files /dev/null and b/homedecor/textures/homedecor_deckchair_top_c2.png differ