Correct farming/stairs dependency (#1838)
[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
5 -- Global namespace for functions
6
7 stairs = {}
8
9
10 -- Register aliases for new pine node names
11
12 minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood")
13 minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
14
15
16 -- Get setting for replace ABM
17
18 local replace = minetest.settings:get_bool("enable_stairs_replace_abm")
19
20 local function rotate_and_place(itemstack, placer, pointed_thing)
21         local p0 = pointed_thing.under
22         local p1 = pointed_thing.above
23         local param2 = 0
24
25         local placer_pos = placer:getpos()
26         if placer_pos then
27                 param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
28         end
29
30         local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
31         local fpos = finepos.y % 1
32
33         if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
34                         or (fpos < -0.5 and fpos > -0.999999999) then
35                 param2 = param2 + 20
36                 if param2 == 21 then
37                         param2 = 23
38                 elseif param2 == 23 then
39                         param2 = 21
40                 end
41         end
42         return minetest.item_place(itemstack, placer, pointed_thing, param2)
43 end
44
45 -- Register stairs.
46 -- Node will be called stairs:stair_<subname>
47
48 function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
49         local stair_images = {}
50         for i, image in ipairs(images) do
51                 if type(image) == "string" then
52                         stair_images[i] = {
53                                 name = image,
54                                 backface_culling = true,
55                         }
56                 elseif image.backface_culling == nil then -- override using any other value
57                         stair_images[i] = table.copy(image)
58                         stair_images[i].backface_culling = true
59                 end
60         end
61         groups.stair = 1
62         minetest.register_node(":stairs:stair_" .. subname, {
63                 description = description,
64                 drawtype = "mesh",
65                 mesh = "stairs_stair.obj",
66                 tiles = stair_images,
67                 paramtype = "light",
68                 paramtype2 = "facedir",
69                 is_ground_content = false,
70                 groups = groups,
71                 sounds = sounds,
72                 selection_box = {
73                         type = "fixed",
74                         fixed = {
75                                 {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
76                                 {-0.5, 0, 0, 0.5, 0.5, 0.5},
77                         },
78                 },
79                 collision_box = {
80                         type = "fixed",
81                         fixed = {
82                                 {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
83                                 {-0.5, 0, 0, 0.5, 0.5, 0.5},
84                         },
85                 },
86                 on_place = function(itemstack, placer, pointed_thing)
87                         if pointed_thing.type ~= "node" then
88                                 return itemstack
89                         end
90
91                         return rotate_and_place(itemstack, placer, pointed_thing)
92                 end,
93         })
94
95         -- for replace ABM
96         if replace then
97                 minetest.register_node(":stairs:stair_" .. subname .. "upside_down", {
98                         replace_name = "stairs:stair_" .. subname,
99                         groups = {slabs_replace = 1},
100                 })
101         end
102
103         if recipeitem then
104                 -- Recipe matches appearence in inventory
105                 minetest.register_craft({
106                         output = 'stairs:stair_' .. subname .. ' 8',
107                         recipe = {
108                                 {"", "", recipeitem},
109                                 {"", recipeitem, recipeitem},
110                                 {recipeitem, recipeitem, recipeitem},
111                         },
112                 })
113
114                 -- Use stairs to craft full blocks again (1:1)
115                 minetest.register_craft({
116                         output = recipeitem .. ' 3',
117                         recipe = {
118                                 {'stairs:stair_' .. subname, 'stairs:stair_' .. subname},
119                                 {'stairs:stair_' .. subname, 'stairs:stair_' .. subname},
120                         },
121                 })
122
123                 -- Fuel
124                 local baseburntime = minetest.get_craft_result({
125                         method = "fuel",
126                         width = 1,
127                         items = {recipeitem}
128                 }).time
129                 if baseburntime > 0 then
130                         minetest.register_craft({
131                                 type = "fuel",
132                                 recipe = 'stairs:stair_' .. subname,
133                                 burntime = math.floor(baseburntime * 0.75),
134                         })
135                 end
136         end
137 end
138
139
140 -- Slab facedir to placement 6d matching table
141 local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
142
143 -- Register slabs.
144 -- Node will be called stairs:slab_<subname>
145
146 function stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
147         groups.slab = 1
148         minetest.register_node(":stairs:slab_" .. subname, {
149                 description = description,
150                 drawtype = "nodebox",
151                 tiles = images,
152                 paramtype = "light",
153                 paramtype2 = "facedir",
154                 is_ground_content = false,
155                 groups = groups,
156                 sounds = sounds,
157                 node_box = {
158                         type = "fixed",
159                         fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
160                 },
161                 on_place = function(itemstack, placer, pointed_thing)
162                         local under = minetest.get_node(pointed_thing.under)
163                         local wield_item = itemstack:get_name()
164                         local creative_enabled = (creative and creative.is_enabled_for
165                                         and creative.is_enabled_for(placer:get_player_name()))
166
167                         if under and under.name:find("stairs:slab_") then
168                                 -- place slab using under node orientation
169                                 local dir = minetest.dir_to_facedir(vector.subtract(
170                                         pointed_thing.above, pointed_thing.under), true)
171
172                                 local p2 = under.param2
173
174                                 -- combine two slabs if possible
175                                 if slab_trans_dir[math.floor(p2 / 4)] == dir
176                                                 and wield_item == under.name then
177
178                                         if not recipeitem then
179                                                 return itemstack
180                                         end
181                                         local player_name = placer:get_player_name()
182                                         if minetest.is_protected(pointed_thing.under, player_name) and not
183                                                         minetest.check_player_privs(placer, "protection_bypass") then
184                                                 minetest.record_protection_violation(pointed_thing.under,
185                                                         player_name)
186                                                 return
187                                         end
188                                         minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2})
189                                         if not creative_enabled then
190                                                 itemstack:take_item()
191                                         end
192                                         return itemstack
193                                 end
194
195                                 -- Placing a slab on an upside down slab should make it right-side up.
196                                 if p2 >= 20 and dir == 8 then
197                                         p2 = p2 - 20
198                                 -- same for the opposite case: slab below normal slab
199                                 elseif p2 <= 3 and dir == 4 then
200                                         p2 = p2 + 20
201                                 end
202
203                                 -- else attempt to place node with proper param2
204                                 minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
205                                 if not creative_enabled then
206                                         itemstack:take_item()
207                                 end
208                                 return itemstack
209                         else
210                                 return rotate_and_place(itemstack, placer, pointed_thing)
211                         end
212                 end,
213         })
214
215         -- for replace ABM
216         if replace then
217                 minetest.register_node(":stairs:slab_" .. subname .. "upside_down", {
218                         replace_name = "stairs:slab_".. subname,
219                         groups = {slabs_replace = 1},
220                 })
221         end
222
223         if recipeitem then
224                 minetest.register_craft({
225                         output = 'stairs:slab_' .. subname .. ' 6',
226                         recipe = {
227                                 {recipeitem, recipeitem, recipeitem},
228                         },
229                 })
230
231                 -- Use 2 slabs to craft a full block again (1:1)
232                 minetest.register_craft({
233                         output = recipeitem,
234                         recipe = {
235                                 {'stairs:slab_' .. subname},
236                                 {'stairs:slab_' .. subname},
237                         },
238                 })
239
240                 -- Fuel
241                 local baseburntime = minetest.get_craft_result({
242                         method = "fuel",
243                         width = 1,
244                         items = {recipeitem}
245                 }).time
246                 if baseburntime > 0 then
247                         minetest.register_craft({
248                                 type = "fuel",
249                                 recipe = 'stairs:slab_' .. subname,
250                                 burntime = math.floor(baseburntime * 0.5),
251                         })
252                 end
253         end
254 end
255
256
257 -- Optionally replace old "upside_down" nodes with new param2 versions.
258 -- Disabled by default.
259
260 if replace then
261         minetest.register_abm({
262                 label = "Slab replace",
263                 nodenames = {"group:slabs_replace"},
264                 interval = 16,
265                 chance = 1,
266                 action = function(pos, node)
267                         node.name = minetest.registered_nodes[node.name].replace_name
268                         node.param2 = node.param2 + 20
269                         if node.param2 == 21 then
270                                 node.param2 = 23
271                         elseif node.param2 == 23 then
272                                 node.param2 = 21
273                         end
274                         minetest.set_node(pos, node)
275                 end,
276         })
277 end
278
279 -- Register stairs.
280 -- Node will be called stairs:stair_inner_<subname>
281
282 function stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds)
283         local stair_images = {}
284         for i, image in ipairs(images) do
285                 if type(image) == "string" then
286                         stair_images[i] = {
287                                 name = image,
288                                 backface_culling = true,
289                         }
290                 elseif image.backface_culling == nil then -- override using any other value
291                         stair_images[i] = table.copy(image)
292                         stair_images[i].backface_culling = true
293                 end
294         end
295         groups.stair = 1
296         minetest.register_node(":stairs:stair_inner_" .. subname, {
297                 description = description .. " Inner",
298                 drawtype = "mesh",
299                 mesh = "stairs_stair_inner.obj",
300                 tiles = stair_images,
301                 paramtype = "light",
302                 paramtype2 = "facedir",
303                 is_ground_content = false,
304                 groups = groups,
305                 sounds = sounds,
306                 selection_box = {
307                         type = "fixed",
308                         fixed = {
309                                 {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
310                                 {-0.5, 0, 0, 0.5, 0.5, 0.5},
311                                 {-0.5, 0, -0.5, 0, 0.5, 0},
312                         },
313                 },
314                 collision_box = {
315                         type = "fixed",
316                         fixed = {
317                                 {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
318                                 {-0.5, 0, 0, 0.5, 0.5, 0.5},
319                                 {-0.5, 0, -0.5, 0, 0.5, 0},
320                         },
321                 },
322                 on_place = function(itemstack, placer, pointed_thing)
323                         if pointed_thing.type ~= "node" then
324                                 return itemstack
325                         end
326
327                         return rotate_and_place(itemstack, placer, pointed_thing)
328                 end,
329         })
330
331         if recipeitem then
332                 minetest.register_craft({
333                         output = 'stairs:stair_inner_' .. subname .. ' 7',
334                         recipe = {
335                                 { "", recipeitem, ""},
336                                 { recipeitem, "", recipeitem},
337                                 {recipeitem, recipeitem, recipeitem},
338                         },
339                 })
340
341                 -- Fuel
342                 local baseburntime = minetest.get_craft_result({
343                         method = "fuel",
344                         width = 1,
345                         items = {recipeitem}
346                 }).time
347                 if baseburntime > 0 then
348                         minetest.register_craft({
349                                 type = "fuel",
350                                 recipe = 'stairs:stair_inner_' .. subname,
351                                 burntime = math.floor(baseburntime * 0.875),
352                         })
353                 end
354         end
355 end
356
357 -- Register stairs.
358 -- Node will be called stairs:stair_outer_<subname>
359
360 function stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds)
361         local stair_images = {}
362         for i, image in ipairs(images) do
363                 if type(image) == "string" then
364                         stair_images[i] = {
365                                 name = image,
366                                 backface_culling = true,
367                         }
368                 elseif image.backface_culling == nil then -- override using any other value
369                         stair_images[i] = table.copy(image)
370                         stair_images[i].backface_culling = true
371                 end
372         end
373         groups.stair = 1
374         minetest.register_node(":stairs:stair_outer_" .. subname, {
375                 description = description .. " Outer",
376                 drawtype = "mesh",
377                 mesh = "stairs_stair_outer.obj",
378                 tiles = stair_images,
379                 paramtype = "light",
380                 paramtype2 = "facedir",
381                 is_ground_content = false,
382                 groups = groups,
383                 sounds = sounds,
384                 selection_box = {
385                         type = "fixed",
386                         fixed = {
387                                 {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
388                                 {-0.5, 0, 0, 0, 0.5, 0.5},
389                         },
390                 },
391                 collision_box = {
392                         type = "fixed",
393                         fixed = {
394                                 {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
395                                 {-0.5, 0, 0, 0, 0.5, 0.5},
396                         },
397                 },
398                 on_place = function(itemstack, placer, pointed_thing)
399                         if pointed_thing.type ~= "node" then
400                                 return itemstack
401                         end
402
403                         return rotate_and_place(itemstack, placer, pointed_thing)
404                 end,
405         })
406
407         if recipeitem then
408                 minetest.register_craft({
409                         output = 'stairs:stair_outer_' .. subname .. ' 6',
410                         recipe = {
411                                 { "", "", ""},
412                                 { "", recipeitem, ""},
413                                 {recipeitem, recipeitem, recipeitem},
414                         },
415                 })
416
417                 -- Fuel
418                 local baseburntime = minetest.get_craft_result({
419                         method = "fuel",
420                         width = 1,
421                         items = {recipeitem}
422                 }).time
423                 if baseburntime > 0 then
424                         minetest.register_craft({
425                                 type = "fuel",
426                                 recipe = 'stairs:stair_outer_' .. subname,
427                                 burntime = math.floor(baseburntime * 0.625),
428                         })
429                 end
430         end
431 end
432
433 -- Stair/slab registration function.
434 -- Nodes will be called stairs:{stair,slab}_<subname>
435
436 function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
437         stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
438         stairs.register_stair_inner(subname, recipeitem, groups, images, desc_stair, sounds)
439         stairs.register_stair_outer(subname, recipeitem, groups, images, desc_stair, sounds)
440         stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds)
441 end
442
443 -- Register default stairs and slabs
444
445 stairs.register_stair_and_slab(
446         "wood",
447         "default:wood",
448         {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
449         {"default_wood.png"},
450         "Wooden Stair",
451         "Wooden Slab",
452         default.node_sound_wood_defaults()
453 )
454
455 stairs.register_stair_and_slab(
456         "junglewood",
457         "default:junglewood",
458         {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
459         {"default_junglewood.png"},
460         "Jungle Wood Stair",
461         "Jungle Wood Slab",
462         default.node_sound_wood_defaults()
463 )
464
465 stairs.register_stair_and_slab(
466         "pine_wood",
467         "default:pine_wood",
468         {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
469         {"default_pine_wood.png"},
470         "Pine Wood Stair",
471         "Pine Wood Slab",
472         default.node_sound_wood_defaults()
473 )
474
475 stairs.register_stair_and_slab(
476         "acacia_wood",
477         "default:acacia_wood",
478         {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
479         {"default_acacia_wood.png"},
480         "Acacia Wood Stair",
481         "Acacia Wood Slab",
482         default.node_sound_wood_defaults()
483 )
484
485 stairs.register_stair_and_slab(
486         "aspen_wood",
487         "default:aspen_wood",
488         {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
489         {"default_aspen_wood.png"},
490         "Aspen Wood Stair",
491         "Aspen Wood Slab",
492         default.node_sound_wood_defaults()
493 )
494
495 stairs.register_stair_and_slab(
496         "stone",
497         "default:stone",
498         {cracky = 3},
499         {"default_stone.png"},
500         "Stone Stair",
501         "Stone Slab",
502         default.node_sound_stone_defaults()
503 )
504
505 stairs.register_stair_and_slab(
506         "cobble",
507         "default:cobble",
508         {cracky = 3},
509         {"default_cobble.png"},
510         "Cobblestone Stair",
511         "Cobblestone Slab",
512         default.node_sound_stone_defaults()
513 )
514
515 stairs.register_stair_and_slab(
516         "mossycobble",
517         "default:mossycobble",
518         {cracky = 3},
519         {"default_mossycobble.png"},
520         "Mossy Cobblestone Stair",
521         "Mossy Cobblestone Slab",
522         default.node_sound_stone_defaults()
523 )
524
525 stairs.register_stair_and_slab(
526         "stonebrick",
527         "default:stonebrick",
528         {cracky = 2},
529         {"default_stone_brick.png"},
530         "Stone Brick Stair",
531         "Stone Brick Slab",
532         default.node_sound_stone_defaults()
533 )
534
535 stairs.register_stair_and_slab(
536         "stone_block",
537         "default:stone_block",
538         {cracky = 2},
539         {"default_stone_block.png"},
540         "Stone Block Stair",
541         "Stone Block Slab",
542         default.node_sound_stone_defaults()
543 )
544
545 stairs.register_stair_and_slab(
546         "desert_stone",
547         "default:desert_stone",
548         {cracky = 3},
549         {"default_desert_stone.png"},
550         "Desert Stone Stair",
551         "Desert Stone Slab",
552         default.node_sound_stone_defaults()
553 )
554
555 stairs.register_stair_and_slab(
556         "desert_cobble",
557         "default:desert_cobble",
558         {cracky = 3},
559         {"default_desert_cobble.png"},
560         "Desert Cobblestone Stair",
561         "Desert Cobblestone Slab",
562         default.node_sound_stone_defaults()
563 )
564
565 stairs.register_stair_and_slab(
566         "desert_stonebrick",
567         "default:desert_stonebrick",
568         {cracky = 2},
569         {"default_desert_stone_brick.png"},
570         "Desert Stone Brick Stair",
571         "Desert Stone Brick Slab",
572         default.node_sound_stone_defaults()
573 )
574
575 stairs.register_stair_and_slab(
576         "desert_stone_block",
577         "default:desert_stone_block",
578         {cracky = 2},
579         {"default_desert_stone_block.png"},
580         "Desert Stone Block Stair",
581         "Desert Stone Block Slab",
582         default.node_sound_stone_defaults()
583 )
584
585 stairs.register_stair_and_slab(
586         "sandstone",
587         "default:sandstone",
588         {crumbly = 1, cracky = 3},
589         {"default_sandstone.png"},
590         "Sandstone Stair",
591         "Sandstone Slab",
592         default.node_sound_stone_defaults()
593 )
594
595 stairs.register_stair_and_slab(
596         "sandstonebrick",
597         "default:sandstonebrick",
598         {cracky = 2},
599         {"default_sandstone_brick.png"},
600         "Sandstone Brick Stair",
601         "Sandstone Brick Slab",
602         default.node_sound_stone_defaults()
603 )
604
605 stairs.register_stair_and_slab(
606         "sandstone_block",
607         "default:sandstone_block",
608         {cracky = 2},
609         {"default_sandstone_block.png"},
610         "Sandstone Block Stair",
611         "Sandstone Block Slab",
612         default.node_sound_stone_defaults()
613 )
614
615 stairs.register_stair_and_slab(
616         "desert_sandstone",
617         "default:desert_sandstone",
618         {crumbly = 1, cracky = 3},
619         {"default_desert_sandstone.png"},
620         "Desert Sandstone Stair",
621         "Desert Sandstone Slab",
622         default.node_sound_stone_defaults()
623 )
624
625 stairs.register_stair_and_slab(
626         "desert_sandstone_brick",
627         "default:desert_sandstone_brick",
628         {cracky = 2},
629         {"default_desert_sandstone_brick.png"},
630         "Desert Sandstone Brick Stair",
631         "Desert Sandstone Brick Slab",
632         default.node_sound_stone_defaults()
633 )
634
635 stairs.register_stair_and_slab(
636         "desert_sandstone_block",
637         "default:desert_sandstone_block",
638         {cracky = 2},
639         {"default_desert_sandstone_block.png"},
640         "Desert Sandstone Block Stair",
641         "Desert Sandstone Block Slab",
642         default.node_sound_stone_defaults()
643 )
644
645 stairs.register_stair_and_slab(
646         "silver_sandstone",
647         "default:silver_sandstone",
648         {crumbly = 1, cracky = 3},
649         {"default_silver_sandstone.png"},
650         "Silver Sandstone Stair",
651         "Silver Sandstone Slab",
652         default.node_sound_stone_defaults()
653 )
654
655 stairs.register_stair_and_slab(
656         "silver_sandstone_brick",
657         "default:silver_sandstone_brick",
658         {cracky = 2},
659         {"default_silver_sandstone_brick.png"},
660         "Silver Sandstone Brick Stair",
661         "Silver Sandstone Brick Slab",
662         default.node_sound_stone_defaults()
663 )
664
665 stairs.register_stair_and_slab(
666         "silver_sandstone_block",
667         "default:silver_sandstone_block",
668         {cracky = 2},
669         {"default_silver_sandstone_block.png"},
670         "Silver Sandstone Block Stair",
671         "Silver Sandstone Block Slab",
672         default.node_sound_stone_defaults()
673 )
674
675 stairs.register_stair_and_slab(
676         "obsidian",
677         "default:obsidian",
678         {cracky = 1, level = 2},
679         {"default_obsidian.png"},
680         "Obsidian Stair",
681         "Obsidian Slab",
682         default.node_sound_stone_defaults()
683 )
684
685 stairs.register_stair_and_slab(
686         "obsidianbrick",
687         "default:obsidianbrick",
688         {cracky = 1, level = 2},
689         {"default_obsidian_brick.png"},
690         "Obsidian Brick Stair",
691         "Obsidian Brick Slab",
692         default.node_sound_stone_defaults()
693 )
694
695 stairs.register_stair_and_slab(
696         "obsidian_block",
697         "default:obsidian_block",
698         {cracky = 1, level = 2},
699         {"default_obsidian_block.png"},
700         "Obsidian Block Stair",
701         "Obsidian Block Slab",
702         default.node_sound_stone_defaults()
703 )
704
705 stairs.register_stair_and_slab(
706         "brick",
707         "default:brick",
708         {cracky = 3},
709         {"default_brick.png"},
710         "Brick Stair",
711         "Brick Slab",
712         default.node_sound_stone_defaults()
713 )
714
715 stairs.register_stair_and_slab(
716         "steelblock",
717         "default:steelblock",
718         {cracky = 1, level = 2},
719         {"default_steel_block.png"},
720         "Steel Block Stair",
721         "Steel Block Slab",
722         default.node_sound_metal_defaults()
723 )
724
725 stairs.register_stair_and_slab(
726         "tinblock",
727         "default:tinblock",
728         {cracky = 1, level = 2},
729         {"default_tin_block.png"},
730         "Tin Block Stair",
731         "Tin Block Slab",
732         default.node_sound_metal_defaults()
733 )
734
735 stairs.register_stair_and_slab(
736         "copperblock",
737         "default:copperblock",
738         {cracky = 1, level = 2},
739         {"default_copper_block.png"},
740         "Copper Block Stair",
741         "Copper Block Slab",
742         default.node_sound_metal_defaults()
743 )
744
745 stairs.register_stair_and_slab(
746         "bronzeblock",
747         "default:bronzeblock",
748         {cracky = 1, level = 2},
749         {"default_bronze_block.png"},
750         "Bronze Block Stair",
751         "Bronze Block Slab",
752         default.node_sound_metal_defaults()
753 )
754
755 stairs.register_stair_and_slab(
756         "goldblock",
757         "default:goldblock",
758         {cracky = 1},
759         {"default_gold_block.png"},
760         "Gold Block Stair",
761         "Gold Block Slab",
762         default.node_sound_metal_defaults()
763 )
764
765 stairs.register_stair_and_slab(
766         "ice",
767         "default:ice",
768         {cracky = 3, puts_out_fire = 1, cools_lava = 1},
769         {"default_ice.png"},
770         "Ice Stair",
771         "Ice Slab",
772         default.node_sound_glass_defaults()
773 )
774
775 stairs.register_stair_and_slab(
776         "snowblock",
777         "default:snowblock",
778         {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
779         {"default_snow.png"},
780         "Snow Block Stair",
781         "Snow Block Slab",
782         default.node_sound_dirt_defaults({
783                 footstep = {name = "default_snow_footstep", gain = 0.15},
784                 dug = {name = "default_snow_footstep", gain = 0.2},
785                 dig = {name = "default_snow_footstep", gain = 0.2}
786         })
787 )