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