tapestry.lua 5.79 KB
Newer Older
DonBatman's avatar
DonBatman committed
1 2 3 4
local tapestry = {}

minetest.register_node("castle:tapestry_top", {
	drawtype = "nodebox",
DonBatman's avatar
DonBatman committed
5
 description = "Tapestry Top",
DonBatman's avatar
DonBatman committed
6 7
	tiles = {"default_wood.png"},
	sunlight_propagates = true,
DonBatman's avatar
DonBatman committed
8
	groups = {flammable=3,oddly_breakable_by_hand=3},
DonBatman's avatar
DonBatman committed
9 10 11 12 13 14
	sounds = default.node_sound_defaults(),
	paramtype = "light",
	paramtype2 = "facedir",
	node_box = {
		type = "fixed",
		fixed = {
DonBatman's avatar
DonBatman committed
15
			{-0.6,-0.5,0.375,0.6,-0.375,0.5},
DonBatman's avatar
DonBatman committed
16 17 18 19 20
		},
	},
	selection_box = {
		type = "fixed",
		fixed = {
DonBatman's avatar
DonBatman committed
21
			{-0.6,-0.5,0.375,0.6,-0.375,0.5},
DonBatman's avatar
DonBatman committed
22 23 24 25 26 27 28 29 30 31 32
		},
	},
})

minetest.register_craft({
	type = "shapeless",
	output = 'castle:tapestry_top',
	recipe = {'default:stick'},
})

tapestry.colours = {
DonBatman's avatar
DonBatman committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
	{"white",      "White",      "white",    "#FFFFFF"},
	{"grey",       "Grey",       "grey",    "#4B4B4B"},
	{"black",      "Black",      "black",    "#1F1F1F"},
	{"red",        "Red",        "red",    "#B21414"},
	{"yellow",     "Yellow",     "yellow",    "#FFD011"},
 {"green",      "Green",      "green",    "#43A91C"},
	{"cyan",       "Cyan",       "cyan",    "#00737B"},
	{"blue",       "Blue",       "blue",    "#003A7E"},
	{"magenta",    "Magenta",    "magenta",    "#DD0487"},
	{"orange",     "Orange",     "orange",    "#D55014"},
	{"violet",     "Violet",     "violet",    "#5D01AC"},
	{"dark_grey",  "Dark Grey",  "dark_grey",    "#3A3A3A"},
	{"dark_green", "Dark Green", "dark_green",    "#206400"},
	{"pink", "Pink", "pink",    "#FF8383"},
	{"brown", "Brown", "brown",    "#6D3800"},
DonBatman's avatar
DonBatman committed
48 49 50 51 52 53
}

for _, row in ipairs(tapestry.colours) do
	local name = row[1]
	local desc = row[2]
	local craft_color_group = row[3]
DonBatman's avatar
DonBatman committed
54
	local defcolor = row[4]
DonBatman's avatar
DonBatman committed
55
	-- Node Definition
DonBatman's avatar
DonBatman committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
  minetest.register_node("castle:tapestry_"..name, {
  drawtype = "nodebox",
  description = desc.." Tapestry",
  --uses default wool textures for tapestry material
  tiles = {"wool_"..name..".png^[transformR90"},
  --uses custom texture for tapestry material
  --tiles = {"castle_tapestry_overlay.png^[colorize:" .. defcolor ..":205"},
  groups = {oddly_breakable_by_hand=3,flammable=3},
  sounds = default.node_sound_defaults(),
  paramtype = "light",
  paramtype2 = "facedir",
  node_box = {
  type = "fixed",
  fixed = {
			    {-0.3125,-0.5,0.4375,-0.1875,-0.375,0.5},
			    {0.1875,-0.5,0.4375,0.3125,-0.375,0.5},
			    {-0.375,-0.375,0.4375,-0.125,-0.25,0.5},
			    {0.125,-0.375,0.4375,0.375,-0.25,0.5},
			    {-0.4375,-0.25,0.4375,-0.0625,-0.125,0.5},
			    {0.0625,-0.25,0.4375,0.4375,-0.125,0.5},
			    {-0.5,-0.125,0.4375,0.0,0.0,0.5},
			    {0.0,-0.125,0.4375,0.5,0.0,0.5},
			    {-0.5,0.0,0.4375,0.5,1.5,0.5},
DonBatman's avatar
DonBatman committed
79 80 81 82 83
		    },
	    },
	    selection_box = {
		    type = "fixed",
		    fixed = {
DonBatman's avatar
DonBatman committed
84 85
			    {-0.5,-0.5,0.4375,0.5,1.5,0.5},
		    },
DonBatman's avatar
DonBatman committed
86 87 88 89 90 91 92 93 94 95 96 97 98
	    },
	})
	if craft_color_group then
		-- Crafting from wool and a stick
		minetest.register_craft({
			type = "shapeless",
			output = 'castle:tapestry_'..name,
			recipe = {'wool:'..craft_color_group, 'default:stick'},
		})
	end
end

for _, row in ipairs(tapestry.colours) do
DonBatman's avatar
DonBatman committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
  local name = row[1]
  local desc = row[2]
  local craft_color_group = row[3]
  local defcolor = row[4]
  -- Node Definition
  minetest.register_node("castle:long_tapestry_"..name, {
  drawtype = "nodebox",
  description = desc.." Tapestry (Long)",
  --uses default wool textures for tapestry material
  tiles = {"wool_"..name..".png^[transformR90"},
  --uses custom texture for tapestry material
  --tiles = {"castle_tapestry_overlay.png^[colorize:" .. defcolor ..":205"},
  groups = {oddly_breakable_by_hand=3,flammable=3},
  sounds = default.node_sound_defaults(),
  paramtype = "light",
  paramtype2 = "facedir",
  node_box = {
DonBatman's avatar
DonBatman committed
116 117
		    type = "fixed",
		    fixed = {
DonBatman's avatar
DonBatman committed
118 119 120 121 122 123 124 125 126
			    {-0.3125,-0.5,0.4375,-0.1875,-0.375,0.5},
			    {0.1875,-0.5,0.4375,0.3125,-0.375,0.5},
			    {-0.375,-0.375,0.4375,-0.125,-0.25,0.5},
			    {0.125,-0.375,0.4375,0.375,-0.25,0.5},
			    {-0.4375,-0.25,0.4375,-0.0625,-0.125,0.5},
			    {0.0625,-0.25,0.4375,0.4375,-0.125,0.5},
			    {-0.5,-0.125,0.4375,0.0,0.0,0.5},
			    {0.0,-0.125,0.4375,0.5,0.0,0.5},
			    {-0.5,0.0,0.4375,0.5,2.5,0.5},
DonBatman's avatar
DonBatman committed
127 128 129 130 131
		    },
	    },
	    selection_box = {
		    type = "fixed",
		    fixed = {
DonBatman's avatar
DonBatman committed
132 133
			    {-0.5,-0.5,0.4375,0.5,2.5,0.5},
		    },
DonBatman's avatar
DonBatman committed
134 135 136 137 138 139 140 141 142 143 144 145 146
	    },
	})
	if craft_color_group then
		-- Crafting from normal tapestry and wool
		minetest.register_craft({
			type = "shapeless",
			output = 'castle:long_tapestry_'..name,
			recipe = {'wool:'..craft_color_group, 'castle:tapestry_'..name},
		})
	end
end

for _, row in ipairs(tapestry.colours) do
DonBatman's avatar
DonBatman committed
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
  local name = row[1]
  local desc = row[2]
  local craft_color_group = row[3]
 	local defcolor = row[4]
  -- Node Definition
  minetest.register_node("castle:very_long_tapestry_"..name, {
  drawtype = "nodebox",
  description = desc.." Tapestry (Very Long)",
  --uses default wool textures for tapestry material
  tiles = {"wool_"..name..".png^[transformR90"},
  --uses custom texture for tapestry material
  --tiles = {"castle_tapestry_overlay.png^[colorize:" .. defcolor ..":205"},
  groups = {oddly_breakable_by_hand=3,flammable=3},
  sounds = default.node_sound_defaults(),
  paramtype = "light",
  paramtype2 = "facedir",
  node_box = {
  type = "fixed",
  fixed = {
			    {-0.3125,-0.5,0.4375,-0.1875,-0.375,0.5},
			    {0.1875,-0.5,0.4375,0.3125,-0.375,0.5},
			    {-0.375,-0.375,0.4375,-0.125,-0.25,0.5},
			    {0.125,-0.375,0.4375,0.375,-0.25,0.5},
			    {-0.4375,-0.25,0.4375,-0.0625,-0.125,0.5},
			    {0.0625,-0.25,0.4375,0.4375,-0.125,0.5},
			    {-0.5,-0.125,0.4375,0.0,0.0,0.5},
			    {0.0,-0.125,0.4375,0.5,0.0,0.5},
			    {-0.5,0.0,0.4375,0.5,3.5,0.5},
DonBatman's avatar
DonBatman committed
175 176 177 178 179
		    },
	    },
	    selection_box = {
		    type = "fixed",
		    fixed = {
DonBatman's avatar
DonBatman committed
180 181
			    {-0.5,-0.5,0.4375,0.5,3.5,0.5},
		    },
DonBatman's avatar
DonBatman committed
182 183 184 185 186 187 188 189 190 191 192
	    },
	})
	if craft_color_group then
		-- Crafting from long tapestry and wool
		minetest.register_craft({
			type = "shapeless",
			output = 'castle:very_long_tapestry_'..name,
			recipe = {'wool:'..craft_color_group, 'castle:long_tapestry_'..name},
		})
	end
end