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
1
-- This uses a trick: you can first define the recipes using all of the base
9
2
-- colors, and then some recipes using more specific colors for a few non-base
10
3
-- colors available. When crafting, the last recipes will be checked first.
11
- wool .dyes = {
4
+
5
+ local dyes = {
12
6
{" white" , " White" , " basecolor_white" },
13
7
{" grey" , " Grey" , " basecolor_grey" },
14
8
{" black" , " Black" , " basecolor_black" },
@@ -26,25 +20,28 @@ wool.dyes = {
26
20
{" dark_green" , " Dark Green" , " unicolor_dark_green" },
27
21
}
28
22
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" },
23
+ for i = 1 , # dyes do
24
+ local name , desc , craft_color_group = unpack (dyes [i ])
25
+
26
+ minetest .register_node (" wool:" .. name , {
27
+ description = desc .. " Wool" ,
28
+ tiles = {" wool_" .. name .. " .png" },
37
29
is_ground_content = false ,
38
- groups = {snappy = 2 ,choppy = 2 ,oddly_breakable_by_hand = 3 ,flammable = 3 ,wool = 1 },
30
+ groups = {snappy = 2 , choppy = 2 , oddly_breakable_by_hand = 3 ,
31
+ flammable = 3 , wool = 1 },
39
32
sounds = default .node_sound_defaults (),
40
33
})
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
34
+
35
+ minetest .register_craft {
36
+ type = " shapeless" ,
37
+ output = " wool:" .. name ,
38
+ recipe = {" group:dye," .. craft_color_group , " group:wool" },
39
+ }
49
40
end
50
41
42
+
43
+ -- legacy
44
+
45
+ -- Backwards compatibility with jordach's 16-color wool mod
46
+ minetest .register_alias (" wool:dark_blue" , " wool:blue" )
47
+ minetest .register_alias (" wool:gold" , " wool:yellow" )
0 commit comments