summaryrefslogtreecommitdiff
path: root/castle/tapestry.lua
blob: 845fb7a2f8331facf47f0ab8fe06d518c7396112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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
175
176
177
178
179
180
local tapestry = {}

minetest.register_node("castle:tapestry_top", {
	drawtype = "nodebox",
         description = "Tapestry Top",
	tiles = {"default_wood.png"},
	sunlight_propagates = true,
	groups = {flammable=3,oddly_breakable_by_hand=1},
	sounds = default.node_sound_defaults(),
	paramtype = "light",
	paramtype2 = "facedir",
	node_box = {
		type = "fixed",
		fixed = {
			{-0.600000,-0.500000,0.375000,0.600000,-0.375000,0.500000},
		},
	},
	selection_box = {
		type = "fixed",
		fixed = {
			{-0.600000,-0.500000,0.375000,0.600000,-0.375000,0.500000}, 
		},
	},
})

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

tapestry.colours = {
	{"white",      "White",      "white"},
	{"grey",       "Grey",       "grey"},
	{"black",      "Black",      "black"},
	{"red",        "Red",        "red"},
	{"yellow",     "Yellow",     "yellow"},
	{"green",      "Green",      "green"},
	{"cyan",       "Cyan",       "cyan"},
	{"blue",       "Blue",       "blue"},
	{"magenta",    "Magenta",    "magenta"},
	{"orange",     "Orange",     "orange"},
	{"violet",     "Violet",     "violet"},
	{"dark_grey",  "Dark Grey",  "dark_grey"},
	{"dark_green", "Dark Green", "dark_green"},
	{"pink", "Pink", "pink"},
	{"brown", "Brown", "brown"},
}

for _, row in ipairs(tapestry.colours) do
	local name = row[1]
	local desc = row[2]
	local craft_color_group = row[3]
	-- Node Definition
	minetest.register_node("castle:tapestry_"..name, {
	         drawtype = "nodebox",
		description = desc.." Tapestry",
		tiles = {"wool_"..name..".png"},
		groups = {oddly_breakable_by_hand=3,flammable=3,not_in_creative_inventory=1},
		sounds = default.node_sound_defaults(),
	         paramtype = "light",
	         paramtype2 = "facedir",
		node_box = {
		    type = "fixed",
		    fixed = {
			    {-0.312500,-0.500000,0.437500,-0.187500,-0.375000,0.500000}, 
			    {0.187500,-0.500000,0.437500,0.312500,-0.375000,0.500000}, 
			    {-0.375000,-0.375000,0.437500,-0.125000,-0.250000,0.500000}, 
			    {0.125000,-0.375000,0.437500,0.375000,-0.250000,0.500000}, 
			    {-0.437500,-0.250000,0.437500,-0.062500,-0.125000,0.500000}, 
			    {0.062500,-0.250000,0.437500,0.437500,-0.125000,0.500000}, 
			    {-0.500000,-0.125000,0.437500,0.000000,0.000000,0.500000}, 
			    {0.000000,-0.125000,0.437500,0.500000,0.000000,0.500000}, 
			    {-0.500000,0.000000,0.437500,0.500000,1.500000,0.500000},
		    },
	    },
	    selection_box = {
		    type = "fixed",
		    fixed = {
			    {-0.500000,-0.500000,0.437500,0.500000,1.500000,0.500000},
		    },		
	    },
	})
	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
	local name = row[1]
	local desc = row[2]
	local craft_color_group = row[3]
	-- Node Definition
	minetest.register_node("castle:long_tapestry_"..name, {
	         drawtype = "nodebox",
		description = desc.." Tapestry (Long)",
		tiles = {"wool_"..name..".png"},
		groups = {oddly_breakable_by_hand=3,flammable=3,not_in_creative_inventory=1},
		sounds = default.node_sound_defaults(),
	         paramtype = "light",
	         paramtype2 = "facedir",
		node_box = {
		    type = "fixed",
		    fixed = {
			    {-0.312500,-0.500000,0.437500,-0.187500,-0.375000,0.500000}, 
			    {0.187500,-0.500000,0.437500,0.312500,-0.375000,0.500000}, 
			    {-0.375000,-0.375000,0.437500,-0.125000,-0.250000,0.500000}, 
			    {0.125000,-0.375000,0.437500,0.375000,-0.250000,0.500000}, 
			    {-0.437500,-0.250000,0.437500,-0.062500,-0.125000,0.500000}, 
			    {0.062500,-0.250000,0.437500,0.437500,-0.125000,0.500000}, 
			    {-0.500000,-0.125000,0.437500,0.000000,0.000000,0.500000}, 
			    {0.000000,-0.125000,0.437500,0.500000,0.000000,0.500000}, 
			    {-0.500000,0.000000,0.437500,0.500000,2.500000,0.500000},
		    },
	    },
	    selection_box = {
		    type = "fixed",
		    fixed = {
			    {-0.500000,-0.500000,0.437500,0.500000,2.500000,0.500000},
		    },		
	    },
	})
	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
	local name = row[1]
	local desc = row[2]
	local craft_color_group = row[3]
	-- Node Definition
	minetest.register_node("castle:very_long_tapestry_"..name, {
	         drawtype = "nodebox",
		description = desc.." Tapestry (Very Long)",
		tiles = {"wool_"..name..".png"},
		groups = {oddly_breakable_by_hand=3,flammable=3,not_in_creative_inventory=1},
		sounds = default.node_sound_defaults(),
	         paramtype = "light",
	         paramtype2 = "facedir",
		node_box = {
		    type = "fixed",
		    fixed = {
			    {-0.312500,-0.500000,0.437500,-0.187500,-0.375000,0.500000}, 
			    {0.187500,-0.500000,0.437500,0.312500,-0.375000,0.500000}, 
			    {-0.375000,-0.375000,0.437500,-0.125000,-0.250000,0.500000}, 
			    {0.125000,-0.375000,0.437500,0.375000,-0.250000,0.500000}, 
			    {-0.437500,-0.250000,0.437500,-0.062500,-0.125000,0.500000}, 
			    {0.062500,-0.250000,0.437500,0.437500,-0.125000,0.500000}, 
			    {-0.500000,-0.125000,0.437500,0.000000,0.000000,0.500000}, 
			    {0.000000,-0.125000,0.437500,0.500000,0.000000,0.500000}, 
			    {-0.500000,0.000000,0.437500,0.500000,3.500000,0.500000},
		    },
	    },
	    selection_box = {
		    type = "fixed",
		    fixed = {
			    {-0.500000,-0.500000,0.437500,0.500000,3.500000,0.500000},
		    },		
	    },
	})
	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