Add fuel slot to furnace listring
[oweals/minetest_game.git] / mods / dye / init.lua
1 -- Other mods can use these for looping through available colors
2
3 dye = {}
4 dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
5 dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow",
6         "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
7
8 -- Make dye names and descriptions available globally
9
10 dye.dyes = {
11         {"white",      "White"},
12         {"grey",       "Grey"},
13         {"dark_grey",  "Dark grey"},
14         {"black",      "Black"},
15         {"violet",     "Violet"},
16         {"blue",       "Blue"},
17         {"cyan",       "Cyan"},
18         {"dark_green", "Dark green"},
19         {"green",      "Green"},
20         {"yellow",     "Yellow"},
21         {"brown",      "Brown"},
22         {"orange",     "Orange"},
23         {"red",        "Red"},
24         {"magenta",    "Magenta"},
25         {"pink",       "Pink"},
26 }
27
28 -- This collection of colors is partly a historic thing, partly something else
29
30 local dyes = {
31         {"white",      "White dye",      {dye=1, basecolor_white=1,   excolor_white=1,      unicolor_white=1}},
32         {"grey",       "Grey dye",       {dye=1, basecolor_grey=1,    excolor_grey=1,       unicolor_grey=1}},
33         {"dark_grey",  "Dark grey dye",  {dye=1, basecolor_grey=1,    excolor_darkgrey=1,   unicolor_darkgrey=1}},
34         {"black",      "Black dye",      {dye=1, basecolor_black=1,   excolor_black=1,      unicolor_black=1}},
35         {"violet",     "Violet dye",     {dye=1, basecolor_magenta=1, excolor_violet=1,     unicolor_violet=1}},
36         {"blue",       "Blue dye",       {dye=1, basecolor_blue=1,    excolor_blue=1,       unicolor_blue=1}},
37         {"cyan",       "Cyan dye",       {dye=1, basecolor_cyan=1,    excolor_cyan=1,       unicolor_cyan=1}},
38         {"dark_green", "Dark green dye", {dye=1, basecolor_green=1,   excolor_green=1,      unicolor_dark_green=1}},
39         {"green",      "Green dye",      {dye=1, basecolor_green=1,   excolor_green=1,      unicolor_green=1}},
40         {"yellow",     "Yellow dye",     {dye=1, basecolor_yellow=1,  excolor_yellow=1,     unicolor_yellow=1}},
41         {"brown",      "Brown dye",      {dye=1, basecolor_brown=1,   excolor_orange=1,     unicolor_dark_orange=1}},
42         {"orange",     "Orange dye",     {dye=1, basecolor_orange=1,  excolor_orange=1,     unicolor_orange=1}},
43         {"red",        "Red dye",        {dye=1, basecolor_red=1,     excolor_red=1,        unicolor_red=1}},
44         {"magenta",    "Magenta dye",    {dye=1, basecolor_magenta=1, excolor_red_violet=1, unicolor_red_violet=1}},
45         {"pink",       "Pink dye",       {dye=1, basecolor_red=1,     excolor_red=1,        unicolor_light_red=1}},
46 }
47
48 -- Define items
49
50 for _, row in ipairs(dyes) do
51         local name = row[1]
52         local description = row[2]
53         local groups = row[3]
54         local item_name = "dye:" .. name
55         local item_image = "dye_" .. name .. ".png"
56         minetest.register_craftitem(item_name, {
57                 inventory_image = item_image,
58                 description = description,
59                 groups = groups
60         })
61         minetest.register_craft({
62                 type = "shapeless",
63                 output = item_name .. " 4",
64                 recipe = {"group:flower,color_" .. name},
65         })
66 end
67
68 -- Manually add coal->black dye
69
70 minetest.register_craft({
71         type = "shapeless",
72         output = "dye:black 4",
73         recipe = {"group:coal"},
74 })
75
76 -- Mix recipes
77 -- Just mix everything to everything somehow sanely
78
79 local mixbases = {"pink", "magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white"}
80
81 local mixes = {
82         --             pink,     magenta,  red,      orange,      brown,       yellow,      green,       dark_green,  cyan,   blue,    violet,  black,      dark_grey,  grey,  white
83         white      = {"pink",   "pink",   "pink",   "orange",    "orange",    "yellow",    "green",     "green",     "grey", "cyan",  "violet","grey",     "grey",     "grey","white"},
84         grey       = {"pink",   "pink",   "pink",   "orange",    "orange",    "yellow",    "green",     "green",     "grey", "cyan",  "violet","dark_grey","grey",     "grey"},
85         dark_grey  = {"brown",  "brown",  "brown",  "brown",     "brown",     "brown",     "dark_green","dark_green","blue", "blue",  "violet","black",    "dark_grey"},
86         black      = {"black",  "black",  "black",  "black",     "black",     "black",     "black",     "black",     "black","black", "black", "black"},
87         violet     = {"magenta","magenta","magenta","red",       "brown",     "red",       "cyan",      "brown",     "blue", "violet","violet"},
88         blue       = {"violet", "violet", "magenta","brown",     "brown",     "dark_green","cyan",      "cyan",      "cyan", "blue"},
89         cyan       = {"brown",  "blue",   "brown",  "dark_green","dark_grey", "green",     "cyan",      "dark_green","cyan"},
90         dark_green = {"brown",  "brown",  "brown",  "brown",     "brown",     "green",     "green",     "dark_green"},
91         green      = {"yellow", "brown",  "yellow", "yellow",    "dark_green","green",     "green"},
92         yellow     = {"orange", "red",    "orange", "yellow",    "orange",    "yellow"},
93         brown      = {"brown",  "brown",  "brown",  "orange",    "brown"},
94         orange     = {"orange", "red",    "orange", "orange"},
95         red        = {"pink",   "magenta","red"},
96         magenta    = {"magenta","magenta"},
97         pink       = {"pink"},
98 }
99
100 for one, results in pairs(mixes) do
101         for i, result in ipairs(results) do
102                 local another = mixbases[i]
103                 minetest.register_craft({
104                         type = "shapeless",
105                         output = 'dye:' .. result .. ' 2',
106                         recipe = {'dye:' .. one, 'dye:' .. another},
107                 })
108         end
109 end