a05d98b17e806d035189e042fa6ab2a2322090cd
[oweals/minetest_game.git] / mods / default / nodes.lua
1 -- mods/default/nodes.lua
2
3 minetest.register_node("default:stone", {
4         description = "Stone",
5         tiles = {"default_stone.png"},
6         is_ground_content = true,
7         groups = {cracky=3, stone=1},
8         drop = 'default:cobble',
9         legacy_mineral = true,
10         sounds = default.node_sound_stone_defaults(),
11 })
12
13 minetest.register_node("default:desert_stone", {
14         description = "Desert Stone",
15         tiles = {"default_desert_stone.png"},
16         is_ground_content = true,
17         groups = {cracky=3, stone=1},
18         drop = 'default:desert_stone',
19         legacy_mineral = true,
20         sounds = default.node_sound_stone_defaults(),
21 })
22
23 minetest.register_node("default:stone_with_coal", {
24         description = "Coal Ore",
25         tiles = {"default_stone.png^default_mineral_coal.png"},
26         is_ground_content = true,
27         groups = {cracky=3},
28         drop = 'default:coal_lump',
29         sounds = default.node_sound_stone_defaults(),
30 })
31
32 minetest.register_node("default:stone_with_iron", {
33         description = "Iron Ore",
34         tiles = {"default_stone.png^default_mineral_iron.png"},
35         is_ground_content = true,
36         groups = {cracky=2},
37         drop = 'default:iron_lump',
38         sounds = default.node_sound_stone_defaults(),
39 })
40
41 minetest.register_node("default:stone_with_copper", {
42         description = "Copper Ore",
43         tiles = {"default_stone.png^default_mineral_copper.png"},
44         is_ground_content = true,
45         groups = {cracky=2},
46         drop = 'default:copper_lump',
47         sounds = default.node_sound_stone_defaults(),
48 })
49
50 minetest.register_node("default:stone_with_mese", {
51         description = "Mese Crystals in Stone",
52         tiles = {"default_stone.png^default_mineral_mese.png"},
53         is_ground_content = true,
54         groups = {cracky=1},
55         drop = "default:mese_crystal",
56         sounds = default.node_sound_stone_defaults(),
57 })
58
59 minetest.register_node("default:stone_with_gold", {
60         description = "Gold Ore",
61         tiles = {"default_stone.png^default_mineral_gold.png"},
62         is_ground_content = true,
63         groups = {cracky=2},
64         drop = "default:gold_lump",
65         sounds = default.node_sound_stone_defaults(),
66 })
67         
68 minetest.register_node("default:stone_with_diamond", {
69         description = "Diamonds in Stone",
70         tiles = {"default_stone.png^default_mineral_diamond.png"},
71         is_ground_content = true,
72         groups = {cracky=1},
73         drop = "default:diamond",
74         sounds = default.node_sound_stone_defaults(),
75 })
76
77 minetest.register_node("default:stonebrick", {
78         description = "Stone Brick",
79         tiles = {"default_stone_brick.png"},
80         groups = {cracky=2, stone=1},
81         sounds = default.node_sound_stone_defaults(),
82 })
83
84 minetest.register_node("default:desert_stonebrick", {
85         description = "Desert Stone Brick",
86         tiles = {"default_desert_stone_brick.png"},
87         groups = {cracky=2, stone=1},
88         sounds = default.node_sound_stone_defaults(),
89 })
90
91 minetest.register_node("default:dirt_with_grass", {
92         description = "Dirt with Grass",
93         tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
94         is_ground_content = true,
95         groups = {crumbly=3,soil=1},
96         drop = 'default:dirt',
97         sounds = default.node_sound_dirt_defaults({
98                 footstep = {name="default_grass_footstep", gain=0.25},
99         }),
100 })
101
102 minetest.register_node("default:dirt_with_grass_footsteps", {
103         description = "Dirt with Grass and Footsteps",
104         tiles = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
105         is_ground_content = true,
106         groups = {crumbly=3,soil=1,not_in_creative_inventory=1},
107         drop = 'default:dirt',
108         sounds = default.node_sound_dirt_defaults({
109                 footstep = {name="default_grass_footstep", gain=0.25},
110         }),
111 })
112
113 minetest.register_node("default:dirt_with_snow", {
114         description = "Dirt with Snow",
115         tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"},
116         is_ground_content = true,
117         groups = {crumbly=3},
118         drop = 'default:dirt',
119         sounds = default.node_sound_dirt_defaults({
120                 footstep = {name="default_snow_footstep", gain=0.25},
121         }),
122 })
123 minetest.register_alias("dirt_with_snow", "default:dirt_with_snow")
124
125 minetest.register_node("default:dirt", {
126         description = "Dirt",
127         tiles = {"default_dirt.png"},
128         is_ground_content = true,
129         groups = {crumbly=3,soil=1},
130         sounds = default.node_sound_dirt_defaults(),
131 })
132
133 minetest.register_node("default:sand", {
134         description = "Sand",
135         tiles = {"default_sand.png"},
136         is_ground_content = true,
137         groups = {crumbly=3, falling_node=1, sand=1},
138         sounds = default.node_sound_sand_defaults(),
139 })
140
141 minetest.register_node("default:desert_sand", {
142         description = "Desert Sand",
143         tiles = {"default_desert_sand.png"},
144         is_ground_content = true,
145         groups = {crumbly=3, falling_node=1, sand=1},
146         sounds = default.node_sound_sand_defaults(),
147 })
148
149 minetest.register_node("default:gravel", {
150         description = "Gravel",
151         tiles = {"default_gravel.png"},
152         is_ground_content = true,
153         groups = {crumbly=2, falling_node=1},
154         sounds = default.node_sound_dirt_defaults({
155                 footstep = {name="default_gravel_footstep", gain=0.5},
156                 dug = {name="default_gravel_footstep", gain=1.0},
157         }),
158 })
159
160 minetest.register_node("default:sandstone", {
161         description = "Sandstone",
162         tiles = {"default_sandstone.png"},
163         is_ground_content = true,
164         groups = {crumbly=2,cracky=3},
165         sounds = default.node_sound_stone_defaults(),
166 })
167
168 minetest.register_node("default:sandstonebrick", {
169         description = "Sandstone Brick",
170         tiles = {"default_sandstone_brick.png"},
171         is_ground_content = true,
172         groups = {cracky=2},
173         sounds = default.node_sound_stone_defaults(),
174 })
175
176 minetest.register_node("default:clay", {
177         description = "Clay",
178         tiles = {"default_clay.png"},
179         is_ground_content = true,
180         groups = {crumbly=3},
181         drop = 'default:clay_lump 4',
182         sounds = default.node_sound_dirt_defaults(),
183 })
184
185 minetest.register_node("default:brick", {
186         description = "Brick Block",
187         tiles = {"default_brick.png"},
188         groups = {cracky=3},
189         sounds = default.node_sound_stone_defaults(),
190 })
191
192 minetest.register_node("default:tree", {
193         description = "Tree",
194         tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
195         groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
196         sounds = default.node_sound_wood_defaults(),
197 })
198
199 minetest.register_node("default:jungletree", {
200         description = "Jungle Tree",
201         tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
202         groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
203         sounds = default.node_sound_wood_defaults(),
204 })
205
206 minetest.register_node("default:junglewood", {
207         description = "Junglewood Planks",
208         tiles = {"default_junglewood.png"},
209         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
210         sounds = default.node_sound_wood_defaults(),
211 })
212
213 minetest.register_node("default:jungleleaves", {
214         description = "Jungle Leaves",
215         drawtype = "allfaces_optional",
216         visual_scale = 1.3,
217         tiles = {"default_jungleleaves.png"},
218         paramtype = "light",
219         groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
220         drop = {
221                 max_items = 1,
222                 items = {
223                         {
224                                 -- player will get sapling with 1/20 chance
225                                 items = {'default:junglesapling'},
226                                 rarity = 20,
227                         },
228                         {
229                                 -- player will get leaves only if he get no saplings,
230                                 -- this is because max_items is 1
231                                 items = {'default:jungleleaves'},
232                         }
233                 }
234         },
235         sounds = default.node_sound_leaves_defaults(),
236 })
237
238 minetest.register_node("default:junglesapling", {
239         description = "Jungle Sapling",
240         drawtype = "plantlike",
241         visual_scale = 1.0,
242         tiles = {"default_junglesapling.png"},
243         inventory_image = "default_junglesapling.png",
244         wield_image = "default_junglesapling.png",
245         paramtype = "light",
246         walkable = false,
247         selection_box = {
248                 type = "fixed",
249                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
250         },
251         groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
252         sounds = default.node_sound_leaves_defaults(),
253 })
254 -- aliases for tree growing abm in content_abm.cpp
255 minetest.register_alias("sapling", "default:sapling")
256 minetest.register_alias("junglesapling", "default:junglesapling")
257
258 minetest.register_node("default:junglegrass", {
259         description = "Jungle Grass",
260         drawtype = "plantlike",
261         visual_scale = 1.3,
262         tiles = {"default_junglegrass.png"},
263         inventory_image = "default_junglegrass.png",
264         wield_image = "default_junglegrass.png",
265         paramtype = "light",
266         walkable = false,
267         buildable_to = true,
268         is_ground_content = true,
269         groups = {snappy=3,flammable=2,flora=1,attached_node=1},
270         sounds = default.node_sound_leaves_defaults(),
271         selection_box = {
272                 type = "fixed",
273                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
274         },
275 })
276
277 minetest.register_node("default:leaves", {
278         description = "Leaves",
279         drawtype = "allfaces_optional",
280         visual_scale = 1.3,
281         tiles = {"default_leaves.png"},
282         paramtype = "light",
283         groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
284         drop = {
285                 max_items = 1,
286                 items = {
287                         {
288                                 -- player will get sapling with 1/20 chance
289                                 items = {'default:sapling'},
290                                 rarity = 20,
291                         },
292                         {
293                                 -- player will get leaves only if he get no saplings,
294                                 -- this is because max_items is 1
295                                 items = {'default:leaves'},
296                         }
297                 }
298         },
299         sounds = default.node_sound_leaves_defaults(),
300 })
301
302 minetest.register_node("default:cactus", {
303         description = "Cactus",
304         tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
305         is_ground_content = true,
306         groups = {snappy=1,choppy=3,flammable=2},
307         sounds = default.node_sound_wood_defaults(),
308 })
309
310 minetest.register_node("default:papyrus", {
311         description = "Papyrus",
312         drawtype = "plantlike",
313         tiles = {"default_papyrus.png"},
314         inventory_image = "default_papyrus.png",
315         wield_image = "default_papyrus.png",
316         paramtype = "light",
317         walkable = false,
318         is_ground_content = true,
319         selection_box = {
320                 type = "fixed",
321                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
322         },
323         groups = {snappy=3,flammable=2},
324         sounds = default.node_sound_leaves_defaults(),
325 })
326
327 minetest.register_node("default:bookshelf", {
328         description = "Bookshelf",
329         tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
330         groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
331         sounds = default.node_sound_wood_defaults(),
332 })
333
334 minetest.register_node("default:glass", {
335         description = "Glass",
336         drawtype = "glasslike",
337         tiles = {"default_glass.png"},
338         inventory_image = minetest.inventorycube("default_glass.png"),
339         paramtype = "light",
340         sunlight_propagates = true,
341         groups = {cracky=3,oddly_breakable_by_hand=3},
342         sounds = default.node_sound_glass_defaults(),
343 })
344
345 minetest.register_node("default:fence_wood", {
346         description = "Wooden Fence",
347         drawtype = "fencelike",
348         tiles = {"default_wood.png"},
349         inventory_image = "default_fence.png",
350         wield_image = "default_fence.png",
351         paramtype = "light",
352         selection_box = {
353                 type = "fixed",
354                 fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
355         },
356         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2},
357         sounds = default.node_sound_wood_defaults(),
358 })
359
360 minetest.register_node("default:rail", {
361         description = "Rail",
362         drawtype = "raillike",
363         tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
364         inventory_image = "default_rail.png",
365         wield_image = "default_rail.png",
366         paramtype = "light",
367         walkable = false,
368         selection_box = {
369                 type = "fixed",
370                 -- but how to specify the dimensions for curved and sideways rails?
371                 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
372         },
373         groups = {bendy=2,dig_immediate=2,attached_node=1},
374 })
375
376 minetest.register_node("default:ladder", {
377         description = "Ladder",
378         drawtype = "signlike",
379         tiles = {"default_ladder.png"},
380         inventory_image = "default_ladder.png",
381         wield_image = "default_ladder.png",
382         paramtype = "light",
383         paramtype2 = "wallmounted",
384         walkable = false,
385         climbable = true,
386         selection_box = {
387                 type = "wallmounted",
388                 --wall_top = = <default>
389                 --wall_bottom = = <default>
390                 --wall_side = = <default>
391         },
392         groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
393         legacy_wallmounted = true,
394         sounds = default.node_sound_wood_defaults(),
395 })
396
397 minetest.register_node("default:wood", {
398         description = "Wooden Planks",
399         tiles = {"default_wood.png"},
400         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
401         sounds = default.node_sound_wood_defaults(),
402 })
403
404 minetest.register_node("default:cloud", {
405         description = "Cloud",
406         tiles = {"default_cloud.png"},
407         sounds = default.node_sound_defaults(),
408         groups = {not_in_creative_inventory=1},
409 })
410
411 minetest.register_node("default:water_flowing", {
412         description = "Flowing Water",
413         inventory_image = minetest.inventorycube("default_water.png"),
414         drawtype = "flowingliquid",
415         tiles = {"default_water.png"},
416         special_tiles = {
417                 {
418                         image="default_water_flowing_animated.png",
419                         backface_culling=false,
420                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
421                 },
422                 {
423                         image="default_water_flowing_animated.png",
424                         backface_culling=true,
425                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
426                 },
427         },
428         alpha = WATER_ALPHA,
429         paramtype = "light",
430         walkable = false,
431         pointable = false,
432         diggable = false,
433         buildable_to = true,
434         drop = "",
435         liquidtype = "flowing",
436         liquid_alternative_flowing = "default:water_flowing",
437         liquid_alternative_source = "default:water_source",
438         liquid_viscosity = WATER_VISC,
439         post_effect_color = {a=64, r=100, g=100, b=200},
440         groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
441 })
442
443 minetest.register_node("default:water_source", {
444         description = "Water Source",
445         inventory_image = minetest.inventorycube("default_water.png"),
446         drawtype = "liquid",
447         tiles = {
448                 {name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
449         },
450         special_tiles = {
451                 -- New-style water source material (mostly unused)
452                 {
453                         name="default_water_source_animated.png",
454                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
455                         backface_culling = false,
456                 }
457         },
458         alpha = WATER_ALPHA,
459         paramtype = "light",
460         walkable = false,
461         pointable = false,
462         diggable = false,
463         buildable_to = true,
464         drop = "",
465         liquidtype = "source",
466         liquid_alternative_flowing = "default:water_flowing",
467         liquid_alternative_source = "default:water_source",
468         liquid_viscosity = WATER_VISC,
469         post_effect_color = {a=64, r=100, g=100, b=200},
470         groups = {water=3, liquid=3, puts_out_fire=1},
471 })
472
473 minetest.register_node("default:lava_flowing", {
474         description = "Flowing Lava",
475         inventory_image = minetest.inventorycube("default_lava.png"),
476         drawtype = "flowingliquid",
477         tiles = {"default_lava.png"},
478         special_tiles = {
479                 {
480                         image="default_lava_flowing_animated.png",
481                         backface_culling=false,
482                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
483                 },
484                 {
485                         image="default_lava_flowing_animated.png",
486                         backface_culling=true,
487                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
488                 },
489         },
490         paramtype = "light",
491         light_source = LIGHT_MAX - 1,
492         walkable = false,
493         pointable = false,
494         diggable = false,
495         buildable_to = true,
496         drop = "",
497         liquidtype = "flowing",
498         liquid_alternative_flowing = "default:lava_flowing",
499         liquid_alternative_source = "default:lava_source",
500         liquid_viscosity = LAVA_VISC,
501         liquid_renewable = false,
502         damage_per_second = 4*2,
503         post_effect_color = {a=192, r=255, g=64, b=0},
504         groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
505 })
506
507 minetest.register_node("default:lava_source", {
508         description = "Lava Source",
509         inventory_image = minetest.inventorycube("default_lava.png"),
510         drawtype = "liquid",
511         tiles = {
512                 {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
513         },
514         special_tiles = {
515                 -- New-style lava source material (mostly unused)
516                 {
517                         name="default_lava_source_animated.png",
518                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0},
519                         backface_culling = false,
520                 }
521         },
522         paramtype = "light",
523         light_source = LIGHT_MAX - 1,
524         walkable = false,
525         pointable = false,
526         diggable = false,
527         buildable_to = true,
528         drop = "",
529         liquidtype = "source",
530         liquid_alternative_flowing = "default:lava_flowing",
531         liquid_alternative_source = "default:lava_source",
532         liquid_viscosity = LAVA_VISC,
533         liquid_renewable = false,
534         damage_per_second = 4*2,
535         post_effect_color = {a=192, r=255, g=64, b=0},
536         groups = {lava=3, liquid=2, hot=3, igniter=1},
537 })
538
539 minetest.register_node("default:torch", {
540         description = "Torch",
541         drawtype = "torchlike",
542         --tiles = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
543         tiles = {
544                 {name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
545                 {name="default_torch_on_ceiling_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
546                 {name="default_torch_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
547         },
548         inventory_image = "default_torch_on_floor.png",
549         wield_image = "default_torch_on_floor.png",
550         paramtype = "light",
551         paramtype2 = "wallmounted",
552         sunlight_propagates = true,
553         walkable = false,
554         light_source = LIGHT_MAX-1,
555         selection_box = {
556                 type = "wallmounted",
557                 wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
558                 wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
559                 wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
560         },
561         groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1},
562         legacy_wallmounted = true,
563         sounds = default.node_sound_defaults(),
564 })
565
566 minetest.register_node("default:sign_wall", {
567         description = "Sign",
568         drawtype = "signlike",
569         tiles = {"default_sign_wall.png"},
570         inventory_image = "default_sign_wall.png",
571         wield_image = "default_sign_wall.png",
572         paramtype = "light",
573         paramtype2 = "wallmounted",
574         sunlight_propagates = true,
575         walkable = false,
576         selection_box = {
577                 type = "wallmounted",
578                 --wall_top = <default>
579                 --wall_bottom = <default>
580                 --wall_side = <default>
581         },
582         groups = {choppy=2,dig_immediate=2,attached_node=1},
583         legacy_wallmounted = true,
584         sounds = default.node_sound_defaults(),
585         on_construct = function(pos)
586                 --local n = minetest.get_node(pos)
587                 local meta = minetest.get_meta(pos)
588                 meta:set_string("formspec", "field[text;;${text}]")
589                 meta:set_string("infotext", "\"\"")
590         end,
591         on_receive_fields = function(pos, formname, fields, sender)
592                 --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
593                 local meta = minetest.get_meta(pos)
594                 fields.text = fields.text or ""
595                 print((sender:get_player_name() or "").." wrote \""..fields.text..
596                                 "\" to sign at "..minetest.pos_to_string(pos))
597                 meta:set_string("text", fields.text)
598                 meta:set_string("infotext", '"'..fields.text..'"')
599         end,
600 })
601
602 default.chest_formspec = 
603         "size[8,9]"..
604         "list[current_name;main;0,0;8,4;]"..
605         "list[current_player;main;0,5;8,4;]"
606
607 function default.get_locked_chest_formspec(pos)
608         local spos = pos.x .. "," .. pos.y .. "," ..pos.z
609         local formspec =
610                 "size[8,9]"..
611                 "list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
612                 "list[current_player;main;0,5;8,4;]"
613         return formspec
614 end
615
616
617 minetest.register_node("default:chest", {
618         description = "Chest",
619         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
620                 "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
621         paramtype2 = "facedir",
622         groups = {choppy=2,oddly_breakable_by_hand=2},
623         legacy_facedir_simple = true,
624         sounds = default.node_sound_wood_defaults(),
625         on_construct = function(pos)
626                 local meta = minetest.get_meta(pos)
627                 meta:set_string("formspec",default.chest_formspec)
628                 meta:set_string("infotext", "Chest")
629                 local inv = meta:get_inventory()
630                 inv:set_size("main", 8*4)
631         end,
632         can_dig = function(pos,player)
633                 local meta = minetest.get_meta(pos);
634                 local inv = meta:get_inventory()
635                 return inv:is_empty("main")
636         end,
637         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
638                 minetest.log("action", player:get_player_name()..
639                                 " moves stuff in chest at "..minetest.pos_to_string(pos))
640         end,
641     on_metadata_inventory_put = function(pos, listname, index, stack, player)
642                 minetest.log("action", player:get_player_name()..
643                                 " moves stuff to chest at "..minetest.pos_to_string(pos))
644         end,
645     on_metadata_inventory_take = function(pos, listname, index, stack, player)
646                 minetest.log("action", player:get_player_name()..
647                                 " takes stuff from chest at "..minetest.pos_to_string(pos))
648         end,
649 })
650
651 local function has_locked_chest_privilege(meta, player)
652         if player:get_player_name() ~= meta:get_string("owner") then
653                 return false
654         end
655         return true
656 end
657
658 minetest.register_node("default:chest_locked", {
659         description = "Locked Chest",
660         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
661                 "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
662         paramtype2 = "facedir",
663         groups = {choppy=2,oddly_breakable_by_hand=2},
664         legacy_facedir_simple = true,
665         sounds = default.node_sound_wood_defaults(),
666         after_place_node = function(pos, placer)
667                 local meta = minetest.get_meta(pos)
668                 meta:set_string("owner", placer:get_player_name() or "")
669                 meta:set_string("infotext", "Locked Chest (owned by "..
670                                 meta:get_string("owner")..")")
671         end,
672         on_construct = function(pos)
673                 local meta = minetest.get_meta(pos)
674                 meta:set_string("infotext", "Locked Chest")
675                 meta:set_string("owner", "")
676                 local inv = meta:get_inventory()
677                 inv:set_size("main", 8*4)
678         end,
679         can_dig = function(pos,player)
680                 local meta = minetest.get_meta(pos);
681                 local inv = meta:get_inventory()
682                 return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
683         end,
684         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
685                 local meta = minetest.get_meta(pos)
686                 if not has_locked_chest_privilege(meta, player) then
687                         minetest.log("action", player:get_player_name()..
688                                         " tried to access a locked chest belonging to "..
689                                         meta:get_string("owner").." at "..
690                                         minetest.pos_to_string(pos))
691                         return 0
692                 end
693                 return count
694         end,
695     allow_metadata_inventory_put = function(pos, listname, index, stack, player)
696                 local meta = minetest.get_meta(pos)
697                 if not has_locked_chest_privilege(meta, player) then
698                         minetest.log("action", player:get_player_name()..
699                                         " tried to access a locked chest belonging to "..
700                                         meta:get_string("owner").." at "..
701                                         minetest.pos_to_string(pos))
702                         return 0
703                 end
704                 return stack:get_count()
705         end,
706     allow_metadata_inventory_take = function(pos, listname, index, stack, player)
707                 local meta = minetest.get_meta(pos)
708                 if not has_locked_chest_privilege(meta, player) then
709                         minetest.log("action", player:get_player_name()..
710                                         " tried to access a locked chest belonging to "..
711                                         meta:get_string("owner").." at "..
712                                         minetest.pos_to_string(pos))
713                         return 0
714                 end
715                 return stack:get_count()
716         end,
717         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
718                 minetest.log("action", player:get_player_name()..
719                                 " moves stuff in locked chest at "..minetest.pos_to_string(pos))
720         end,
721     on_metadata_inventory_put = function(pos, listname, index, stack, player)
722                 minetest.log("action", player:get_player_name()..
723                                 " moves stuff to locked chest at "..minetest.pos_to_string(pos))
724         end,
725     on_metadata_inventory_take = function(pos, listname, index, stack, player)
726                 minetest.log("action", player:get_player_name()..
727                                 " takes stuff from locked chest at "..minetest.pos_to_string(pos))
728         end,
729         on_rightclick = function(pos, node, clicker)
730                 local meta = minetest.get_meta(pos)
731                 if has_locked_chest_privilege(meta, clicker) then
732                         minetest.show_formspec(
733                                 clicker:get_player_name(),
734                                 "default:chest_locked",
735                                 default.get_locked_chest_formspec(pos)
736                         )
737                 end
738         end,
739 })
740
741 function default.get_furnace_active_formspec(pos, percent)
742         local formspec =
743                 "size[8,9]"..
744                 "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
745                 (100-percent)..":default_furnace_fire_fg.png]"..
746                 "list[current_name;fuel;2,3;1,1;]"..
747                 "list[current_name;src;2,1;1,1;]"..
748                 "list[current_name;dst;5,1;2,2;]"..
749                 "list[current_player;main;0,5;8,4;]"
750         return formspec
751 end
752
753 default.furnace_inactive_formspec =
754         "size[8,9]"..
755         "image[2,2;1,1;default_furnace_fire_bg.png]"..
756         "list[current_name;fuel;2,3;1,1;]"..
757         "list[current_name;src;2,1;1,1;]"..
758         "list[current_name;dst;5,1;2,2;]"..
759         "list[current_player;main;0,5;8,4;]"
760
761 minetest.register_node("default:furnace", {
762         description = "Furnace",
763         tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
764                 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
765         paramtype2 = "facedir",
766         groups = {cracky=2},
767         legacy_facedir_simple = true,
768         sounds = default.node_sound_stone_defaults(),
769         on_construct = function(pos)
770                 local meta = minetest.get_meta(pos)
771                 meta:set_string("formspec", default.furnace_inactive_formspec)
772                 meta:set_string("infotext", "Furnace")
773                 local inv = meta:get_inventory()
774                 inv:set_size("fuel", 1)
775                 inv:set_size("src", 1)
776                 inv:set_size("dst", 4)
777         end,
778         can_dig = function(pos,player)
779                 local meta = minetest.get_meta(pos);
780                 local inv = meta:get_inventory()
781                 if not inv:is_empty("fuel") then
782                         return false
783                 elseif not inv:is_empty("dst") then
784                         return false
785                 elseif not inv:is_empty("src") then
786                         return false
787                 end
788                 return true
789         end,
790         allow_metadata_inventory_put = function(pos, listname, index, stack, player)
791                 local meta = minetest.get_meta(pos)
792                 local inv = meta:get_inventory()
793                 if listname == "fuel" then
794                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
795                                 if inv:is_empty("src") then
796                                         meta:set_string("infotext","Furnace is empty")
797                                 end
798                                 return stack:get_count()
799                         else
800                                 return 0
801                         end
802                 elseif listname == "src" then
803                         return stack:get_count()
804                 elseif listname == "dst" then
805                         return 0
806                 end
807         end,
808         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
809                 local meta = minetest.get_meta(pos)
810                 local inv = meta:get_inventory()
811                 local stack = inv:get_stack(from_list, from_index)
812                 if to_list == "fuel" then
813                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
814                                 if inv:is_empty("src") then
815                                         meta:set_string("infotext","Furnace is empty")
816                                 end
817                                 return count
818                         else
819                                 return 0
820                         end
821                 elseif to_list == "src" then
822                         return count
823                 elseif to_list == "dst" then
824                         return 0
825                 end
826         end,
827 })
828
829 minetest.register_node("default:furnace_active", {
830         description = "Furnace",
831         tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
832                 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
833         paramtype2 = "facedir",
834         light_source = 8,
835         drop = "default:furnace",
836         groups = {cracky=2, not_in_creative_inventory=1},
837         legacy_facedir_simple = true,
838         sounds = default.node_sound_stone_defaults(),
839         on_construct = function(pos)
840                 local meta = minetest.get_meta(pos)
841                 meta:set_string("formspec", default.furnace_inactive_formspec)
842                 meta:set_string("infotext", "Furnace");
843                 local inv = meta:get_inventory()
844                 inv:set_size("fuel", 1)
845                 inv:set_size("src", 1)
846                 inv:set_size("dst", 4)
847         end,
848         can_dig = function(pos,player)
849                 local meta = minetest.get_meta(pos);
850                 local inv = meta:get_inventory()
851                 if not inv:is_empty("fuel") then
852                         return false
853                 elseif not inv:is_empty("dst") then
854                         return false
855                 elseif not inv:is_empty("src") then
856                         return false
857                 end
858                 return true
859         end,
860         allow_metadata_inventory_put = function(pos, listname, index, stack, player)
861                 local meta = minetest.get_meta(pos)
862                 local inv = meta:get_inventory()
863                 if listname == "fuel" then
864                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
865                                 if inv:is_empty("src") then
866                                         meta:set_string("infotext","Furnace is empty")
867                                 end
868                                 return stack:get_count()
869                         else
870                                 return 0
871                         end
872                 elseif listname == "src" then
873                         return stack:get_count()
874                 elseif listname == "dst" then
875                         return 0
876                 end
877         end,
878         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
879                 local meta = minetest.get_meta(pos)
880                 local inv = meta:get_inventory()
881                 local stack = inv:get_stack(from_list, from_index)
882                 if to_list == "fuel" then
883                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
884                                 if inv:is_empty("src") then
885                                         meta:set_string("infotext","Furnace is empty")
886                                 end
887                                 return count
888                         else
889                                 return 0
890                         end
891                 elseif to_list == "src" then
892                         return count
893                 elseif to_list == "dst" then
894                         return 0
895                 end
896         end,
897 })
898
899 function hacky_swap_node(pos,name)
900         local node = minetest.get_node(pos)
901         local meta = minetest.get_meta(pos)
902         local meta0 = meta:to_table()
903         if node.name == name then
904                 return
905         end
906         node.name = name
907         local meta0 = meta:to_table()
908         minetest.set_node(pos,node)
909         meta = minetest.get_meta(pos)
910         meta:from_table(meta0)
911 end
912
913 minetest.register_abm({
914         nodenames = {"default:furnace","default:furnace_active"},
915         interval = 1.0,
916         chance = 1,
917         action = function(pos, node, active_object_count, active_object_count_wider)
918                 local meta = minetest.get_meta(pos)
919                 for i, name in ipairs({
920                                 "fuel_totaltime",
921                                 "fuel_time",
922                                 "src_totaltime",
923                                 "src_time"
924                 }) do
925                         if meta:get_string(name) == "" then
926                                 meta:set_float(name, 0.0)
927                         end
928                 end
929
930                 local inv = meta:get_inventory()
931
932                 local srclist = inv:get_list("src")
933                 local cooked = nil
934                 local aftercooked
935                 
936                 if srclist then
937                         cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
938                 end
939                 
940                 local was_active = false
941                 
942                 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
943                         was_active = true
944                         meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
945                         meta:set_float("src_time", meta:get_float("src_time") + 1)
946                         if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
947                                 -- check if there's room for output in "dst" list
948                                 if inv:room_for_item("dst",cooked.item) then
949                                         -- Put result in "dst" list
950                                         inv:add_item("dst", cooked.item)
951                                         -- take stuff from "src" list
952                                         inv:set_stack("src", 1, aftercooked.items[1])
953                                 else
954                                         print("Could not insert '"..cooked.item:to_string().."'")
955                                 end
956                                 meta:set_string("src_time", 0)
957                         end
958                 end
959                 
960                 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
961                         local percent = math.floor(meta:get_float("fuel_time") /
962                                         meta:get_float("fuel_totaltime") * 100)
963                         meta:set_string("infotext","Furnace active: "..percent.."%")
964                         hacky_swap_node(pos,"default:furnace_active")
965                         meta:set_string("formspec",default.get_furnace_active_formspec(pos, percent))
966                         return
967                 end
968
969                 local fuel = nil
970                 local afterfuel
971                 local cooked = nil
972                 local fuellist = inv:get_list("fuel")
973                 local srclist = inv:get_list("src")
974                 
975                 if srclist then
976                         cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
977                 end
978                 if fuellist then
979                         fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
980                 end
981
982                 if fuel.time <= 0 then
983                         meta:set_string("infotext","Furnace out of fuel")
984                         hacky_swap_node(pos,"default:furnace")
985                         meta:set_string("formspec", default.furnace_inactive_formspec)
986                         return
987                 end
988
989                 if cooked.item:is_empty() then
990                         if was_active then
991                                 meta:set_string("infotext","Furnace is empty")
992                                 hacky_swap_node(pos,"default:furnace")
993                                 meta:set_string("formspec", default.furnace_inactive_formspec)
994                         end
995                         return
996                 end
997
998                 meta:set_string("fuel_totaltime", fuel.time)
999                 meta:set_string("fuel_time", 0)
1000                 
1001                 inv:set_stack("fuel", 1, afterfuel.items[1])
1002         end,
1003 })
1004
1005 minetest.register_node("default:cobble", {
1006         description = "Cobblestone",
1007         tiles = {"default_cobble.png"},
1008         is_ground_content = true,
1009         groups = {cracky=3, stone=2},
1010         sounds = default.node_sound_stone_defaults(),
1011 })
1012
1013 minetest.register_node("default:mossycobble", {
1014         description = "Mossy Cobblestone",
1015         tiles = {"default_mossycobble.png"},
1016         is_ground_content = true,
1017         groups = {cracky=3},
1018         sounds = default.node_sound_stone_defaults(),
1019 })
1020
1021 minetest.register_node("default:coalblock", {
1022         description = "Coal Block",
1023         tiles = {"default_coal_block.png"},
1024         is_ground_content = true,
1025         groups = {cracky=3},
1026         sounds = default.node_sound_stone_defaults(),
1027 })
1028
1029 minetest.register_node("default:steelblock", {
1030         description = "Steel Block",
1031         tiles = {"default_steel_block.png"},
1032         is_ground_content = true,
1033         groups = {cracky=1,level=2},
1034         sounds = default.node_sound_stone_defaults(),
1035 })
1036
1037 minetest.register_node("default:copperblock", {
1038         description = "Copper Block",
1039         tiles = {"default_copper_block.png"},
1040         is_ground_content = true,
1041         groups = {cracky=1,level=2},
1042         sounds = default.node_sound_stone_defaults(),
1043 })
1044
1045 minetest.register_node("default:bronzeblock", {
1046         description = "Bronze Block",
1047         tiles = {"default_bronze_block.png"},
1048         is_ground_content = true,
1049         groups = {cracky=1,level=2},
1050         sounds = default.node_sound_stone_defaults(),
1051 })
1052
1053 minetest.register_node("default:mese", {
1054         description = "Mese Block",
1055         tiles = {"default_mese_block.png"},
1056         is_ground_content = true,
1057         groups = {cracky=1,level=2},
1058         sounds = default.node_sound_stone_defaults(),
1059 })
1060 minetest.register_alias("default:mese_block", "default:mese")
1061
1062 minetest.register_node("default:goldblock", {
1063         description = "Gold Block",
1064         tiles = {"default_gold_block.png"},
1065         is_ground_content = true,
1066         groups = {cracky=1},
1067         sounds = default.node_sound_stone_defaults(),
1068 })
1069
1070 minetest.register_node("default:diamondblock", {
1071         description = "Diamond Block",
1072         tiles = {"default_diamond_block.png"},
1073         is_ground_content = true,
1074         groups = {cracky=1,level=3},
1075         sounds = default.node_sound_stone_defaults(),
1076 })
1077
1078 minetest.register_node("default:obsidian_glass", {
1079         description = "Obsidian Glass",
1080         drawtype = "glasslike",
1081         tiles = {"default_obsidian_glass.png"},
1082         paramtype = "light",
1083         sunlight_propagates = true,
1084         sounds = default.node_sound_glass_defaults(),
1085         groups = {cracky=3,oddly_breakable_by_hand=3},
1086 })
1087
1088 minetest.register_node("default:obsidian", {
1089         description = "Obsidian",
1090         tiles = {"default_obsidian.png"},
1091         is_ground_content = true,
1092         sounds = default.node_sound_stone_defaults(),
1093         groups = {cracky=1,level=2},
1094 })
1095
1096 minetest.register_node("default:nyancat", {
1097         description = "Nyan Cat",
1098         tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
1099                 "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
1100         paramtype2 = "facedir",
1101         groups = {cracky=2},
1102         legacy_facedir_simple = true,
1103         sounds = default.node_sound_defaults(),
1104 })
1105
1106 minetest.register_node("default:nyancat_rainbow", {
1107         description = "Nyan Cat Rainbow",
1108         tiles = {"default_nc_rb.png"},
1109         groups = {cracky=2},
1110         sounds = default.node_sound_defaults(),
1111 })
1112
1113 minetest.register_node("default:sapling", {
1114         description = "Sapling",
1115         drawtype = "plantlike",
1116         visual_scale = 1.0,
1117         tiles = {"default_sapling.png"},
1118         inventory_image = "default_sapling.png",
1119         wield_image = "default_sapling.png",
1120         paramtype = "light",
1121         walkable = false,
1122         selection_box = {
1123                 type = "fixed",
1124                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
1125         },
1126         groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
1127         sounds = default.node_sound_leaves_defaults(),
1128 })
1129
1130 minetest.register_node("default:apple", {
1131         description = "Apple",
1132         drawtype = "plantlike",
1133         visual_scale = 1.0,
1134         tiles = {"default_apple.png"},
1135         inventory_image = "default_apple.png",
1136         paramtype = "light",
1137         sunlight_propagates = true,
1138         walkable = false,
1139         selection_box = {
1140                 type = "fixed",
1141                 fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
1142         },
1143         groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
1144         on_use = minetest.item_eat(1),
1145         sounds = default.node_sound_leaves_defaults(),
1146         after_place_node = function(pos, placer, itemstack)
1147                 if placer:is_player() then
1148                         minetest.set_node(pos, {name="default:apple", param2=1})
1149                 end
1150         end,
1151 })
1152
1153 minetest.register_node("default:dry_shrub", {
1154         description = "Dry Shrub",
1155         drawtype = "plantlike",
1156         visual_scale = 1.0,
1157         tiles = {"default_dry_shrub.png"},
1158         inventory_image = "default_dry_shrub.png",
1159         wield_image = "default_dry_shrub.png",
1160         paramtype = "light",
1161         walkable = false,
1162         buildable_to = true,
1163         groups = {snappy=3,flammable=3,attached_node=1},
1164         sounds = default.node_sound_leaves_defaults(),
1165         selection_box = {
1166                 type = "fixed",
1167                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1168         },
1169 })
1170
1171 minetest.register_node("default:grass_1", {
1172         description = "Grass",
1173         drawtype = "plantlike",
1174         tiles = {"default_grass_1.png"},
1175         -- use a bigger inventory image
1176         inventory_image = "default_grass_3.png",
1177         wield_image = "default_grass_3.png",
1178         paramtype = "light",
1179         walkable = false,
1180         buildable_to = true,
1181         groups = {snappy=3,flammable=3,flora=1,attached_node=1},
1182         sounds = default.node_sound_leaves_defaults(),
1183         selection_box = {
1184                 type = "fixed",
1185                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1186         },
1187         on_place = function(itemstack, placer, pointed_thing)
1188                 -- place a random grass node
1189                 local stack = ItemStack("default:grass_"..math.random(1,5))
1190                 local ret = minetest.item_place(stack, placer, pointed_thing)
1191                 return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
1192         end,
1193 })
1194
1195 minetest.register_node("default:grass_2", {
1196         description = "Grass",
1197         drawtype = "plantlike",
1198         tiles = {"default_grass_2.png"},
1199         inventory_image = "default_grass_2.png",
1200         wield_image = "default_grass_2.png",
1201         paramtype = "light",
1202         walkable = false,
1203         buildable_to = true,
1204         is_ground_content = true,
1205         drop = "default:grass_1",
1206         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1207         sounds = default.node_sound_leaves_defaults(),
1208         selection_box = {
1209                 type = "fixed",
1210                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1211         },
1212 })
1213 minetest.register_node("default:grass_3", {
1214         description = "Grass",
1215         drawtype = "plantlike",
1216         tiles = {"default_grass_3.png"},
1217         inventory_image = "default_grass_3.png",
1218         wield_image = "default_grass_3.png",
1219         paramtype = "light",
1220         walkable = false,
1221         buildable_to = true,
1222         is_ground_content = true,
1223         drop = "default:grass_1",
1224         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1225         sounds = default.node_sound_leaves_defaults(),
1226         selection_box = {
1227                 type = "fixed",
1228                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1229         },
1230 })
1231
1232 minetest.register_node("default:grass_4", {
1233         description = "Grass",
1234         drawtype = "plantlike",
1235         tiles = {"default_grass_4.png"},
1236         inventory_image = "default_grass_4.png",
1237         wield_image = "default_grass_4.png",
1238         paramtype = "light",
1239         walkable = false,
1240         buildable_to = true,
1241         is_ground_content = true,
1242         drop = "default:grass_1",
1243         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1244         sounds = default.node_sound_leaves_defaults(),
1245         selection_box = {
1246                 type = "fixed",
1247                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1248         },
1249 })
1250
1251 minetest.register_node("default:grass_5", {
1252         description = "Grass",
1253         drawtype = "plantlike",
1254         tiles = {"default_grass_5.png"},
1255         inventory_image = "default_grass_5.png",
1256         wield_image = "default_grass_5.png",
1257         paramtype = "light",
1258         walkable = false,
1259         buildable_to = true,
1260         is_ground_content = true,
1261         drop = "default:grass_1",
1262         groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1263         sounds = default.node_sound_leaves_defaults(),
1264         selection_box = {
1265                 type = "fixed",
1266                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1267         },
1268 })
1269
1270 minetest.register_node("default:ice", {
1271         description = "Ice",
1272         tiles = {"default_ice.png"},
1273         is_ground_content = true,
1274         paramtype = "light",
1275         groups = {cracky=3},
1276         sounds = default.node_sound_glass_defaults(),
1277 })
1278
1279 minetest.register_node("default:snow", {
1280         description = "Snow",
1281         tiles = {"default_snow.png"},
1282         inventory_image = "default_snowball.png",
1283         wield_image = "default_snowball.png",
1284         is_ground_content = true,
1285         paramtype = "light",
1286         buildable_to = true,
1287         drawtype = "nodebox",
1288         node_box = {
1289                 type = "fixed",
1290                 fixed = {
1291                         {-0.5, -0.5, -0.5,  0.5, -0.5+2/16, 0.5},
1292                 },
1293         },
1294         groups = {crumbly=3,falling_node=1},
1295         sounds = default.node_sound_dirt_defaults({
1296                 footstep = {name="default_snow_footstep", gain=0.25},
1297                 dug = {name="default_snow_footstep", gain=0.75},
1298         }),
1299         on_construct = function(pos)
1300                 pos.y = pos.y - 1
1301                 if minetest.get_node(pos).name == "default:dirt_with_grass" then
1302                         minetest.set_node(pos, {name="default:dirt_with_snow"})
1303                 end
1304         end,
1305 })
1306 minetest.register_alias("snow", "default:snow")
1307
1308 minetest.register_node("default:snowblock", {
1309         description = "Snow Block",
1310         tiles = {"default_snow.png"},
1311         is_ground_content = true,
1312         groups = {crumbly=3},
1313         sounds = default.node_sound_dirt_defaults({
1314                 footstep = {name="default_snow_footstep", gain=0.25},
1315                 dug = {name="default_snow_footstep", gain=0.75},
1316         }),
1317 })