-- Carpet Mod
-- By Jordan Snelling 2012 - with some additional code and textures by mmm-sued
-- License LGPL
-- This mod adds carpets into Minetest.

minetest.register_node("carpets:red", {
	description = "Red Carpet",
	drawtype = "raillike",
	tiles = {"carpets_red_out.png", "carpets_red_cor.png", "carpets_red_one.png", "carpets_red_cen.png"},
	inventory_image = "carpets_red_out.png",
	wield_image = "carpets_red_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:orange", {
	description = "Orange Carpet",
	drawtype = "raillike",
	tiles = {"carpets_orange_out.png", "carpets_orange_cor.png", "carpets_orange_one.png", "carpets_orange_cen.png"},
	inventory_image = "carpets_orange_out.png",
	wield_image = "carpets_orange_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:yellow", {
	description = "Yellow Carpet",
	drawtype = "raillike",
	tiles = {"carpets_yellow_out.png"},
	inventory_image = "carpets_yellow_out.png",
	wield_image = "carpets_yellow_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:green", {
	description = "Green Carpet",
	drawtype = "raillike",
	tiles = {"carpets_green_out.png"},
	inventory_image = "carpets_green_out.png",
	wield_image = "carpets_green_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:cyan", {
	description = "Cyan Carpet",
	drawtype = "raillike",
	tiles = {"carpets_cyan_out.png"},
	inventory_image = "carpets_cyan_out.png",
	wield_image = "carpets_cyan_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:blue", {
	description = "Blue Carpet",
	drawtype = "raillike",
	tiles = {"carpets_blue_out.png"},
	inventory_image = "carpets_blue_out.png",
	wield_image = "carpets_blue_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:pink", {
	description = "Pink Carpet",
	drawtype = "raillike",
	tiles = {"carpets_pink_out.png"},
	inventory_image = "carpets_pink_out.png",
	wield_image = "carpets_pink_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:black", {
	description = "Black Carpet",
	drawtype = "raillike",
	tiles = {"carpets_black_out.png"},
	inventory_image = "carpets_black_out.png",
	wield_image = "carpets_black_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:magenta", {
	description = "Magenta Carpet",
	drawtype = "raillike",
	tiles = {"carpets_magenta_out.png"},
	inventory_image = "carpets_magenta_out.png",
	wield_image = "carpets_magenta_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:white", {
	description = "White Carpet",
	drawtype = "raillike",
	tiles = {"carpets_white_out.png"},
	inventory_image = "carpets_white_out.png",
	wield_image = "carpets_white_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:beige", {
	description = "Beige Carpet",
	drawtype = "raillike",
	tiles = {"carpets_beige_out.png"},
	inventory_image = "carpets_beige_out.png",
	wield_image = "carpets_beige_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:pattern", {
	description = "Pattern Carpet",
	drawtype = "raillike",
	tiles = {"carpets_pattern_out.png"},
	inventory_image = "carpets_pattern_out.png",
	wield_image = "carpets_pattern_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:squares", {
	description = "Squares Carpet",
	drawtype = "raillike",
	tiles = {"carpets_squares_out.png"},
	inventory_image = "carpets_squares_out.png",
	wield_image = "carpets_squares_out.png",
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:lava", {
	description = "Lava Carpet",
	drawtype = "raillike",
	tiles = {
		{
			name = "carpets_lava.png",
			backface_culling = false,
			animation = {
				type = "vertical_frames",
				aspect_w = 16,
				aspect_h = 16,
				length = 3.0,
			},
		},
		{
			name = "carpets_lava.png",
			backface_culling = true,
			animation = {
				type = "vertical_frames",
				aspect_w = 16,
				aspect_h = 16,
				length = 3.0,
			},
		},
	},
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	groups = {dig_immediate=2},
})

minetest.register_node("carpets:water", {
	description = "Water Carpet",
	drawtype = "raillike",
	tiles = {
		{
			name = "carpets_water.png",
			backface_culling = false,
			animation = {
				type = "vertical_frames",
				aspect_w = 16,
				aspect_h = 16,
				length = 3.0,
			},
		},
		{
			name = "carpets_water.png",
			backface_culling = true,
			animation = {
				type = "vertical_frames",
				aspect_w = 16,
				aspect_h = 16,
				length = 3.0,
			},
		},
	},
	node_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -0.475, 0.5},
	},
	paramtype = "light",
	is_ground_content = true,
	walkable = false,
	buildable_to = true,
	selection_box = {
		type = "fixed",

                fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
	},
	groups = {dig_immediate=2},
})


-- No crafting yet