wall.register: Allow table as texture value
[oweals/minetest_game.git] / mods / walls / init.lua
1 walls = {}
2
3 walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wall_sounds)
4         --make wall_texture_table paramenter backwards compatible for mods passing single texture
5         if type(wall_texture_table) ~= "table" then
6                 wall_texture_table = { wall_texture_table }
7         end
8         -- inventory node, and pole-type wall start item
9         minetest.register_node(wall_name, {
10                 description = wall_desc,
11                 drawtype = "nodebox",
12                 node_box = {
13                         type = "connected",
14                         fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}},
15                         -- connect_bottom =
16                         connect_front = {{-3/16, -1/2, -1/2,  3/16, 3/8, -1/4}},
17                         connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8,  3/16}},
18                         connect_back = {{-3/16, -1/2,  1/4,  3/16, 3/8,  1/2}},
19                         connect_right = {{ 1/4, -1/2, -3/16,  1/2, 3/8,  3/16}},
20                 },
21                 connects_to = { "group:wall", "group:stone", "group:fence" },
22                 paramtype = "light",
23                 is_ground_content = false,
24                 tiles = wall_texture_table,
25                 walkable = true,
26                 groups = { cracky = 3, wall = 1, stone = 2 },
27                 sounds = wall_sounds,
28         })
29
30         -- crafting recipe
31         minetest.register_craft({
32                 output = wall_name .. " 6",
33                 recipe = {
34                         { '', '', '' },
35                         { wall_mat, wall_mat, wall_mat},
36                         { wall_mat, wall_mat, wall_mat},
37                 }
38         })
39
40 end
41
42 walls.register("walls:cobble", "Cobblestone Wall", {"default_cobble.png"},
43                 "default:cobble", default.node_sound_stone_defaults())
44
45 walls.register("walls:mossycobble", "Mossy Cobblestone Wall", {"default_mossycobble.png"},
46                 "default:mossycobble", default.node_sound_stone_defaults())
47
48 walls.register("walls:desertcobble", "Desert Cobblestone Wall", {"default_desert_cobble.png"},
49                 "default:desert_cobble", default.node_sound_stone_defaults())
50