Default: Make some plant nodes non-flammable
[oweals/minetest_game.git] / mods / wool / init.lua
1 -- minetest/wool/init.lua
2
3 -- Backwards compatibility with jordach's 16-color wool mod
4 minetest.register_alias("wool:dark_blue", "wool:blue")
5 minetest.register_alias("wool:gold", "wool:yellow")
6
7 local wool = {}
8 -- This uses a trick: you can first define the recipes using all of the base
9 -- colors, and then some recipes using more specific colors for a few non-base
10 -- colors available. When crafting, the last recipes will be checked first.
11 wool.dyes = {
12         {"white",      "White",      "basecolor_white"},
13         {"grey",       "Grey",       "basecolor_grey"},
14         {"black",      "Black",      "basecolor_black"},
15         {"red",        "Red",        "basecolor_red"},
16         {"yellow",     "Yellow",     "basecolor_yellow"},
17         {"green",      "Green",      "basecolor_green"},
18         {"cyan",       "Cyan",       "basecolor_cyan"},
19         {"blue",       "Blue",       "basecolor_blue"},
20         {"magenta",    "Magenta",    "basecolor_magenta"},
21         {"orange",     "Orange",     "excolor_orange"},
22         {"violet",     "Violet",     "excolor_violet"},
23         {"brown",      "Brown",      "unicolor_dark_orange"},
24         {"pink",       "Pink",       "unicolor_light_red"},
25         {"dark_grey",  "Dark Grey",  "unicolor_darkgrey"},
26         {"dark_green", "Dark Green", "unicolor_dark_green"},
27 }
28
29 for _, row in ipairs(wool.dyes) do
30         local name = row[1]
31         local desc = row[2]
32         local craft_color_group = row[3]
33         -- Node Definition
34         minetest.register_node("wool:"..name, {
35                 description = desc.." Wool",
36                 tiles = {"wool_"..name..".png"},
37                 is_ground_content = false,
38                 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,wool=1},
39                 sounds = default.node_sound_defaults(),
40         })
41         if craft_color_group then
42                 -- Crafting from dye and white wool
43                 minetest.register_craft({
44                         type = "shapeless",
45                         output = 'wool:'..name,
46                         recipe = {'group:dye,'..craft_color_group, 'group:wool'},
47                 })
48         end
49 end
50