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