Added a deckchair
| @@ -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" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -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") | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_deckchair_back.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 526 B | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_deckchair_bottom.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 539 B | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_deckchair_front.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 610 B | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_deckchair_inv.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 5.0 KiB | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_deckchair_sides.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 441 B | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_deckchair_top_c1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 586 B | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_deckchair_top_c2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 587 B |