Stairs and slabs
[oweals/minetest_game.git] / mods / stairs / init.lua
1 -- Minetest 0.4 mod: stairs
2 -- See README.txt for licensing and other information.
3
4 stairs = {}
5
6 -- Node will be called stairs:stair_<subname>
7 function stairs.register_stair(subname, recipeitem, groups, images, description)
8         minetest.register_node("stairs:stair_" .. subname, {
9                 description = description,
10                 drawtype = "nodebox",
11                 tiles = images,
12                 paramtype = "light",
13                 paramtype2 = "facedir",
14                 is_ground_content = true,
15                 groups = groups,
16                 node_box = {
17                         type = "fixed",
18                         fixed = {
19                                 {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
20                                 {-0.5, 0, 0, 0.5, 0.5, 0.5},
21                         },
22                 },
23         })
24
25         minetest.register_craft({
26                 output = 'stairs:stair_' .. subname .. ' 4',
27                 recipe = {
28                         {recipeitem, "", ""},
29                         {recipeitem, recipeitem, ""},
30                         {recipeitem, recipeitem, recipeitem},
31                 },
32         })
33 end
34
35 -- Node will be called stairs:slab_<subname>
36 function stairs.register_slab(subname, recipeitem, groups, images, description)
37         minetest.register_node("stairs:slab_" .. subname, {
38                 description = description,
39                 drawtype = "nodebox",
40                 tiles = images,
41                 paramtype = "light",
42                 is_ground_content = true,
43                 groups = groups,
44                 node_box = {
45                         type = "fixed",
46                         fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
47                 },
48                 selection_box = {
49                         type = "fixed",
50                         fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
51                 },
52         })
53
54         minetest.register_craft({
55                 output = 'stairs:slab_' .. subname .. ' 3',
56                 recipe = {
57                         {recipeitem, recipeitem, recipeitem},
58                 },
59         })
60 end
61
62 -- Nodes will be called stairs:{stair,slab}_<subname>
63 function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab)
64         stairs.register_stair(subname, recipeitem, groups, images, desc_stair)
65         stairs.register_slab(subname, recipeitem, groups, images, desc_slab)
66 end
67
68 stairs.register_stair_and_slab("wood", "default:wood",
69                 {snappy=2,choppy=2,oddly_breakable_by_hand=2},
70                 {"default_wood.png"},
71                 "Wooden stair",
72                 "Wooden slab")
73
74 stairs.register_stair_and_slab("stone", "default:stone",
75                 {cracky=3},
76                 {"default_stone.png"},
77                 "Stone stair",
78                 "Stone slab")
79
80 stairs.register_stair_and_slab("cobble", "default:cobble",
81                 {cracky=3},
82                 {"default_cobble.png"},
83                 "Cobble stair",
84                 "Cobble slab")
85
86 stairs.register_stair_and_slab("brick", "default:brick",
87                 {cracky=3},
88                 {"default_brick.png"},
89                 "Brick stair",
90                 "Brick slab")
91
92 stairs.register_stair_and_slab("sandstone", "default:sandstone",
93                 {crumbly=2,cracky=2},
94                 {"default_sandstone.png"},
95                 "Sandstone stair",
96                 "Sandstone slab")