Default and flowers: only run on-generated functions in mgv6. Remove indev ore defini...
[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 default.bookshelf_formspec =
380         "size[8,7;]"..
381         default.gui_bg..
382         default.gui_bg_img..
383         default.gui_slots..
384         "list[context;books;0,0.3;8,2;]"..
385         "list[current_player;main;0,2.85;8,1;]"..
386         "list[current_player;main;0,4.08;8,3;8]"..
387         default.get_hotbar_bg(0,2.85)
388
389 minetest.register_node("default:bookshelf", {
390         description = "Bookshelf",
391         tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
392         is_ground_content = false,
393         groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
394         sounds = default.node_sound_wood_defaults(),
395         on_construct = function(pos)
396                 local meta = minetest.env:get_meta(pos)
397                 meta:set_string("formspec", default.bookshelf_formspec)
398                 local inv = meta:get_inventory()
399                 inv:set_size("books", 8*2)
400         end,
401         can_dig = function(pos,player)
402                 local meta = minetest.env:get_meta(pos);
403                 local inv = meta:get_inventory()
404                 return inv:is_empty("books")
405         end,
406
407         allow_metadata_inventory_put = function(pos, listname, index, stack, player)
408                 local meta = minetest.env:get_meta(pos)
409                 local inv = meta:get_inventory()
410                 if listname == "books" then
411                         if stack:get_name() == "default:book" then
412                                 return 1
413                         else
414                                 return 0
415                         end
416                 end
417         end,
418
419         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
420                 local meta = minetest.env:get_meta(pos)
421                 local inv = meta:get_inventory()
422                 local stack = inv:get_stack(from_list, from_index)
423                 local to_stack = inv:get_stack(to_list, to_index)
424                 if to_list == "books" then
425                         if stack:get_name() == "default:book" and to_stack:is_empty() then
426                                 return 1
427                         else
428                                 return 0
429                         end
430                 end
431         end,
432
433         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
434                 minetest.log("action", player:get_player_name()..
435                            " moves stuff in bookshelf at "..minetest.pos_to_string(pos))
436         end,
437         on_metadata_inventory_put = function(pos, listname, index, stack, player)
438                 minetest.log("action", player:get_player_name()..
439                            " moves stuff to bookshelf at "..minetest.pos_to_string(pos))
440         end,
441         on_metadata_inventory_take = function(pos, listname, index, stack, player)
442                 minetest.log("action", player:get_player_name()..
443                            " takes stuff from bookshelf at "..minetest.pos_to_string(pos))
444         end,
445 })
446
447 minetest.register_node("default:glass", {
448         description = "Glass",
449         drawtype = "glasslike_framed_optional",
450         tiles = {"default_glass.png", "default_glass_detail.png"},
451         inventory_image = minetest.inventorycube("default_glass.png"),
452         paramtype = "light",
453         sunlight_propagates = true,
454         is_ground_content = false,
455         groups = {cracky=3,oddly_breakable_by_hand=3},
456         sounds = default.node_sound_glass_defaults(),
457 })
458
459 local fence_texture = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126"
460 minetest.register_node("default:fence_wood", {
461         description = "Wooden Fence",
462         drawtype = "fencelike",
463         tiles = {"default_wood.png"},
464         inventory_image = fence_texture,
465         wield_image = fence_texture,
466         paramtype = "light",
467         is_ground_content = false,
468         selection_box = {
469                 type = "fixed",
470                 fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
471         },
472         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2},
473         sounds = default.node_sound_wood_defaults(),
474 })
475
476 minetest.register_node("default:rail", {
477         description = "Rail",
478         drawtype = "raillike",
479         tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
480         inventory_image = "default_rail.png",
481         wield_image = "default_rail.png",
482         paramtype = "light",
483         walkable = false,
484         is_ground_content = false,
485         selection_box = {
486                 type = "fixed",
487                 -- but how to specify the dimensions for curved and sideways rails?
488                 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
489         },
490         groups = {bendy=2,dig_immediate=2,attached_node=1},
491 })
492
493 minetest.register_node("default:ladder", {
494         description = "Ladder",
495         drawtype = "signlike",
496         tiles = {"default_ladder.png"},
497         inventory_image = "default_ladder.png",
498         wield_image = "default_ladder.png",
499         paramtype = "light",
500         paramtype2 = "wallmounted",
501         walkable = false,
502         climbable = true,
503         is_ground_content = false,
504         selection_box = {
505                 type = "wallmounted",
506                 --wall_top = = <default>
507                 --wall_bottom = = <default>
508                 --wall_side = = <default>
509         },
510         groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
511         legacy_wallmounted = true,
512         sounds = default.node_sound_wood_defaults(),
513 })
514
515 minetest.register_node("default:wood", {
516         description = "Wooden Planks",
517         tiles = {"default_wood.png"},
518         groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
519         sounds = default.node_sound_wood_defaults(),
520 })
521
522 minetest.register_node("default:cloud", {
523         description = "Cloud",
524         tiles = {"default_cloud.png"},
525         sounds = default.node_sound_defaults(),
526         groups = {not_in_creative_inventory=1},
527 })
528
529 minetest.register_node("default:water_flowing", {
530         description = "Flowing Water",
531         inventory_image = minetest.inventorycube("default_water.png"),
532         drawtype = "flowingliquid",
533         tiles = {"default_water.png"},
534         special_tiles = {
535                 {
536                         image="default_water_flowing_animated.png",
537                         backface_culling=false,
538                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
539                 },
540                 {
541                         image="default_water_flowing_animated.png",
542                         backface_culling=true,
543                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
544                 },
545         },
546         alpha = WATER_ALPHA,
547         paramtype = "light",
548         paramtype2 = "flowingliquid",
549         walkable = false,
550         pointable = false,
551         diggable = false,
552         buildable_to = true,
553         drop = "",
554         drowning = 1,
555         liquidtype = "flowing",
556         liquid_alternative_flowing = "default:water_flowing",
557         liquid_alternative_source = "default:water_source",
558         liquid_viscosity = WATER_VISC,
559         freezemelt = "default:snow",
560         post_effect_color = {a=64, r=100, g=100, b=200},
561         groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1},
562 })
563
564 minetest.register_node("default:water_source", {
565         description = "Water Source",
566         inventory_image = minetest.inventorycube("default_water.png"),
567         drawtype = "liquid",
568         tiles = {
569                 {name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
570         },
571         special_tiles = {
572                 -- New-style water source material (mostly unused)
573                 {
574                         name="default_water_source_animated.png",
575                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
576                         backface_culling = false,
577                 }
578         },
579         alpha = WATER_ALPHA,
580         paramtype = "light",
581         walkable = false,
582         pointable = false,
583         diggable = false,
584         buildable_to = true,
585         drop = "",
586         drowning = 1,
587         liquidtype = "source",
588         liquid_alternative_flowing = "default:water_flowing",
589         liquid_alternative_source = "default:water_source",
590         liquid_viscosity = WATER_VISC,
591         freezemelt = "default:ice",
592         post_effect_color = {a=64, r=100, g=100, b=200},
593         groups = {water=3, liquid=3, puts_out_fire=1, freezes=1},
594 })
595
596 minetest.register_node("default:lava_flowing", {
597         description = "Flowing Lava",
598         inventory_image = minetest.inventorycube("default_lava.png"),
599         drawtype = "flowingliquid",
600         tiles = {"default_lava.png"},
601         special_tiles = {
602                 {
603                         image="default_lava_flowing_animated.png",
604                         backface_culling=false,
605                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
606                 },
607                 {
608                         image="default_lava_flowing_animated.png",
609                         backface_culling=true,
610                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
611                 },
612         },
613         paramtype = "light",
614         paramtype2 = "flowingliquid",
615         light_source = LIGHT_MAX - 1,
616         walkable = false,
617         pointable = false,
618         diggable = false,
619         buildable_to = true,
620         drop = "",
621         drowning = 1,
622         liquidtype = "flowing",
623         liquid_alternative_flowing = "default:lava_flowing",
624         liquid_alternative_source = "default:lava_source",
625         liquid_viscosity = LAVA_VISC,
626         liquid_renewable = false,
627         damage_per_second = 4*2,
628         post_effect_color = {a=192, r=255, g=64, b=0},
629         groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
630 })
631
632 minetest.register_node("default:lava_source", {
633         description = "Lava Source",
634         inventory_image = minetest.inventorycube("default_lava.png"),
635         drawtype = "liquid",
636         tiles = {
637                 {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
638         },
639         special_tiles = {
640                 -- New-style lava source material (mostly unused)
641                 {
642                         name="default_lava_source_animated.png",
643                         animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0},
644                         backface_culling = false,
645                 }
646         },
647         paramtype = "light",
648         light_source = LIGHT_MAX - 1,
649         walkable = false,
650         pointable = false,
651         diggable = false,
652         buildable_to = true,
653         drop = "",
654         drowning = 1,
655         liquidtype = "source",
656         liquid_alternative_flowing = "default:lava_flowing",
657         liquid_alternative_source = "default:lava_source",
658         liquid_viscosity = LAVA_VISC,
659         liquid_renewable = false,
660         damage_per_second = 4*2,
661         post_effect_color = {a=192, r=255, g=64, b=0},
662         groups = {lava=3, liquid=2, hot=3, igniter=1},
663 })
664
665 minetest.register_node("default:torch", {
666         description = "Torch",
667         drawtype = "torchlike",
668         --tiles = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
669         tiles = {
670                 {name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
671                 {name="default_torch_on_ceiling_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
672                 {name="default_torch_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
673         },
674         inventory_image = "default_torch_on_floor.png",
675         wield_image = "default_torch_on_floor.png",
676         paramtype = "light",
677         paramtype2 = "wallmounted",
678         sunlight_propagates = true,
679         is_ground_content = false,
680         walkable = false,
681         light_source = LIGHT_MAX-1,
682         selection_box = {
683                 type = "wallmounted",
684                 wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
685                 wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
686                 wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
687         },
688         groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,hot=2},
689         legacy_wallmounted = true,
690         sounds = default.node_sound_defaults(),
691 })
692
693 minetest.register_node("default:sign_wall", {
694         description = "Sign",
695         drawtype = "signlike",
696         tiles = {"default_sign_wall.png"},
697         inventory_image = "default_sign_wall.png",
698         wield_image = "default_sign_wall.png",
699         paramtype = "light",
700         paramtype2 = "wallmounted",
701         sunlight_propagates = true,
702         is_ground_content = false,
703         walkable = false,
704         selection_box = {
705                 type = "wallmounted",
706                 --wall_top = <default>
707                 --wall_bottom = <default>
708                 --wall_side = <default>
709         },
710         groups = {choppy=2,dig_immediate=2,attached_node=1},
711         legacy_wallmounted = true,
712         sounds = default.node_sound_defaults(),
713         on_construct = function(pos)
714                 --local n = minetest.get_node(pos)
715                 local meta = minetest.get_meta(pos)
716                 meta:set_string("formspec", "field[text;;${text}]")
717                 meta:set_string("infotext", "\"\"")
718         end,
719         on_receive_fields = function(pos, formname, fields, sender)
720                 --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
721                 if minetest.is_protected(pos, sender:get_player_name()) then
722                         minetest.record_protection_violation(pos, sender:get_player_name())
723                         return
724                 end
725                 local meta = minetest.get_meta(pos)
726                 if not fields.text then return end
727                 minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text..
728                                 "\" to sign at "..minetest.pos_to_string(pos))
729                 meta:set_string("text", fields.text)
730                 meta:set_string("infotext", '"'..fields.text..'"')
731         end,
732 })
733
734 default.chest_formspec = 
735         "size[8,9]"..
736         default.gui_bg..
737         default.gui_bg_img..
738         default.gui_slots..
739         "list[current_name;main;0,0.3;8,4;]"..
740         "list[current_player;main;0,4.85;8,1;]"..
741         "list[current_player;main;0,6.08;8,3;8]"..
742         default.get_hotbar_bg(0,4.85)
743
744 function default.get_locked_chest_formspec(pos)
745         local spos = pos.x .. "," .. pos.y .. "," ..pos.z
746         local formspec =
747                 "size[8,9]"..
748                 default.gui_bg..
749                 default.gui_bg_img..
750                 default.gui_slots..
751                 "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]"..
752                 "list[current_player;main;0,4.85;8,1;]"..
753                 "list[current_player;main;0,6.08;8,3;8]"..
754                 default.get_hotbar_bg(0,4.85)
755  return formspec
756 end
757
758
759 minetest.register_node("default:chest", {
760         description = "Chest",
761         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
762                 "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
763         paramtype2 = "facedir",
764         groups = {choppy=2,oddly_breakable_by_hand=2},
765         legacy_facedir_simple = true,
766         is_ground_content = false,
767         sounds = default.node_sound_wood_defaults(),
768         on_construct = function(pos)
769                 local meta = minetest.get_meta(pos)
770                 meta:set_string("formspec",default.chest_formspec)
771                 meta:set_string("infotext", "Chest")
772                 local inv = meta:get_inventory()
773                 inv:set_size("main", 8*4)
774         end,
775         can_dig = function(pos,player)
776                 local meta = minetest.get_meta(pos);
777                 local inv = meta:get_inventory()
778                 return inv:is_empty("main")
779         end,
780         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
781                 minetest.log("action", player:get_player_name()..
782                                 " moves stuff in chest at "..minetest.pos_to_string(pos))
783         end,
784     on_metadata_inventory_put = function(pos, listname, index, stack, player)
785                 minetest.log("action", player:get_player_name()..
786                                 " moves stuff to chest at "..minetest.pos_to_string(pos))
787         end,
788     on_metadata_inventory_take = function(pos, listname, index, stack, player)
789                 minetest.log("action", player:get_player_name()..
790                                 " takes stuff from chest at "..minetest.pos_to_string(pos))
791         end,
792 })
793
794 local function has_locked_chest_privilege(meta, player)
795         if player:get_player_name() ~= meta:get_string("owner") then
796                 return false
797         end
798         return true
799 end
800
801 minetest.register_node("default:chest_locked", {
802         description = "Locked Chest",
803         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
804                 "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
805         paramtype2 = "facedir",
806         groups = {choppy=2,oddly_breakable_by_hand=2},
807         legacy_facedir_simple = true,
808         is_ground_content = false,
809         sounds = default.node_sound_wood_defaults(),
810         after_place_node = function(pos, placer)
811                 local meta = minetest.get_meta(pos)
812                 meta:set_string("owner", placer:get_player_name() or "")
813                 meta:set_string("infotext", "Locked Chest (owned by "..
814                                 meta:get_string("owner")..")")
815         end,
816         on_construct = function(pos)
817                 local meta = minetest.get_meta(pos)
818                 meta:set_string("infotext", "Locked Chest")
819                 meta:set_string("owner", "")
820                 local inv = meta:get_inventory()
821                 inv:set_size("main", 8*4)
822         end,
823         can_dig = function(pos,player)
824                 local meta = minetest.get_meta(pos);
825                 local inv = meta:get_inventory()
826                 return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
827         end,
828         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
829                 local meta = minetest.get_meta(pos)
830                 if not has_locked_chest_privilege(meta, player) then
831                         return 0
832                 end
833                 return count
834         end,
835     allow_metadata_inventory_put = function(pos, listname, index, stack, player)
836                 local meta = minetest.get_meta(pos)
837                 if not has_locked_chest_privilege(meta, player) then
838                         return 0
839                 end
840                 return stack:get_count()
841         end,
842     allow_metadata_inventory_take = function(pos, listname, index, stack, player)
843                 local meta = minetest.get_meta(pos)
844                 if not has_locked_chest_privilege(meta, player) then
845                         return 0
846                 end
847                 return stack:get_count()
848         end,
849     on_metadata_inventory_put = function(pos, listname, index, stack, player)
850                 minetest.log("action", player:get_player_name()..
851                                 " moves stuff to locked chest at "..minetest.pos_to_string(pos))
852         end,
853     on_metadata_inventory_take = function(pos, listname, index, stack, player)
854                 minetest.log("action", player:get_player_name()..
855                                 " takes stuff from locked chest at "..minetest.pos_to_string(pos))
856         end,
857         on_rightclick = function(pos, node, clicker)
858                 local meta = minetest.get_meta(pos)
859                 if has_locked_chest_privilege(meta, clicker) then
860                         minetest.show_formspec(
861                                 clicker:get_player_name(),
862                                 "default:chest_locked",
863                                 default.get_locked_chest_formspec(pos)
864                         )
865                 end
866         end,
867 })
868
869 function default.furnace_active(pos, percent, item_percent)
870     local formspec = 
871         "size[8,8.5]"..
872         default.gui_bg..
873         default.gui_bg_img..
874         default.gui_slots..
875         "list[current_name;src;2.75,0.5;1,1;]"..
876         "list[current_name;fuel;2.75,2.5;1,1;]"..
877         "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
878         (100-percent)..":default_furnace_fire_fg.png]"..
879         "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
880         (item_percent*100)..":gui_furnace_arrow_fg.png^[transformR270]"..
881         "list[current_name;dst;4.75,0.96;2,2;]"..
882         "list[current_player;main;0,4.25;8,1;]"..
883         "list[current_player;main;0,5.5;8,3;8]"..
884         default.get_hotbar_bg(0,4.25)
885     return formspec
886   end
887
888 function default.get_furnace_active_formspec(pos, percent)
889         local meta = minetest.get_meta(pos)local inv = meta:get_inventory()
890         local srclist = inv:get_list("src")
891         local cooked = nil
892         local aftercooked = nil
893         if srclist then
894                 cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
895         end
896         local item_percent = 0
897         if cooked then
898                 item_percent = meta:get_float("src_time")/cooked.time
899         end
900        
901         return default.furnace_active(pos, percent, item_percent)
902 end
903
904 default.furnace_inactive_formspec =
905         "size[8,8.5]"..
906         default.gui_bg..
907         default.gui_bg_img..
908         default.gui_slots..
909         "list[current_name;src;2.75,0.5;1,1;]"..
910         "list[current_name;fuel;2.75,2.5;1,1;]"..
911         "image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
912         "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
913         "list[current_name;dst;4.75,0.96;2,2;]"..
914         "list[current_player;main;0,4.25;8,1;]"..
915         "list[current_player;main;0,5.5;8,3;8]"..
916         default.get_hotbar_bg(0,4.25)
917
918 minetest.register_node("default:furnace", {
919         description = "Furnace",
920         tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
921                 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
922         paramtype2 = "facedir",
923         groups = {cracky=2},
924         legacy_facedir_simple = true,
925         is_ground_content = false,
926         sounds = default.node_sound_stone_defaults(),
927         on_construct = function(pos)
928                 local meta = minetest.get_meta(pos)
929                 meta:set_string("formspec", default.furnace_inactive_formspec)
930                 meta:set_string("infotext", "Furnace")
931                 local inv = meta:get_inventory()
932                 inv:set_size("fuel", 1)
933                 inv:set_size("src", 1)
934                 inv:set_size("dst", 4)
935         end,
936         can_dig = function(pos,player)
937                 local meta = minetest.get_meta(pos);
938                 local inv = meta:get_inventory()
939                 if not inv:is_empty("fuel") then
940                         return false
941                 elseif not inv:is_empty("dst") then
942                         return false
943                 elseif not inv:is_empty("src") then
944                         return false
945                 end
946                 return true
947         end,
948         allow_metadata_inventory_put = function(pos, listname, index, stack, player)
949                 if minetest.is_protected(pos, player:get_player_name()) then
950                         return 0
951                 end
952                 local meta = minetest.get_meta(pos)
953                 local inv = meta:get_inventory()
954                 if listname == "fuel" then
955                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
956                                 if inv:is_empty("src") then
957                                         meta:set_string("infotext","Furnace is empty")
958                                 end
959                                 return stack:get_count()
960                         else
961                                 return 0
962                         end
963                 elseif listname == "src" then
964                         return stack:get_count()
965                 elseif listname == "dst" then
966                         return 0
967                 end
968         end,
969         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
970                 if minetest.is_protected(pos, player:get_player_name()) then
971                         return 0
972                 end
973                 local meta = minetest.get_meta(pos)
974                 local inv = meta:get_inventory()
975                 local stack = inv:get_stack(from_list, from_index)
976                 if to_list == "fuel" then
977                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
978                                 if inv:is_empty("src") then
979                                         meta:set_string("infotext","Furnace is empty")
980                                 end
981                                 return count
982                         else
983                                 return 0
984                         end
985                 elseif to_list == "src" then
986                         return count
987                 elseif to_list == "dst" then
988                         return 0
989                 end
990         end,
991         allow_metadata_inventory_take = function(pos, listname, index, stack, player)
992                 if minetest.is_protected(pos, player:get_player_name()) then
993                         return 0
994                 end
995                 return stack:get_count()
996         end,
997 })
998
999 minetest.register_node("default:furnace_active", {
1000         description = "Furnace",
1001         tiles = {
1002                 "default_furnace_top.png",
1003                 "default_furnace_bottom.png",
1004                 "default_furnace_side.png",
1005                 "default_furnace_side.png",
1006                 "default_furnace_side.png",
1007                 {
1008                         image = "default_furnace_front_active.png",
1009                         backface_culling = false,
1010                         animation = {
1011                                 type = "vertical_frames",
1012                                 aspect_w = 16,
1013                                 aspect_h = 16,
1014                                 length = 1.5
1015                         },
1016                 }
1017         },
1018         paramtype2 = "facedir",
1019         light_source = 8,
1020         drop = "default:furnace",
1021         groups = {cracky=2, not_in_creative_inventory=1,hot=1},
1022         legacy_facedir_simple = true,
1023         is_ground_content = false,
1024         sounds = default.node_sound_stone_defaults(),
1025         on_construct = function(pos)
1026                 local meta = minetest.get_meta(pos)
1027                 meta:set_string("formspec", default.furnace_inactive_formspec)
1028                 meta:set_string("infotext", "Furnace");
1029                 local inv = meta:get_inventory()
1030                 inv:set_size("fuel", 1)
1031                 inv:set_size("src", 1)
1032                 inv:set_size("dst", 4)
1033         end,
1034         can_dig = function(pos,player)
1035                 local meta = minetest.get_meta(pos);
1036                 local inv = meta:get_inventory()
1037                 if not inv:is_empty("fuel") then
1038                         return false
1039                 elseif not inv:is_empty("dst") then
1040                         return false
1041                 elseif not inv:is_empty("src") then
1042                         return false
1043                 end
1044                 return true
1045         end,
1046         allow_metadata_inventory_put = function(pos, listname, index, stack, player)
1047                 if minetest.is_protected(pos, player:get_player_name()) then
1048                         return 0
1049                 end
1050                 local meta = minetest.get_meta(pos)
1051                 local inv = meta:get_inventory()
1052                 if listname == "fuel" then
1053                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
1054                                 if inv:is_empty("src") then
1055                                         meta:set_string("infotext","Furnace is empty")
1056                                 end
1057                                 return stack:get_count()
1058                         else
1059                                 return 0
1060                         end
1061                 elseif listname == "src" then
1062                         return stack:get_count()
1063                 elseif listname == "dst" then
1064                         return 0
1065                 end
1066         end,
1067         allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
1068                 if minetest.is_protected(pos, player:get_player_name()) then
1069                         return 0
1070                 end
1071                 local meta = minetest.get_meta(pos)
1072                 local inv = meta:get_inventory()
1073                 local stack = inv:get_stack(from_list, from_index)
1074                 if to_list == "fuel" then
1075                         if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
1076                                 if inv:is_empty("src") then
1077                                         meta:set_string("infotext","Furnace is empty")
1078                                 end
1079                                 return count
1080                         else
1081                                 return 0
1082                         end
1083                 elseif to_list == "src" then
1084                         return count
1085                 elseif to_list == "dst" then
1086                         return 0
1087                 end
1088         end,
1089         allow_metadata_inventory_take = function(pos, listname, index, stack, player)
1090                 if minetest.is_protected(pos, player:get_player_name()) then
1091                         return 0
1092                 end
1093                 return stack:get_count()
1094         end,
1095 })
1096
1097 local function swap_node(pos,name)
1098         local node = minetest.get_node(pos)
1099         if node.name == name then
1100                 return
1101         end
1102         node.name = name
1103         minetest.swap_node(pos,node)
1104 end
1105
1106 minetest.register_abm({
1107         nodenames = {"default:furnace","default:furnace_active"},
1108         interval = 1.0,
1109         chance = 1,
1110         action = function(pos, node, active_object_count, active_object_count_wider)
1111                 local meta = minetest.get_meta(pos)
1112                 for i, name in ipairs({
1113                                 "fuel_totaltime",
1114                                 "fuel_time",
1115                                 "src_totaltime",
1116                                 "src_time"
1117                 }) do
1118                         if meta:get_string(name) == "" then
1119                                 meta:set_float(name, 0.0)
1120                         end
1121                 end
1122
1123                 local inv = meta:get_inventory()
1124
1125                 local srclist = inv:get_list("src")
1126                 local cooked = nil
1127                 local aftercooked
1128                 
1129                 if srclist then
1130                         cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
1131                 end
1132                 
1133                 local was_active = false
1134                 
1135                 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
1136                         was_active = true
1137                         meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
1138                         meta:set_float("src_time", meta:get_float("src_time") + 1)
1139                         if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
1140                                 -- check if there's room for output in "dst" list
1141                                 if inv:room_for_item("dst",cooked.item) then
1142                                         -- Put result in "dst" list
1143                                         inv:add_item("dst", cooked.item)
1144                                         -- take stuff from "src" list
1145                                         inv:set_stack("src", 1, aftercooked.items[1])
1146                                 else
1147                                         --print("Could not insert '"..cooked.item:to_string().."'")
1148                                 end
1149                                 meta:set_string("src_time", 0)
1150                         end
1151                 end
1152                 
1153                 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
1154                         local percent = math.floor(meta:get_float("fuel_time") /
1155                                         meta:get_float("fuel_totaltime") * 100)
1156                         meta:set_string("infotext","Furnace active: "..percent.."%")
1157                         swap_node(pos,"default:furnace_active")
1158                         meta:set_string("formspec",default.get_furnace_active_formspec(pos, percent))
1159                         return
1160                 end
1161
1162                 local fuel = nil
1163                 local afterfuel
1164                 local cooked = nil
1165                 local fuellist = inv:get_list("fuel")
1166                 local srclist = inv:get_list("src")
1167                 
1168                 if srclist then
1169                         cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
1170                 end
1171                 if fuellist then
1172                         fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
1173                 end
1174
1175                 if not fuel or fuel.time <= 0 then
1176                         meta:set_string("infotext","Furnace out of fuel")
1177                         swap_node(pos,"default:furnace")
1178                         meta:set_string("formspec", default.furnace_inactive_formspec)
1179                         return
1180                 end
1181
1182                 if cooked.item:is_empty() then
1183                         if was_active then
1184                                 meta:set_string("infotext","Furnace is empty")
1185                                 swap_node(pos,"default:furnace")
1186                                 meta:set_string("formspec", default.furnace_inactive_formspec)
1187                         end
1188                         return
1189                 end
1190
1191                 meta:set_string("fuel_totaltime", fuel.time)
1192                 meta:set_string("fuel_time", 0)
1193                 
1194                 inv:set_stack("fuel", 1, afterfuel.items[1])
1195         end,
1196 })
1197
1198 minetest.register_node("default:cobble", {
1199         description = "Cobblestone",
1200         tiles = {"default_cobble.png"},
1201         is_ground_content = true,
1202         groups = {cracky=3, stone=2},
1203         sounds = default.node_sound_stone_defaults(),
1204 })
1205
1206 minetest.register_node("default:desert_cobble", {
1207         description = "Desert Cobblestone",
1208         tiles = {"default_desert_cobble.png"},
1209         is_ground_content = true,
1210         groups = {cracky=3, stone=2},
1211         sounds = default.node_sound_stone_defaults(),
1212 })
1213
1214 minetest.register_node("default:mossycobble", {
1215         description = "Mossy Cobblestone",
1216         tiles = {"default_mossycobble.png"},
1217         is_ground_content = true,
1218         groups = {cracky=3},
1219         sounds = default.node_sound_stone_defaults(),
1220 })
1221
1222 minetest.register_node("default:coalblock", {
1223         description = "Coal Block",
1224         tiles = {"default_coal_block.png"},
1225         is_ground_content = true,
1226         groups = {cracky=3},
1227         sounds = default.node_sound_stone_defaults(),
1228 })
1229
1230 minetest.register_node("default:steelblock", {
1231         description = "Steel Block",
1232         tiles = {"default_steel_block.png"},
1233         is_ground_content = true,
1234         groups = {cracky=1,level=2},
1235         sounds = default.node_sound_stone_defaults(),
1236 })
1237
1238 minetest.register_node("default:copperblock", {
1239         description = "Copper Block",
1240         tiles = {"default_copper_block.png"},
1241         is_ground_content = true,
1242         groups = {cracky=1,level=2},
1243         sounds = default.node_sound_stone_defaults(),
1244 })
1245
1246 minetest.register_node("default:bronzeblock", {
1247         description = "Bronze Block",
1248         tiles = {"default_bronze_block.png"},
1249         is_ground_content = true,
1250         groups = {cracky=1,level=2},
1251         sounds = default.node_sound_stone_defaults(),
1252 })
1253
1254 minetest.register_node("default:mese", {
1255         description = "Mese Block",
1256         tiles = {"default_mese_block.png"},
1257         is_ground_content = true,
1258         groups = {cracky=1,level=2},
1259         sounds = default.node_sound_stone_defaults(),
1260 })
1261 minetest.register_alias("default:mese_block", "default:mese")
1262
1263 minetest.register_node("default:goldblock", {
1264         description = "Gold Block",
1265         tiles = {"default_gold_block.png"},
1266         is_ground_content = true,
1267         groups = {cracky=1},
1268         sounds = default.node_sound_stone_defaults(),
1269 })
1270
1271 minetest.register_node("default:diamondblock", {
1272         description = "Diamond Block",
1273         tiles = {"default_diamond_block.png"},
1274         is_ground_content = true,
1275         groups = {cracky=1,level=3},
1276         sounds = default.node_sound_stone_defaults(),
1277 })
1278
1279 minetest.register_node("default:obsidian_glass", {
1280         description = "Obsidian Glass",
1281         drawtype = "glasslike",
1282         tiles = {"default_obsidian_glass.png"},
1283         paramtype = "light",
1284         is_ground_content = false,
1285         sunlight_propagates = true,
1286         sounds = default.node_sound_glass_defaults(),
1287         groups = {cracky=3,oddly_breakable_by_hand=3},
1288 })
1289
1290 minetest.register_node("default:obsidian", {
1291         description = "Obsidian",
1292         tiles = {"default_obsidian.png"},
1293         is_ground_content = true,
1294         sounds = default.node_sound_stone_defaults(),
1295         groups = {cracky=1,level=2},
1296 })
1297
1298 minetest.register_node("default:nyancat", {
1299         description = "Nyan Cat",
1300         tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
1301                 "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
1302         paramtype2 = "facedir",
1303         groups = {cracky=2},
1304         is_ground_content = false,
1305         legacy_facedir_simple = true,
1306         sounds = default.node_sound_defaults(),
1307 })
1308
1309 minetest.register_node("default:nyancat_rainbow", {
1310         description = "Nyan Cat Rainbow",
1311         tiles = {"default_nc_rb.png^[transformR90", "default_nc_rb.png^[transformR90",
1312                 "default_nc_rb.png", "default_nc_rb.png"},
1313         paramtype2 = "facedir",
1314         groups = {cracky=2},
1315         is_ground_content = false,
1316         sounds = default.node_sound_defaults(),
1317 })
1318
1319 minetest.register_node("default:sapling", {
1320         description = "Sapling",
1321         drawtype = "plantlike",
1322         visual_scale = 1.0,
1323         tiles = {"default_sapling.png"},
1324         inventory_image = "default_sapling.png",
1325         wield_image = "default_sapling.png",
1326         paramtype = "light",
1327         walkable = false,
1328         is_ground_content = true,
1329         selection_box = {
1330                 type = "fixed",
1331                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
1332         },
1333         groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
1334         sounds = default.node_sound_leaves_defaults(),
1335 })
1336
1337 minetest.register_node("default:apple", {
1338         description = "Apple",
1339         drawtype = "plantlike",
1340         visual_scale = 1.0,
1341         tiles = {"default_apple.png"},
1342         inventory_image = "default_apple.png",
1343         paramtype = "light",
1344         sunlight_propagates = true,
1345         walkable = false,
1346         is_ground_content = true,
1347         selection_box = {
1348                 type = "fixed",
1349                 fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
1350         },
1351         groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
1352         on_use = minetest.item_eat(1),
1353         sounds = default.node_sound_leaves_defaults(),
1354         after_place_node = function(pos, placer, itemstack)
1355                 if placer:is_player() then
1356                         minetest.set_node(pos, {name="default:apple", param2=1})
1357                 end
1358         end,
1359 })
1360
1361 minetest.register_node("default:dry_shrub", {
1362         description = "Dry Shrub",
1363         drawtype = "plantlike",
1364         waving = 1,
1365         visual_scale = 1.0,
1366         tiles = {"default_dry_shrub.png"},
1367         inventory_image = "default_dry_shrub.png",
1368         wield_image = "default_dry_shrub.png",
1369         paramtype = "light",
1370         walkable = false,
1371         is_ground_content = true,
1372         buildable_to = true,
1373         groups = {snappy=3,flammable=3,attached_node=1},
1374         sounds = default.node_sound_leaves_defaults(),
1375         selection_box = {
1376                 type = "fixed",
1377                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1378         },
1379 })
1380
1381 minetest.register_node("default:grass_1", {
1382         description = "Grass",
1383         drawtype = "plantlike",
1384         waving = 1,
1385         tiles = {"default_grass_1.png"},
1386         -- use a bigger inventory image
1387         inventory_image = "default_grass_3.png",
1388         wield_image = "default_grass_3.png",
1389         paramtype = "light",
1390         walkable = false,
1391         is_ground_content = true,
1392         buildable_to = true,
1393         groups = {snappy=3,flammable=3,flora=1,attached_node=1},
1394         sounds = default.node_sound_leaves_defaults(),
1395         selection_box = {
1396                 type = "fixed",
1397                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1398         },
1399         on_place = function(itemstack, placer, pointed_thing)
1400                 -- place a random grass node
1401                 local stack = ItemStack("default:grass_"..math.random(1,5))
1402                 local ret = minetest.item_place(stack, placer, pointed_thing)
1403                 return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
1404         end,
1405 })
1406
1407 for i=2,5 do
1408         minetest.register_node("default:grass_"..i, {
1409                 description = "Grass",
1410                 drawtype = "plantlike",
1411                 waving = 1,
1412                 tiles = {"default_grass_"..i..".png"},
1413                 inventory_image = "default_grass_"..i..".png",
1414                 wield_image = "default_grass_"..i..".png",
1415                 paramtype = "light",
1416                 walkable = false,
1417                 buildable_to = true,
1418                 is_ground_content = true,
1419                 drop = "default:grass_1",
1420                 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1421                 sounds = default.node_sound_leaves_defaults(),
1422                 selection_box = {
1423                         type = "fixed",
1424                         fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1425                 },
1426         })
1427 end
1428
1429 minetest.register_node("default:ice", {
1430         description = "Ice",
1431         tiles = {"default_ice.png"},
1432         is_ground_content = true,
1433         paramtype = "light",
1434         freezemelt = "default:water_source",
1435         groups = {cracky=3, melts=1},
1436         sounds = default.node_sound_glass_defaults(),
1437 })
1438
1439 minetest.register_node("default:snow", {
1440         description = "Snow",
1441         tiles = {"default_snow.png"},
1442         inventory_image = "default_snowball.png",
1443         wield_image = "default_snowball.png",
1444         is_ground_content = true,
1445         paramtype = "light",
1446         buildable_to = true,
1447         leveled = 7,
1448         drawtype = "nodebox",
1449         freezemelt = "default:water_flowing",
1450         node_box = {
1451                 type = "leveled",
1452                 fixed = {
1453                         {-0.5, -0.5, -0.5,  0.5, -0.5+2/16, 0.5},
1454                 },
1455         },
1456         groups = {crumbly=3,falling_node=1, melts=1, float=1},
1457         sounds = default.node_sound_dirt_defaults({
1458                 footstep = {name="default_snow_footstep", gain=0.25},
1459                 dug = {name="default_snow_footstep", gain=0.75},
1460         }),
1461         on_construct = function(pos)
1462                 pos.y = pos.y - 1
1463                 if minetest.get_node(pos).name == "default:dirt_with_grass" then
1464                         minetest.set_node(pos, {name="default:dirt_with_snow"})
1465                 end
1466         end,
1467 })
1468 minetest.register_alias("snow", "default:snow")
1469
1470 minetest.register_node("default:snowblock", {
1471         description = "Snow Block",
1472         tiles = {"default_snow.png"},
1473         is_ground_content = true,
1474         freezemelt = "default:water_source",
1475         groups = {crumbly=3, melts=1},
1476         sounds = default.node_sound_dirt_defaults({
1477                 footstep = {name="default_snow_footstep", gain=0.25},
1478                 dug = {name="default_snow_footstep", gain=0.75},
1479         }),
1480 })