Merge 0.4.16 into stable-0.4
[oweals/minetest_game.git] / mods / default / nodes.lua
1 -- mods/default/nodes.lua
2
3
4 --[[ Node name convention:
5
6 Although many node names are in combined-word form, the required form for new
7 node names is words separated by underscores. If both forms are used in written
8 language (for example pinewood and pine wood) the underscore form should be used.
9
10 --]]
11
12
13 --[[ Index:
14
15 Stone
16 -----
17 (1. Material 2. Cobble variant 3. Brick variant 4. Modified forms)
18
19 default:stone
20 default:cobble
21 default:stonebrick
22 default:stone_block
23 default:mossycobble
24
25 default:desert_stone
26 default:desert_cobble
27 default:desert_stonebrick
28 default:desert_stone_block
29
30 default:sandstone
31 default:sandstonebrick
32 default:sandstone_block
33 default:desert_sandstone
34 default:desert_sandstone_brick
35 default:desert_sandstone_block
36 default:silver_sandstone
37 default:silver_sandstone_brick
38 default:silver_sandstone_block
39
40 default:obsidian
41 default:obsidianbrick
42 default:obsidian_block
43
44 Soft / Non-Stone
45 ----------------
46 (1. Material 2. Modified forms)
47
48 default:dirt
49 default:dirt_with_grass
50 default:dirt_with_grass_footsteps
51 default:dirt_with_dry_grass
52 default:dirt_with_snow
53 default:dirt_with_rainforest_litter
54
55 default:sand
56 default:desert_sand
57 default:silver_sand
58
59 default:gravel
60
61 default:clay
62
63 default:snow
64 default:snowblock
65
66 default:ice
67
68 Trees
69 -----
70 (1. Trunk 2. Fabricated trunk 3. Leaves 4. Sapling 5. Fruits)
71
72 default:tree
73 default:wood
74 default:leaves
75 default:sapling
76 default:apple
77
78 default:jungletree
79 default:junglewood
80 default:jungleleaves
81 default:junglesapling
82
83 default:pine_tree
84 default:pine_wood
85 default:pine_needles
86 default:pine_sapling
87
88 default:acacia_tree
89 default:acacia_wood
90 default:acacia_leaves
91 default:acacia_sapling
92
93 default:aspen_tree
94 default:aspen_wood
95 default:aspen_leaves
96 default:aspen_sapling
97
98 Ores
99 ----
100 (1. In stone 2. Blocks)
101
102 default:stone_with_coal
103 default:coalblock
104
105 default:stone_with_iron
106 default:steelblock
107
108 default:stone_with_copper
109 default:copperblock
110
111 default:stone_with_tin
112 default:tinblock
113
114 default:bronzeblock
115
116 default:stone_with_gold
117 default:goldblock
118
119 default:stone_with_mese
120 default:mese
121
122 default:stone_with_diamond
123 default:diamondblock
124
125 Plantlife
126 ---------
127
128 default:cactus
129 default:papyrus
130 default:dry_shrub
131 default:junglegrass
132
133 default:grass_1
134 default:grass_2
135 default:grass_3
136 default:grass_4
137 default:grass_5
138
139 default:dry_grass_1
140 default:dry_grass_2
141 default:dry_grass_3
142 default:dry_grass_4
143 default:dry_grass_5
144
145 default:bush_stem
146 default:bush_leaves
147 default:bush_sapling
148 default:acacia_bush_stem
149 default:acacia_bush_leaves
150 default:acacia_bush_sapling
151
152 Corals
153 ------
154
155 default:coral_brown
156 default:coral_orange
157 default:coral_skeleton
158
159 Liquids
160 -------
161 (1. Source 2. Flowing)
162
163 default:water_source
164 default:water_flowing
165
166 default:river_water_source
167 default:river_water_flowing
168
169 default:lava_source
170 default:lava_flowing
171
172 Tools / "Advanced" crafting / Non-"natural"
173 -------------------------------------------
174
175 default:chest
176 default:chest_locked
177
178 default:bookshelf
179
180 default:sign_wall_wood
181 default:sign_wall_steel
182
183 default:ladder_wood
184 default:ladder_steel
185
186 default:fence_wood
187 default:fence_acacia_wood
188 default:fence_junglewood
189 default:fence_pine_wood
190 default:fence_aspen_wood
191
192 default:glass
193 default:obsidian_glass
194
195 default:brick
196
197 default:meselamp
198 default:mese_post_light
199
200 Misc
201 ----
202
203 default:cloud
204
205 --]]
206
207 --
208 -- Stone
209 --
210
211 minetest.register_node("default:stone", {
212         description = "Stone",
213         tiles = {"default_stone.png"},
214         groups = {cracky = 3, stone = 1},
215         drop = 'default:cobble',
216         legacy_mineral = true,
217         sounds = default.node_sound_stone_defaults(),
218 })
219
220 minetest.register_node("default:cobble", {
221         description = "Cobblestone",
222         tiles = {"default_cobble.png"},
223         is_ground_content = false,
224         groups = {cracky = 3, stone = 2},
225         sounds = default.node_sound_stone_defaults(),
226 })
227
228 minetest.register_node("default:stonebrick", {
229         description = "Stone Brick",
230         paramtype2 = "facedir",
231         place_param2 = 0,
232         tiles = {"default_stone_brick.png"},
233         is_ground_content = false,
234         groups = {cracky = 2, stone = 1},
235         sounds = default.node_sound_stone_defaults(),
236 })
237
238 minetest.register_node("default:stone_block", {
239         description = "Stone Block",
240         tiles = {"default_stone_block.png"},
241         is_ground_content = false,
242         groups = {cracky = 2, stone = 1},
243         sounds = default.node_sound_stone_defaults(),
244 })
245
246 minetest.register_node("default:mossycobble", {
247         description = "Mossy Cobblestone",
248         tiles = {"default_mossycobble.png"},
249         is_ground_content = false,
250         groups = {cracky = 3, stone = 1},
251         sounds = default.node_sound_stone_defaults(),
252 })
253
254
255 minetest.register_node("default:desert_stone", {
256         description = "Desert Stone",
257         tiles = {"default_desert_stone.png"},
258         groups = {cracky = 3, stone = 1},
259         drop = 'default:desert_cobble',
260         legacy_mineral = true,
261         sounds = default.node_sound_stone_defaults(),
262 })
263
264 minetest.register_node("default:desert_cobble", {
265         description = "Desert Cobblestone",
266         tiles = {"default_desert_cobble.png"},
267         is_ground_content = false,
268         groups = {cracky = 3, stone = 2},
269         sounds = default.node_sound_stone_defaults(),
270 })
271
272 minetest.register_node("default:desert_stonebrick", {
273         description = "Desert Stone Brick",
274         paramtype2 = "facedir",
275         place_param2 = 0,
276         tiles = {"default_desert_stone_brick.png"},
277         is_ground_content = false,
278         groups = {cracky = 2, stone = 1},
279         sounds = default.node_sound_stone_defaults(),
280 })
281
282 minetest.register_node("default:desert_stone_block", {
283         description = "Desert Stone Block",
284         tiles = {"default_desert_stone_block.png"},
285         is_ground_content = false,
286         groups = {cracky = 2, stone = 1},
287         sounds = default.node_sound_stone_defaults(),
288 })
289
290 minetest.register_node("default:sandstone", {
291         description = "Sandstone",
292         tiles = {"default_sandstone.png"},
293         groups = {crumbly = 1, cracky = 3},
294         sounds = default.node_sound_stone_defaults(),
295 })
296
297 minetest.register_node("default:sandstonebrick", {
298         description = "Sandstone Brick",
299         paramtype2 = "facedir",
300         place_param2 = 0,
301         tiles = {"default_sandstone_brick.png"},
302         is_ground_content = false,
303         groups = {cracky = 2},
304         sounds = default.node_sound_stone_defaults(),
305 })
306
307 minetest.register_node("default:sandstone_block", {
308         description = "Sandstone Block",
309         tiles = {"default_sandstone_block.png"},
310         is_ground_content = false,
311         groups = {cracky = 2},
312         sounds = default.node_sound_stone_defaults(),
313 })
314
315 minetest.register_node("default:desert_sandstone", {
316         description = "Desert Sandstone",
317         tiles = {"default_desert_sandstone.png"},
318         groups = {crumbly = 1, cracky = 3},
319         sounds = default.node_sound_stone_defaults(),
320 })
321
322 minetest.register_node("default:desert_sandstone_brick", {
323         description = "Desert Sandstone Brick",
324         paramtype2 = "facedir",
325         place_param2 = 0,
326         tiles = {"default_desert_sandstone_brick.png"},
327         is_ground_content = false,
328         groups = {cracky = 2},
329         sounds = default.node_sound_stone_defaults(),
330 })
331
332 minetest.register_node("default:desert_sandstone_block", {
333         description = "Desert Sandstone Block",
334         tiles = {"default_desert_sandstone_block.png"},
335         is_ground_content = false,
336         groups = {cracky = 2},
337         sounds = default.node_sound_stone_defaults(),
338 })
339
340 minetest.register_node("default:silver_sandstone", {
341         description = "Silver Sandstone",
342         tiles = {"default_silver_sandstone.png"},
343         groups = {crumbly = 1, cracky = 3},
344         sounds = default.node_sound_stone_defaults(),
345 })
346
347 minetest.register_node("default:silver_sandstone_brick", {
348         description = "Silver Sandstone Brick",
349         paramtype2 = "facedir",
350         place_param2 = 0,
351         tiles = {"default_silver_sandstone_brick.png"},
352         is_ground_content = false,
353         groups = {cracky = 2},
354         sounds = default.node_sound_stone_defaults(),
355 })
356
357 minetest.register_node("default:silver_sandstone_block", {
358         description = "Silver Sandstone Block",
359         tiles = {"default_silver_sandstone_block.png"},
360         is_ground_content = false,
361         groups = {cracky = 2},
362         sounds = default.node_sound_stone_defaults(),
363 })
364
365 minetest.register_node("default:obsidian", {
366         description = "Obsidian",
367         tiles = {"default_obsidian.png"},
368         sounds = default.node_sound_stone_defaults(),
369         groups = {cracky = 1, level = 2},
370 })
371
372 minetest.register_node("default:obsidianbrick", {
373         description = "Obsidian Brick",
374         paramtype2 = "facedir",
375         place_param2 = 0,
376         tiles = {"default_obsidian_brick.png"},
377         is_ground_content = false,
378         sounds = default.node_sound_stone_defaults(),
379         groups = {cracky = 1, level = 2},
380 })
381
382 minetest.register_node("default:obsidian_block", {
383         description = "Obsidian Block",
384         tiles = {"default_obsidian_block.png"},
385         is_ground_content = false,
386         sounds = default.node_sound_stone_defaults(),
387         groups = {cracky = 1, level = 2},
388 })
389
390 --
391 -- Soft / Non-Stone
392 --
393
394 minetest.register_node("default:dirt", {
395         description = "Dirt",
396         tiles = {"default_dirt.png"},
397         groups = {crumbly = 3, soil = 1},
398         sounds = default.node_sound_dirt_defaults(),
399 })
400
401 minetest.register_node("default:dirt_with_grass", {
402         description = "Dirt with Grass",
403         tiles = {"default_grass.png", "default_dirt.png",
404                 {name = "default_dirt.png^default_grass_side.png",
405                         tileable_vertical = false}},
406         groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
407         drop = 'default:dirt',
408         sounds = default.node_sound_dirt_defaults({
409                 footstep = {name = "default_grass_footstep", gain = 0.25},
410         }),
411 })
412
413 minetest.register_node("default:dirt_with_grass_footsteps", {
414         description = "Dirt with Grass and Footsteps",
415         tiles = {"default_grass.png^default_footprint.png", "default_dirt.png",
416                 {name = "default_dirt.png^default_grass_side.png",
417                         tileable_vertical = false}},
418         groups = {crumbly = 3, soil = 1, not_in_creative_inventory = 1},
419         drop = 'default:dirt',
420         sounds = default.node_sound_dirt_defaults({
421                 footstep = {name = "default_grass_footstep", gain = 0.25},
422         }),
423 })
424
425 minetest.register_node("default:dirt_with_dry_grass", {
426         description = "Dirt with Dry Grass",
427         tiles = {"default_dry_grass.png",
428                 "default_dirt.png",
429                 {name = "default_dirt.png^default_dry_grass_side.png",
430                         tileable_vertical = false}},
431         groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
432         drop = 'default:dirt',
433         sounds = default.node_sound_dirt_defaults({
434                 footstep = {name = "default_grass_footstep", gain = 0.4},
435         }),
436 })
437
438 minetest.register_node("default:dirt_with_snow", {
439         description = "Dirt with Snow",
440         tiles = {"default_snow.png", "default_dirt.png",
441                 {name = "default_dirt.png^default_snow_side.png",
442                         tileable_vertical = false}},
443         groups = {crumbly = 3, spreading_dirt_type = 1, snowy = 1},
444         drop = 'default:dirt',
445         sounds = default.node_sound_dirt_defaults({
446                 footstep = {name = "default_snow_footstep", gain = 0.15},
447         }),
448 })
449
450 minetest.register_node("default:dirt_with_rainforest_litter", {
451         description = "Dirt with Rainforest Litter",
452         tiles = {
453                 "default_rainforest_litter.png",
454                 "default_dirt.png",
455                 {name = "default_dirt.png^default_rainforest_litter_side.png",
456                         tileable_vertical = false}
457         },
458         groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
459         drop = "default:dirt",
460         sounds = default.node_sound_dirt_defaults({
461                 footstep = {name = "default_grass_footstep", gain = 0.4},
462         }),
463 })
464
465 minetest.register_node("default:sand", {
466         description = "Sand",
467         tiles = {"default_sand.png"},
468         groups = {crumbly = 3, falling_node = 1, sand = 1},
469         sounds = default.node_sound_sand_defaults(),
470 })
471
472 minetest.register_node("default:desert_sand", {
473         description = "Desert Sand",
474         tiles = {"default_desert_sand.png"},
475         groups = {crumbly = 3, falling_node = 1, sand = 1},
476         sounds = default.node_sound_sand_defaults(),
477 })
478
479 minetest.register_node("default:silver_sand", {
480         description = "Silver Sand",
481         tiles = {"default_silver_sand.png"},
482         groups = {crumbly = 3, falling_node = 1, sand = 1},
483         sounds = default.node_sound_sand_defaults(),
484 })
485
486
487 minetest.register_node("default:gravel", {
488         description = "Gravel",
489         tiles = {"default_gravel.png"},
490         groups = {crumbly = 2, falling_node = 1},
491         sounds = default.node_sound_gravel_defaults(),
492         drop = {
493                 max_items = 1,
494                 items = {
495                         {items = {'default:flint'}, rarity = 16},
496                         {items = {'default:gravel'}}
497                 }
498         }
499 })
500
501 minetest.register_node("default:clay", {
502         description = "Clay",
503         tiles = {"default_clay.png"},
504         groups = {crumbly = 3},
505         drop = 'default:clay_lump 4',
506         sounds = default.node_sound_dirt_defaults(),
507 })
508
509
510 minetest.register_node("default:snow", {
511         description = "Snow",
512         tiles = {"default_snow.png"},
513         inventory_image = "default_snowball.png",
514         wield_image = "default_snowball.png",
515         paramtype = "light",
516         buildable_to = true,
517         floodable = true,
518         drawtype = "nodebox",
519         node_box = {
520                 type = "fixed",
521                 fixed = {
522                         {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
523                 },
524         },
525         groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 1},
526         sounds = default.node_sound_dirt_defaults({
527                 footstep = {name = "default_snow_footstep", gain = 0.15},
528                 dug = {name = "default_snow_footstep", gain = 0.2},
529                 dig = {name = "default_snow_footstep", gain = 0.2}
530         }),
531
532         on_construct = function(pos)
533                 pos.y = pos.y - 1
534                 if minetest.get_node(pos).name == "default:dirt_with_grass" then
535                         minetest.set_node(pos, {name = "default:dirt_with_snow"})
536                 end
537         end,
538 })
539
540 minetest.register_node("default:snowblock", {
541         description = "Snow Block",
542         tiles = {"default_snow.png"},
543         groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
544         sounds = default.node_sound_dirt_defaults({
545                 footstep = {name = "default_snow_footstep", gain = 0.15},
546                 dug = {name = "default_snow_footstep", gain = 0.2},
547                 dig = {name = "default_snow_footstep", gain = 0.2}
548         }),
549
550         on_construct = function(pos)
551                 pos.y = pos.y - 1
552                 if minetest.get_node(pos).name == "default:dirt_with_grass" then
553                         minetest.set_node(pos, {name = "default:dirt_with_snow"})
554                 end
555         end,
556 })
557
558 minetest.register_node("default:ice", {
559         description = "Ice",
560         tiles = {"default_ice.png"},
561         is_ground_content = false,
562         paramtype = "light",
563         groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1},
564         sounds = default.node_sound_glass_defaults(),
565 })
566
567 --
568 -- Trees
569 --
570
571 minetest.register_node("default:tree", {
572         description = "Tree",
573         tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
574         paramtype2 = "facedir",
575         is_ground_content = false,
576         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
577         sounds = default.node_sound_wood_defaults(),
578
579         on_place = minetest.rotate_node
580 })
581
582 minetest.register_node("default:wood", {
583         description = "Wooden Planks",
584         paramtype2 = "facedir",
585         place_param2 = 0,
586         tiles = {"default_wood.png"},
587         is_ground_content = false,
588         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
589         sounds = default.node_sound_wood_defaults(),
590 })
591
592 minetest.register_node("default:sapling", {
593         description = "Sapling",
594         drawtype = "plantlike",
595         tiles = {"default_sapling.png"},
596         inventory_image = "default_sapling.png",
597         wield_image = "default_sapling.png",
598         paramtype = "light",
599         sunlight_propagates = true,
600         walkable = false,
601         on_timer = default.grow_sapling,
602         selection_box = {
603                 type = "fixed",
604                 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
605         },
606         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
607                 attached_node = 1, sapling = 1},
608         sounds = default.node_sound_leaves_defaults(),
609
610         on_construct = function(pos)
611                 minetest.get_node_timer(pos):start(math.random(2400,4800))
612         end,
613
614         on_place = function(itemstack, placer, pointed_thing)
615                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
616                         "default:sapling",
617                         -- minp, maxp to be checked, relative to sapling pos
618                         -- minp_relative.y = 1 because sapling pos has been checked
619                         {x = -2, y = 1, z = -2},
620                         {x = 2, y = 6, z = 2},
621                         -- maximum interval of interior volume check
622                         4)
623
624                 return itemstack
625         end,
626 })
627
628 minetest.register_node("default:leaves", {
629         description = "Leaves",
630         drawtype = "allfaces_optional",
631         waving = 1,
632         tiles = {"default_leaves.png"},
633         special_tiles = {"default_leaves_simple.png"},
634         paramtype = "light",
635         is_ground_content = false,
636         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
637         drop = {
638                 max_items = 1,
639                 items = {
640                         {
641                                 -- player will get sapling with 1/20 chance
642                                 items = {'default:sapling'},
643                                 rarity = 20,
644                         },
645                         {
646                                 -- player will get leaves only if he get no saplings,
647                                 -- this is because max_items is 1
648                                 items = {'default:leaves'},
649                         }
650                 }
651         },
652         sounds = default.node_sound_leaves_defaults(),
653
654         after_place_node = default.after_place_leaves,
655 })
656
657 minetest.register_node("default:apple", {
658         description = "Apple",
659         drawtype = "plantlike",
660         tiles = {"default_apple.png"},
661         inventory_image = "default_apple.png",
662         paramtype = "light",
663         sunlight_propagates = true,
664         walkable = false,
665         is_ground_content = false,
666         selection_box = {
667                 type = "fixed",
668                 fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16}
669         },
670         groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
671                 leafdecay = 3, leafdecay_drop = 1},
672         on_use = minetest.item_eat(2),
673         sounds = default.node_sound_leaves_defaults(),
674
675         after_place_node = function(pos, placer, itemstack)
676                 if placer:is_player() then
677                         minetest.set_node(pos, {name = "default:apple", param2 = 1})
678                 end
679         end,
680 })
681
682
683 minetest.register_node("default:jungletree", {
684         description = "Jungle Tree",
685         tiles = {"default_jungletree_top.png", "default_jungletree_top.png",
686                 "default_jungletree.png"},
687         paramtype2 = "facedir",
688         is_ground_content = false,
689         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
690         sounds = default.node_sound_wood_defaults(),
691
692         on_place = minetest.rotate_node
693 })
694
695 minetest.register_node("default:junglewood", {
696         description = "Jungle Wood Planks",
697         paramtype2 = "facedir",
698         place_param2 = 0,
699         tiles = {"default_junglewood.png"},
700         is_ground_content = false,
701         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
702         sounds = default.node_sound_wood_defaults(),
703 })
704
705 minetest.register_node("default:jungleleaves", {
706         description = "Jungle Leaves",
707         drawtype = "allfaces_optional",
708         waving = 1,
709         tiles = {"default_jungleleaves.png"},
710         special_tiles = {"default_jungleleaves_simple.png"},
711         paramtype = "light",
712         is_ground_content = false,
713         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
714         drop = {
715                 max_items = 1,
716                 items = {
717                         {items = {'default:junglesapling'}, rarity = 20},
718                         {items = {'default:jungleleaves'}}
719                 }
720         },
721         sounds = default.node_sound_leaves_defaults(),
722
723         after_place_node = default.after_place_leaves,
724 })
725
726 minetest.register_node("default:junglesapling", {
727         description = "Jungle Sapling",
728         drawtype = "plantlike",
729         tiles = {"default_junglesapling.png"},
730         inventory_image = "default_junglesapling.png",
731         wield_image = "default_junglesapling.png",
732         paramtype = "light",
733         sunlight_propagates = true,
734         walkable = false,
735         on_timer = default.grow_sapling,
736         selection_box = {
737                 type = "fixed",
738                 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
739         },
740         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
741                 attached_node = 1, sapling = 1},
742         sounds = default.node_sound_leaves_defaults(),
743
744         on_construct = function(pos)
745                 minetest.get_node_timer(pos):start(math.random(2400,4800))
746         end,
747
748         on_place = function(itemstack, placer, pointed_thing)
749                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
750                         "default:junglesapling",
751                         -- minp, maxp to be checked, relative to sapling pos
752                         -- minp_relative.y = 1 because sapling pos has been checked
753                         {x = -2, y = 1, z = -2},
754                         {x = 2, y = 15, z = 2},
755                         -- maximum interval of interior volume check
756                         4)
757
758                 return itemstack
759         end,
760 })
761
762
763 minetest.register_node("default:pine_tree", {
764         description = "Pine Tree",
765         tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png",
766                 "default_pine_tree.png"},
767         paramtype2 = "facedir",
768         is_ground_content = false,
769         groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
770         sounds = default.node_sound_wood_defaults(),
771
772         on_place = minetest.rotate_node
773 })
774
775 minetest.register_node("default:pine_wood", {
776         description = "Pine Wood Planks",
777         paramtype2 = "facedir",
778         place_param2 = 0,
779         tiles = {"default_pine_wood.png"},
780         is_ground_content = false,
781         groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
782         sounds = default.node_sound_wood_defaults(),
783 })
784
785 minetest.register_node("default:pine_needles",{
786         description = "Pine Needles",
787         drawtype = "allfaces_optional",
788         tiles = {"default_pine_needles.png"},
789         waving = 1,
790         paramtype = "light",
791         is_ground_content = false,
792         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
793         drop = {
794                 max_items = 1,
795                 items = {
796                         {items = {"default:pine_sapling"}, rarity = 20},
797                         {items = {"default:pine_needles"}}
798                 }
799         },
800         sounds = default.node_sound_leaves_defaults(),
801
802         after_place_node = default.after_place_leaves,
803 })
804
805 minetest.register_node("default:pine_sapling", {
806         description = "Pine Sapling",
807         drawtype = "plantlike",
808         tiles = {"default_pine_sapling.png"},
809         inventory_image = "default_pine_sapling.png",
810         wield_image = "default_pine_sapling.png",
811         paramtype = "light",
812         sunlight_propagates = true,
813         walkable = false,
814         on_timer = default.grow_sapling,
815         selection_box = {
816                 type = "fixed",
817                 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
818         },
819         groups = {snappy = 2, dig_immediate = 3, flammable = 3,
820                 attached_node = 1, sapling = 1},
821         sounds = default.node_sound_leaves_defaults(),
822
823         on_construct = function(pos)
824                 minetest.get_node_timer(pos):start(math.random(2400,4800))
825         end,
826
827         on_place = function(itemstack, placer, pointed_thing)
828                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
829                         "default:pine_sapling",
830                         -- minp, maxp to be checked, relative to sapling pos
831                         -- minp_relative.y = 1 because sapling pos has been checked
832                         {x = -2, y = 1, z = -2},
833                         {x = 2, y = 12, z = 2},
834                         -- maximum interval of interior volume check
835                         4)
836
837                 return itemstack
838         end,
839 })
840
841
842 minetest.register_node("default:acacia_tree", {
843         description = "Acacia Tree",
844         tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png",
845                 "default_acacia_tree.png"},
846         paramtype2 = "facedir",
847         is_ground_content = false,
848         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
849         sounds = default.node_sound_wood_defaults(),
850
851         on_place = minetest.rotate_node
852 })
853
854 minetest.register_node("default:acacia_wood", {
855         description = "Acacia Wood Planks",
856         paramtype2 = "facedir",
857         place_param2 = 0,
858         tiles = {"default_acacia_wood.png"},
859         is_ground_content = false,
860         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
861         sounds = default.node_sound_wood_defaults(),
862 })
863
864 minetest.register_node("default:acacia_leaves", {
865         description = "Acacia Leaves",
866         drawtype = "allfaces_optional",
867         tiles = {"default_acacia_leaves.png"},
868         special_tiles = {"default_acacia_leaves_simple.png"},
869         waving = 1,
870         paramtype = "light",
871         is_ground_content = false,
872         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
873         drop = {
874                 max_items = 1,
875                 items = {
876                         {items = {"default:acacia_sapling"}, rarity = 20},
877                         {items = {"default:acacia_leaves"}}
878                 }
879         },
880         sounds = default.node_sound_leaves_defaults(),
881
882         after_place_node = default.after_place_leaves,
883 })
884
885 minetest.register_node("default:acacia_sapling", {
886         description = "Acacia Tree Sapling",
887         drawtype = "plantlike",
888         tiles = {"default_acacia_sapling.png"},
889         inventory_image = "default_acacia_sapling.png",
890         wield_image = "default_acacia_sapling.png",
891         paramtype = "light",
892         sunlight_propagates = true,
893         walkable = false,
894         on_timer = default.grow_sapling,
895         selection_box = {
896                 type = "fixed",
897                 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
898         },
899         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
900                 attached_node = 1, sapling = 1},
901         sounds = default.node_sound_leaves_defaults(),
902
903         on_construct = function(pos)
904                 minetest.get_node_timer(pos):start(math.random(2400,4800))
905         end,
906
907         on_place = function(itemstack, placer, pointed_thing)
908                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
909                         "default:acacia_sapling",
910                         -- minp, maxp to be checked, relative to sapling pos
911                         -- minp_relative.y = 1 because sapling pos has been checked
912                         {x = -4, y = 1, z = -4},
913                         {x = 4, y = 6, z = 4},
914                         -- maximum interval of interior volume check
915                         4)
916
917                 return itemstack
918         end,
919 })
920
921 minetest.register_node("default:aspen_tree", {
922         description = "Aspen Tree",
923         tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png",
924                 "default_aspen_tree.png"},
925         paramtype2 = "facedir",
926         is_ground_content = false,
927         groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
928         sounds = default.node_sound_wood_defaults(),
929
930         on_place = minetest.rotate_node
931 })
932
933 minetest.register_node("default:aspen_wood", {
934         description = "Aspen Wood Planks",
935         paramtype2 = "facedir",
936         place_param2 = 0,
937         tiles = {"default_aspen_wood.png"},
938         is_ground_content = false,
939         groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
940         sounds = default.node_sound_wood_defaults(),
941 })
942
943 minetest.register_node("default:aspen_leaves", {
944         description = "Aspen Leaves",
945         drawtype = "allfaces_optional",
946         tiles = {"default_aspen_leaves.png"},
947         waving = 1,
948         paramtype = "light",
949         is_ground_content = false,
950         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
951         drop = {
952                 max_items = 1,
953                 items = {
954                         {items = {"default:aspen_sapling"}, rarity = 20},
955                         {items = {"default:aspen_leaves"}}
956                 }
957         },
958         sounds = default.node_sound_leaves_defaults(),
959
960         after_place_node = default.after_place_leaves,
961 })
962
963 minetest.register_node("default:aspen_sapling", {
964         description = "Aspen Tree Sapling",
965         drawtype = "plantlike",
966         tiles = {"default_aspen_sapling.png"},
967         inventory_image = "default_aspen_sapling.png",
968         wield_image = "default_aspen_sapling.png",
969         paramtype = "light",
970         sunlight_propagates = true,
971         walkable = false,
972         on_timer = default.grow_sapling,
973         selection_box = {
974                 type = "fixed",
975                 fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16}
976         },
977         groups = {snappy = 2, dig_immediate = 3, flammable = 3,
978                 attached_node = 1, sapling = 1},
979         sounds = default.node_sound_leaves_defaults(),
980
981         on_construct = function(pos)
982                 minetest.get_node_timer(pos):start(math.random(2400,4800))
983         end,
984
985         on_place = function(itemstack, placer, pointed_thing)
986                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
987                         "default:aspen_sapling",
988                         -- minp, maxp to be checked, relative to sapling pos
989                         -- minp_relative.y = 1 because sapling pos has been checked
990                         {x = -2, y = 1, z = -2},
991                         {x = 2, y = 12, z = 2},
992                         -- maximum interval of interior volume check
993                         4)
994
995                 return itemstack
996         end,
997 })
998
999 --
1000 -- Ores
1001 --
1002
1003 minetest.register_node("default:stone_with_coal", {
1004         description = "Coal Ore",
1005         tiles = {"default_stone.png^default_mineral_coal.png"},
1006         groups = {cracky = 3},
1007         drop = 'default:coal_lump',
1008         sounds = default.node_sound_stone_defaults(),
1009 })
1010
1011 minetest.register_node("default:coalblock", {
1012         description = "Coal Block",
1013         tiles = {"default_coal_block.png"},
1014         is_ground_content = false,
1015         groups = {cracky = 3},
1016         sounds = default.node_sound_stone_defaults(),
1017 })
1018
1019
1020 minetest.register_node("default:stone_with_iron", {
1021         description = "Iron Ore",
1022         tiles = {"default_stone.png^default_mineral_iron.png"},
1023         groups = {cracky = 2},
1024         drop = 'default:iron_lump',
1025         sounds = default.node_sound_stone_defaults(),
1026 })
1027
1028 minetest.register_node("default:steelblock", {
1029         description = "Steel Block",
1030         tiles = {"default_steel_block.png"},
1031         is_ground_content = false,
1032         groups = {cracky = 1, level = 2},
1033         sounds = default.node_sound_metal_defaults(),
1034 })
1035
1036
1037 minetest.register_node("default:stone_with_copper", {
1038         description = "Copper Ore",
1039         tiles = {"default_stone.png^default_mineral_copper.png"},
1040         groups = {cracky = 2},
1041         drop = 'default:copper_lump',
1042         sounds = default.node_sound_stone_defaults(),
1043 })
1044
1045 minetest.register_node("default:copperblock", {
1046         description = "Copper Block",
1047         tiles = {"default_copper_block.png"},
1048         is_ground_content = false,
1049         groups = {cracky = 1, level = 2},
1050         sounds = default.node_sound_metal_defaults(),
1051 })
1052
1053
1054 minetest.register_node("default:stone_with_tin", {
1055         description = "Tin Ore",
1056         tiles = {"default_stone.png^default_mineral_tin.png"},
1057         groups = {cracky = 2},
1058         drop = "default:tin_lump",
1059         sounds = default.node_sound_stone_defaults(),
1060 })
1061
1062 minetest.register_node("default:tinblock", {
1063         description = "Tin Block",
1064         tiles = {"default_tin_block.png"},
1065         is_ground_content = false,
1066         groups = {cracky = 1, level = 2},
1067         sounds = default.node_sound_metal_defaults(),
1068 })
1069
1070
1071 minetest.register_node("default:bronzeblock", {
1072         description = "Bronze Block",
1073         tiles = {"default_bronze_block.png"},
1074         is_ground_content = false,
1075         groups = {cracky = 1, level = 2},
1076         sounds = default.node_sound_metal_defaults(),
1077 })
1078
1079
1080 minetest.register_node("default:stone_with_mese", {
1081         description = "Mese Ore",
1082         tiles = {"default_stone.png^default_mineral_mese.png"},
1083         groups = {cracky = 1},
1084         drop = "default:mese_crystal",
1085         sounds = default.node_sound_stone_defaults(),
1086 })
1087
1088 minetest.register_node("default:mese", {
1089         description = "Mese Block",
1090         tiles = {"default_mese_block.png"},
1091         paramtype = "light",
1092         groups = {cracky = 1, level = 2},
1093         sounds = default.node_sound_stone_defaults(),
1094         light_source = 3,
1095 })
1096
1097
1098 minetest.register_node("default:stone_with_gold", {
1099         description = "Gold Ore",
1100         tiles = {"default_stone.png^default_mineral_gold.png"},
1101         groups = {cracky = 2},
1102         drop = "default:gold_lump",
1103         sounds = default.node_sound_stone_defaults(),
1104 })
1105
1106 minetest.register_node("default:goldblock", {
1107         description = "Gold Block",
1108         tiles = {"default_gold_block.png"},
1109         is_ground_content = false,
1110         groups = {cracky = 1},
1111         sounds = default.node_sound_metal_defaults(),
1112 })
1113
1114
1115 minetest.register_node("default:stone_with_diamond", {
1116         description = "Diamond Ore",
1117         tiles = {"default_stone.png^default_mineral_diamond.png"},
1118         groups = {cracky = 1},
1119         drop = "default:diamond",
1120         sounds = default.node_sound_stone_defaults(),
1121 })
1122
1123 minetest.register_node("default:diamondblock", {
1124         description = "Diamond Block",
1125         tiles = {"default_diamond_block.png"},
1126         is_ground_content = false,
1127         groups = {cracky = 1, level = 3},
1128         sounds = default.node_sound_stone_defaults(),
1129 })
1130
1131 --
1132 -- Plantlife (non-cubic)
1133 --
1134
1135 minetest.register_node("default:cactus", {
1136         description = "Cactus",
1137         tiles = {"default_cactus_top.png", "default_cactus_top.png",
1138                 "default_cactus_side.png"},
1139         paramtype2 = "facedir",
1140         groups = {choppy = 3},
1141         sounds = default.node_sound_wood_defaults(),
1142         on_place = minetest.rotate_node,
1143 })
1144
1145 minetest.register_node("default:papyrus", {
1146         description = "Papyrus",
1147         drawtype = "plantlike",
1148         tiles = {"default_papyrus.png"},
1149         inventory_image = "default_papyrus.png",
1150         wield_image = "default_papyrus.png",
1151         paramtype = "light",
1152         sunlight_propagates = true,
1153         walkable = false,
1154         selection_box = {
1155                 type = "fixed",
1156                 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
1157         },
1158         groups = {snappy = 3, flammable = 2},
1159         sounds = default.node_sound_leaves_defaults(),
1160
1161         after_dig_node = function(pos, node, metadata, digger)
1162                 default.dig_up(pos, node, digger)
1163         end,
1164 })
1165
1166 minetest.register_node("default:dry_shrub", {
1167         description = "Dry Shrub",
1168         drawtype = "plantlike",
1169         waving = 1,
1170         tiles = {"default_dry_shrub.png"},
1171         inventory_image = "default_dry_shrub.png",
1172         wield_image = "default_dry_shrub.png",
1173         paramtype = "light",
1174         sunlight_propagates = true,
1175         walkable = false,
1176         buildable_to = true,
1177         groups = {snappy = 3, flammable = 3, attached_node = 1},
1178         sounds = default.node_sound_leaves_defaults(),
1179         selection_box = {
1180                 type = "fixed",
1181                 fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16},
1182         },
1183 })
1184
1185 minetest.register_node("default:junglegrass", {
1186         description = "Jungle Grass",
1187         drawtype = "plantlike",
1188         waving = 1,
1189         visual_scale = 1.69,
1190         tiles = {"default_junglegrass.png"},
1191         inventory_image = "default_junglegrass.png",
1192         wield_image = "default_junglegrass.png",
1193         paramtype = "light",
1194         sunlight_propagates = true,
1195         walkable = false,
1196         buildable_to = true,
1197         groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1},
1198         sounds = default.node_sound_leaves_defaults(),
1199         selection_box = {
1200                 type = "fixed",
1201                 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16},
1202         },
1203 })
1204
1205
1206 minetest.register_node("default:grass_1", {
1207         description = "Grass",
1208         drawtype = "plantlike",
1209         waving = 1,
1210         tiles = {"default_grass_1.png"},
1211         -- Use texture of a taller grass stage in inventory
1212         inventory_image = "default_grass_3.png",
1213         wield_image = "default_grass_3.png",
1214         paramtype = "light",
1215         sunlight_propagates = true,
1216         walkable = false,
1217         buildable_to = true,
1218         groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1},
1219         sounds = default.node_sound_leaves_defaults(),
1220         selection_box = {
1221                 type = "fixed",
1222                 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16},
1223         },
1224
1225         on_place = function(itemstack, placer, pointed_thing)
1226                 -- place a random grass node
1227                 local stack = ItemStack("default:grass_" .. math.random(1,5))
1228                 local ret = minetest.item_place(stack, placer, pointed_thing)
1229                 return ItemStack("default:grass_1 " ..
1230                         itemstack:get_count() - (1 - ret:get_count()))
1231         end,
1232 })
1233
1234 for i = 2, 5 do
1235         minetest.register_node("default:grass_" .. i, {
1236                 description = "Grass",
1237                 drawtype = "plantlike",
1238                 waving = 1,
1239                 tiles = {"default_grass_" .. i .. ".png"},
1240                 inventory_image = "default_grass_" .. i .. ".png",
1241                 wield_image = "default_grass_" .. i .. ".png",
1242                 paramtype = "light",
1243                 sunlight_propagates = true,
1244                 walkable = false,
1245                 buildable_to = true,
1246                 drop = "default:grass_1",
1247                 groups = {snappy = 3, flora = 1, attached_node = 1,
1248                         not_in_creative_inventory = 1, grass = 1, flammable = 1},
1249                 sounds = default.node_sound_leaves_defaults(),
1250                 selection_box = {
1251                         type = "fixed",
1252                         fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
1253                 },
1254         })
1255 end
1256
1257
1258 minetest.register_node("default:dry_grass_1", {
1259         description = "Dry Grass",
1260         drawtype = "plantlike",
1261         waving = 1,
1262         tiles = {"default_dry_grass_1.png"},
1263         inventory_image = "default_dry_grass_3.png",
1264         wield_image = "default_dry_grass_3.png",
1265         paramtype = "light",
1266         sunlight_propagates = true,
1267         walkable = false,
1268         buildable_to = true,
1269         groups = {snappy = 3, flammable = 3, flora = 1,
1270                 attached_node = 1, dry_grass = 1},
1271         sounds = default.node_sound_leaves_defaults(),
1272         selection_box = {
1273                 type = "fixed",
1274                 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
1275         },
1276
1277         on_place = function(itemstack, placer, pointed_thing)
1278                 -- place a random dry grass node
1279                 local stack = ItemStack("default:dry_grass_" .. math.random(1, 5))
1280                 local ret = minetest.item_place(stack, placer, pointed_thing)
1281                 return ItemStack("default:dry_grass_1 " ..
1282                         itemstack:get_count() - (1 - ret:get_count()))
1283         end,
1284 })
1285
1286 for i = 2, 5 do
1287         minetest.register_node("default:dry_grass_" .. i, {
1288                 description = "Dry Grass",
1289                 drawtype = "plantlike",
1290                 waving = 1,
1291                 tiles = {"default_dry_grass_" .. i .. ".png"},
1292                 inventory_image = "default_dry_grass_" .. i .. ".png",
1293                 wield_image = "default_dry_grass_" .. i .. ".png",
1294                 paramtype = "light",
1295                 sunlight_propagates = true,
1296                 walkable = false,
1297                 buildable_to = true,
1298                 groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
1299                         not_in_creative_inventory=1, dry_grass = 1},
1300                 drop = "default:dry_grass_1",
1301                 sounds = default.node_sound_leaves_defaults(),
1302                 selection_box = {
1303                         type = "fixed",
1304                         fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16},
1305                 },
1306         })
1307 end
1308
1309
1310 minetest.register_node("default:bush_stem", {
1311         description = "Bush Stem",
1312         drawtype = "plantlike",
1313         visual_scale = 1.41,
1314         tiles = {"default_bush_stem.png"},
1315         inventory_image = "default_bush_stem.png",
1316         wield_image = "default_bush_stem.png",
1317         paramtype = "light",
1318         sunlight_propagates = true,
1319         groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
1320         sounds = default.node_sound_wood_defaults(),
1321         selection_box = {
1322                 type = "fixed",
1323                 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
1324         },
1325 })
1326
1327 minetest.register_node("default:bush_leaves", {
1328         description = "Bush Leaves",
1329         drawtype = "allfaces_optional",
1330         waving = 1,
1331         tiles = {"default_leaves_simple.png"},
1332         paramtype = "light",
1333         groups = {snappy = 3, flammable = 2, leaves = 1},
1334         drop = {
1335                 max_items = 1,
1336                 items = {
1337                         {items = {"default:bush_sapling"}, rarity = 5},
1338                         {items = {"default:bush_leaves"}}
1339                 }
1340         },
1341         sounds = default.node_sound_leaves_defaults(),
1342
1343         after_place_node = default.after_place_leaves,
1344 })
1345
1346 minetest.register_node("default:bush_sapling", {
1347         description = "Bush Sapling",
1348         drawtype = "plantlike",
1349         tiles = {"default_bush_sapling.png"},
1350         inventory_image = "default_bush_sapling.png",
1351         wield_image = "default_bush_sapling.png",
1352         paramtype = "light",
1353         sunlight_propagates = true,
1354         walkable = false,
1355         on_timer = default.grow_sapling,
1356         selection_box = {
1357                 type = "fixed",
1358                 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
1359         },
1360         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
1361                 attached_node = 1, sapling = 1},
1362         sounds = default.node_sound_leaves_defaults(),
1363
1364         on_construct = function(pos)
1365                 minetest.get_node_timer(pos):start(math.random(1200, 2400))
1366         end,
1367
1368         on_place = function(itemstack, placer, pointed_thing)
1369                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
1370                         "default:bush_sapling",
1371                         -- minp, maxp to be checked, relative to sapling pos
1372                         {x = -1, y = 0, z = -1},
1373                         {x = 1, y = 1, z = 1},
1374                         -- maximum interval of interior volume check
1375                         2)
1376
1377                 return itemstack
1378         end,
1379 })
1380
1381 minetest.register_node("default:acacia_bush_stem", {
1382         description = "Acacia Bush Stem",
1383         drawtype = "plantlike",
1384         visual_scale = 1.41,
1385         tiles = {"default_acacia_bush_stem.png"},
1386         inventory_image = "default_acacia_bush_stem.png",
1387         wield_image = "default_acacia_bush_stem.png",
1388         paramtype = "light",
1389         sunlight_propagates = true,
1390         groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
1391         sounds = default.node_sound_wood_defaults(),
1392         selection_box = {
1393                 type = "fixed",
1394                 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
1395         },
1396 })
1397
1398 minetest.register_node("default:acacia_bush_leaves", {
1399         description = "Acacia Bush Leaves",
1400         drawtype = "allfaces_optional",
1401         waving = 1,
1402         tiles = {"default_acacia_leaves_simple.png"},
1403         paramtype = "light",
1404         groups = {snappy = 3, flammable = 2, leaves = 1},
1405         drop = {
1406                 max_items = 1,
1407                 items = {
1408                         {items = {"default:acacia_bush_sapling"}, rarity = 5},
1409                         {items = {"default:acacia_bush_leaves"}}
1410                 }
1411         },
1412         sounds = default.node_sound_leaves_defaults(),
1413
1414         after_place_node = default.after_place_leaves,
1415 })
1416
1417 minetest.register_node("default:acacia_bush_sapling", {
1418         description = "Acacia Bush Sapling",
1419         drawtype = "plantlike",
1420         tiles = {"default_acacia_bush_sapling.png"},
1421         inventory_image = "default_acacia_bush_sapling.png",
1422         wield_image = "default_acacia_bush_sapling.png",
1423         paramtype = "light",
1424         sunlight_propagates = true,
1425         walkable = false,
1426         on_timer = default.grow_sapling,
1427         selection_box = {
1428                 type = "fixed",
1429                 fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16}
1430         },
1431         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
1432                 attached_node = 1, sapling = 1},
1433         sounds = default.node_sound_leaves_defaults(),
1434
1435         on_construct = function(pos)
1436                 minetest.get_node_timer(pos):start(math.random(1200, 2400))
1437         end,
1438
1439         on_place = function(itemstack, placer, pointed_thing)
1440                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
1441                         "default:acacia_bush_sapling",
1442                         -- minp, maxp to be checked, relative to sapling pos
1443                         {x = -1, y = 0, z = -1},
1444                         {x = 1, y = 1, z = 1},
1445                         -- maximum interval of interior volume check
1446                         2)
1447
1448                 return itemstack
1449         end,
1450 })
1451
1452
1453 --
1454 -- Corals
1455 --
1456
1457 minetest.register_node("default:coral_brown", {
1458         description = "Brown Coral",
1459         tiles = {"default_coral_brown.png"},
1460         groups = {cracky = 3},
1461         drop = "default:coral_skeleton",
1462         sounds = default.node_sound_stone_defaults(),
1463 })
1464
1465 minetest.register_node("default:coral_orange", {
1466         description = "Orange Coral",
1467         tiles = {"default_coral_orange.png"},
1468         groups = {cracky = 3},
1469         drop = "default:coral_skeleton",
1470         sounds = default.node_sound_stone_defaults(),
1471 })
1472
1473 minetest.register_node("default:coral_skeleton", {
1474         description = "Coral Skeleton",
1475         tiles = {"default_coral_skeleton.png"},
1476         groups = {cracky = 3},
1477         sounds = default.node_sound_stone_defaults(),
1478 })
1479
1480
1481 --
1482 -- Liquids
1483 --
1484
1485 minetest.register_node("default:water_source", {
1486         description = "Water Source",
1487         drawtype = "liquid",
1488         tiles = {
1489                 {
1490                         name = "default_water_source_animated.png",
1491                         animation = {
1492                                 type = "vertical_frames",
1493                                 aspect_w = 16,
1494                                 aspect_h = 16,
1495                                 length = 2.0,
1496                         },
1497                 },
1498         },
1499         special_tiles = {
1500                 -- New-style water source material (mostly unused)
1501                 {
1502                         name = "default_water_source_animated.png",
1503                         animation = {
1504                                 type = "vertical_frames",
1505                                 aspect_w = 16,
1506                                 aspect_h = 16,
1507                                 length = 2.0,
1508                         },
1509                         backface_culling = false,
1510                 },
1511         },
1512         alpha = 160,
1513         paramtype = "light",
1514         walkable = false,
1515         pointable = false,
1516         diggable = false,
1517         buildable_to = true,
1518         is_ground_content = false,
1519         drop = "",
1520         drowning = 1,
1521         liquidtype = "source",
1522         liquid_alternative_flowing = "default:water_flowing",
1523         liquid_alternative_source = "default:water_source",
1524         liquid_viscosity = 1,
1525         post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1526         groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
1527         sounds = default.node_sound_water_defaults(),
1528 })
1529
1530 minetest.register_node("default:water_flowing", {
1531         description = "Flowing Water",
1532         drawtype = "flowingliquid",
1533         tiles = {"default_water.png"},
1534         special_tiles = {
1535                 {
1536                         name = "default_water_flowing_animated.png",
1537                         backface_culling = false,
1538                         animation = {
1539                                 type = "vertical_frames",
1540                                 aspect_w = 16,
1541                                 aspect_h = 16,
1542                                 length = 0.8,
1543                         },
1544                 },
1545                 {
1546                         name = "default_water_flowing_animated.png",
1547                         backface_culling = true,
1548                         animation = {
1549                                 type = "vertical_frames",
1550                                 aspect_w = 16,
1551                                 aspect_h = 16,
1552                                 length = 0.8,
1553                         },
1554                 },
1555         },
1556         alpha = 160,
1557         paramtype = "light",
1558         paramtype2 = "flowingliquid",
1559         walkable = false,
1560         pointable = false,
1561         diggable = false,
1562         buildable_to = true,
1563         is_ground_content = false,
1564         drop = "",
1565         drowning = 1,
1566         liquidtype = "flowing",
1567         liquid_alternative_flowing = "default:water_flowing",
1568         liquid_alternative_source = "default:water_source",
1569         liquid_viscosity = 1,
1570         post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1571         groups = {water = 3, liquid = 3, puts_out_fire = 1,
1572                 not_in_creative_inventory = 1, cools_lava = 1},
1573         sounds = default.node_sound_water_defaults(),
1574 })
1575
1576
1577 minetest.register_node("default:river_water_source", {
1578         description = "River Water Source",
1579         drawtype = "liquid",
1580         tiles = {
1581                 {
1582                         name = "default_river_water_source_animated.png",
1583                         animation = {
1584                                 type = "vertical_frames",
1585                                 aspect_w = 16,
1586                                 aspect_h = 16,
1587                                 length = 2.0,
1588                         },
1589                 },
1590         },
1591         special_tiles = {
1592                 {
1593                         name = "default_river_water_source_animated.png",
1594                         animation = {
1595                                 type = "vertical_frames",
1596                                 aspect_w = 16,
1597                                 aspect_h = 16,
1598                                 length = 2.0,
1599                         },
1600                         backface_culling = false,
1601                 },
1602         },
1603         alpha = 160,
1604         paramtype = "light",
1605         walkable = false,
1606         pointable = false,
1607         diggable = false,
1608         buildable_to = true,
1609         is_ground_content = false,
1610         drop = "",
1611         drowning = 1,
1612         liquidtype = "source",
1613         liquid_alternative_flowing = "default:river_water_flowing",
1614         liquid_alternative_source = "default:river_water_source",
1615         liquid_viscosity = 1,
1616         liquid_renewable = false,
1617         liquid_range = 2,
1618         post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1619         groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
1620         sounds = default.node_sound_water_defaults(),
1621 })
1622
1623 minetest.register_node("default:river_water_flowing", {
1624         description = "Flowing River Water",
1625         drawtype = "flowingliquid",
1626         tiles = {"default_river_water.png"},
1627         special_tiles = {
1628                 {
1629                         name = "default_river_water_flowing_animated.png",
1630                         backface_culling = false,
1631                         animation = {
1632                                 type = "vertical_frames",
1633                                 aspect_w = 16,
1634                                 aspect_h = 16,
1635                                 length = 0.8,
1636                         },
1637                 },
1638                 {
1639                         name = "default_river_water_flowing_animated.png",
1640                         backface_culling = true,
1641                         animation = {
1642                                 type = "vertical_frames",
1643                                 aspect_w = 16,
1644                                 aspect_h = 16,
1645                                 length = 0.8,
1646                         },
1647                 },
1648         },
1649         alpha = 160,
1650         paramtype = "light",
1651         paramtype2 = "flowingliquid",
1652         walkable = false,
1653         pointable = false,
1654         diggable = false,
1655         buildable_to = true,
1656         is_ground_content = false,
1657         drop = "",
1658         drowning = 1,
1659         liquidtype = "flowing",
1660         liquid_alternative_flowing = "default:river_water_flowing",
1661         liquid_alternative_source = "default:river_water_source",
1662         liquid_viscosity = 1,
1663         liquid_renewable = false,
1664         liquid_range = 2,
1665         post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1666         groups = {water = 3, liquid = 3, puts_out_fire = 1,
1667                 not_in_creative_inventory = 1, cools_lava = 1},
1668         sounds = default.node_sound_water_defaults(),
1669 })
1670
1671
1672 minetest.register_node("default:lava_source", {
1673         description = "Lava Source",
1674         drawtype = "liquid",
1675         tiles = {
1676                 {
1677                         name = "default_lava_source_animated.png",
1678                         animation = {
1679                                 type = "vertical_frames",
1680                                 aspect_w = 16,
1681                                 aspect_h = 16,
1682                                 length = 3.0,
1683                         },
1684                 },
1685         },
1686         special_tiles = {
1687                 -- New-style lava source material (mostly unused)
1688                 {
1689                         name = "default_lava_source_animated.png",
1690                         animation = {
1691                                 type = "vertical_frames",
1692                                 aspect_w = 16,
1693                                 aspect_h = 16,
1694                                 length = 3.0,
1695                         },
1696                         backface_culling = false,
1697                 },
1698         },
1699         paramtype = "light",
1700         light_source = default.LIGHT_MAX - 1,
1701         walkable = false,
1702         pointable = false,
1703         diggable = false,
1704         buildable_to = true,
1705         is_ground_content = false,
1706         drop = "",
1707         drowning = 1,
1708         liquidtype = "source",
1709         liquid_alternative_flowing = "default:lava_flowing",
1710         liquid_alternative_source = "default:lava_source",
1711         liquid_viscosity = 7,
1712         liquid_renewable = false,
1713         damage_per_second = 4 * 2,
1714         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1715         groups = {lava = 3, liquid = 2, igniter = 1},
1716 })
1717
1718 minetest.register_node("default:lava_flowing", {
1719         description = "Flowing Lava",
1720         drawtype = "flowingliquid",
1721         tiles = {"default_lava.png"},
1722         special_tiles = {
1723                 {
1724                         name = "default_lava_flowing_animated.png",
1725                         backface_culling = false,
1726                         animation = {
1727                                 type = "vertical_frames",
1728                                 aspect_w = 16,
1729                                 aspect_h = 16,
1730                                 length = 3.3,
1731                         },
1732                 },
1733                 {
1734                         name = "default_lava_flowing_animated.png",
1735                         backface_culling = true,
1736                         animation = {
1737                                 type = "vertical_frames",
1738                                 aspect_w = 16,
1739                                 aspect_h = 16,
1740                                 length = 3.3,
1741                         },
1742                 },
1743         },
1744         paramtype = "light",
1745         paramtype2 = "flowingliquid",
1746         light_source = default.LIGHT_MAX - 1,
1747         walkable = false,
1748         pointable = false,
1749         diggable = false,
1750         buildable_to = true,
1751         is_ground_content = false,
1752         drop = "",
1753         drowning = 1,
1754         liquidtype = "flowing",
1755         liquid_alternative_flowing = "default:lava_flowing",
1756         liquid_alternative_source = "default:lava_source",
1757         liquid_viscosity = 7,
1758         liquid_renewable = false,
1759         damage_per_second = 4 * 2,
1760         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1761         groups = {lava = 3, liquid = 2, igniter = 1,
1762                 not_in_creative_inventory = 1},
1763 })
1764
1765 --
1766 -- Tools / "Advanced" crafting / Non-"natural"
1767 --
1768
1769 local function get_chest_formspec(pos)
1770         local spos = pos.x .. "," .. pos.y .. "," .. pos.z
1771         local formspec =
1772                 "size[8,9]" ..
1773                 default.gui_bg ..
1774                 default.gui_bg_img ..
1775                 default.gui_slots ..
1776                 "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
1777                 "list[current_player;main;0,4.85;8,1;]" ..
1778                 "list[current_player;main;0,6.08;8,3;8]" ..
1779                 "listring[nodemeta:" .. spos .. ";main]" ..
1780                 "listring[current_player;main]" ..
1781                 default.get_hotbar_bg(0,4.85)
1782         return formspec
1783 end
1784
1785 local function chest_lid_obstructed(pos)
1786         local above = { x = pos.x, y = pos.y + 1, z = pos.z }
1787         local def = minetest.registered_nodes[minetest.get_node(above).name]
1788         -- allow ladders, signs, wallmounted things and torches to not obstruct
1789         if def.drawtype == "airlike" or
1790                         def.drawtype == "signlike" or
1791                         def.drawtype == "torchlike" or
1792                         (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
1793                 return false
1794         end
1795         return true
1796 end
1797
1798 local open_chests = {}
1799
1800 minetest.register_on_player_receive_fields(function(player, formname, fields)
1801         if formname ~= "default:chest" then
1802                 return
1803         end
1804         if not player or not fields.quit then
1805                 return
1806         end
1807         local pn = player:get_player_name()
1808
1809         if not open_chests[pn] then
1810                 return
1811         end
1812
1813         local pos = open_chests[pn].pos
1814         local sound = open_chests[pn].sound
1815         local swap = open_chests[pn].swap
1816         local node = minetest.get_node(pos)
1817
1818         open_chests[pn] = nil
1819         for k, v in pairs(open_chests) do
1820                 if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
1821                         return true
1822                 end
1823         end
1824         minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
1825                         param2 = node.param2 })
1826         minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
1827         return true
1828 end)
1829
1830 function default.register_chest(name, d)
1831         local def = table.copy(d)
1832         def.drawtype = "mesh"
1833         def.visual = "mesh"
1834         def.paramtype = "light"
1835         def.paramtype2 = "facedir"
1836         def.legacy_facedir_simple = true
1837         def.is_ground_content = false
1838
1839         if def.protected then
1840                 def.on_construct = function(pos)
1841                         local meta = minetest.get_meta(pos)
1842                         meta:set_string("infotext", "Locked Chest")
1843                         meta:set_string("owner", "")
1844                         local inv = meta:get_inventory()
1845                         inv:set_size("main", 8*4)
1846                 end
1847                 def.after_place_node = function(pos, placer)
1848                         local meta = minetest.get_meta(pos)
1849                         meta:set_string("owner", placer:get_player_name() or "")
1850                         meta:set_string("infotext", "Locked Chest (owned by " ..
1851                                         meta:get_string("owner") .. ")")
1852                 end
1853                 def.can_dig = function(pos,player)
1854                         local meta = minetest.get_meta(pos);
1855                         local inv = meta:get_inventory()
1856                         return inv:is_empty("main") and
1857                                         default.can_interact_with_node(player, pos)
1858                 end
1859                 def.allow_metadata_inventory_move = function(pos, from_list, from_index,
1860                                 to_list, to_index, count, player)
1861                         if not default.can_interact_with_node(player, pos) then
1862                                 return 0
1863                         end
1864                         return count
1865                 end
1866                 def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
1867                         if not default.can_interact_with_node(player, pos) then
1868                                 return 0
1869                         end
1870                         return stack:get_count()
1871                 end
1872                 def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
1873                         if not default.can_interact_with_node(player, pos) then
1874                                 return 0
1875                         end
1876                         return stack:get_count()
1877                 end
1878                 def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
1879                         if not default.can_interact_with_node(clicker, pos) then
1880                                 return itemstack
1881                         end
1882
1883                         minetest.sound_play(def.sound_open, {gain = 0.3,
1884                                         pos = pos, max_hear_distance = 10})
1885                         if not chest_lid_obstructed(pos) then
1886                                 minetest.swap_node(pos,
1887                                                 { name = "default:" .. name .. "_open",
1888                                                 param2 = node.param2 })
1889                         end
1890                         minetest.after(0.2, minetest.show_formspec,
1891                                         clicker:get_player_name(),
1892                                         "default:chest", get_chest_formspec(pos))
1893                         open_chests[clicker:get_player_name()] = { pos = pos,
1894                                         sound = def.sound_close, swap = name }
1895                 end
1896                 def.on_blast = function() end
1897                 def.on_key_use = function(pos, player)
1898                         local secret = minetest.get_meta(pos):get_string("key_lock_secret")
1899                         local itemstack = player:get_wielded_item()
1900                         local key_meta = itemstack:get_meta()
1901
1902                         if key_meta:get_string("secret") == "" then
1903                                 key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
1904                                 itemstack:set_metadata("")
1905                         end
1906
1907                         if secret ~= key_meta:get_string("secret") then
1908                                 return
1909                         end
1910
1911                         minetest.show_formspec(
1912                                 player:get_player_name(),
1913                                 "default:chest_locked",
1914                                 get_chest_formspec(pos)
1915                         )
1916                 end
1917                 def.on_skeleton_key_use = function(pos, player, newsecret)
1918                         local meta = minetest.get_meta(pos)
1919                         local owner = meta:get_string("owner")
1920                         local pn = player:get_player_name()
1921
1922                         -- verify placer is owner of lockable chest
1923                         if owner ~= pn then
1924                                 minetest.record_protection_violation(pos, pn)
1925                                 minetest.chat_send_player(pn, "You do not own this chest.")
1926                                 return nil
1927                         end
1928
1929                         local secret = meta:get_string("key_lock_secret")
1930                         if secret == "" then
1931                                 secret = newsecret
1932                                 meta:set_string("key_lock_secret", secret)
1933                         end
1934
1935                         return secret, "a locked chest", owner
1936                 end
1937         else
1938                 def.on_construct = function(pos)
1939                         local meta = minetest.get_meta(pos)
1940                         meta:set_string("infotext", "Chest")
1941                         local inv = meta:get_inventory()
1942                         inv:set_size("main", 8*4)
1943                 end
1944                 def.can_dig = function(pos,player)
1945                         local meta = minetest.get_meta(pos);
1946                         local inv = meta:get_inventory()
1947                         return inv:is_empty("main")
1948                 end
1949                 def.on_rightclick = function(pos, node, clicker)
1950                         minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
1951                                         max_hear_distance = 10})
1952                         if not chest_lid_obstructed(pos) then
1953                                 minetest.swap_node(pos, {
1954                                                 name = "default:" .. name .. "_open",
1955                                                 param2 = node.param2 })
1956                         end
1957                         minetest.after(0.2, minetest.show_formspec,
1958                                         clicker:get_player_name(),
1959                                         "default:chest", get_chest_formspec(pos))
1960                         open_chests[clicker:get_player_name()] = { pos = pos,
1961                                         sound = def.sound_close, swap = name }
1962                 end
1963         end
1964
1965         def.on_metadata_inventory_move = function(pos, from_list, from_index,
1966                         to_list, to_index, count, player)
1967                 minetest.log("action", player:get_player_name() ..
1968                         " moves stuff in chest at " .. minetest.pos_to_string(pos))
1969         end
1970         def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
1971                 minetest.log("action", player:get_player_name() ..
1972                         " moves " .. stack:get_name() ..
1973                         " to chest at " .. minetest.pos_to_string(pos))
1974         end
1975         def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
1976                 minetest.log("action", player:get_player_name() ..
1977                         " takes " .. stack:get_name() ..
1978                         " from chest at " .. minetest.pos_to_string(pos))
1979         end
1980         def.on_blast = function(pos)
1981                 local drops = {}
1982                 default.get_inventory_drops(pos, "main", drops)
1983                 drops[#drops+1] = "default:chest"
1984                 minetest.remove_node(pos)
1985                 return drops
1986         end
1987
1988         local def_opened = table.copy(def)
1989         local def_closed = table.copy(def)
1990
1991         def_opened.mesh = "chest_open.obj"
1992         def_opened.drop = "default:" .. name
1993         def_opened.groups.not_in_creative_inventory = 1
1994         def_opened.selection_box = {
1995                 type = "fixed",
1996                 fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
1997                 }
1998         def_opened.can_dig = function()
1999                 return false
2000         end
2001
2002         def_closed.mesh = nil
2003         def_closed.drawtype = nil
2004         def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal"
2005         def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh
2006         def_closed.tiles[3] = def.tiles[3].."^[transformFX"
2007
2008         minetest.register_node("default:" .. name, def_closed)
2009         minetest.register_node("default:" .. name .. "_open", def_opened)
2010
2011         -- convert old chests to this new variant
2012         minetest.register_lbm({
2013                 label = "update chests to opening chests",
2014                 name = "default:upgrade_" .. name .. "_v2",
2015                 nodenames = {"default:" .. name},
2016                 action = function(pos, node)
2017                         local meta = minetest.get_meta(pos)
2018                         meta:set_string("formspec", nil)
2019                         local inv = meta:get_inventory()
2020                         local list = inv:get_list("default:chest")
2021                         if list then
2022                                 inv:set_size("main", 8*4)
2023                                 inv:set_list("main", list)
2024                                 inv:set_list("default:chest", nil)
2025                         end
2026                 end
2027         })
2028 end
2029
2030
2031 default.register_chest("chest", {
2032         description = "Chest",
2033         tiles = {
2034                 "default_chest_top.png",
2035                 "default_chest_top.png",
2036                 "default_chest_side.png",
2037                 "default_chest_side.png",
2038                 "default_chest_front.png",
2039                 "default_chest_inside.png"
2040         },
2041         sounds = default.node_sound_wood_defaults(),
2042         sound_open = "default_chest_open",
2043         sound_close = "default_chest_close",
2044         groups = {choppy = 2, oddly_breakable_by_hand = 2},
2045 })
2046
2047 default.register_chest("chest_locked", {
2048         description = "Locked Chest",
2049         tiles = {
2050                 "default_chest_top.png",
2051                 "default_chest_top.png",
2052                 "default_chest_side.png",
2053                 "default_chest_side.png",
2054                 "default_chest_lock.png",
2055                 "default_chest_inside.png"
2056         },
2057         sounds = default.node_sound_wood_defaults(),
2058         sound_open = "default_chest_open",
2059         sound_close = "default_chest_close",
2060         groups = {choppy = 2, oddly_breakable_by_hand = 2},
2061         protected = true,
2062 })
2063
2064 local bookshelf_formspec =
2065         "size[8,7;]" ..
2066         default.gui_bg ..
2067         default.gui_bg_img ..
2068         default.gui_slots ..
2069         "list[context;books;0,0.3;8,2;]" ..
2070         "list[current_player;main;0,2.85;8,1;]" ..
2071         "list[current_player;main;0,4.08;8,3;8]" ..
2072         "listring[context;books]" ..
2073         "listring[current_player;main]" ..
2074         default.get_hotbar_bg(0,2.85)
2075
2076 local function get_bookshelf_formspec(inv)
2077         local formspec = bookshelf_formspec
2078         local invlist = inv and inv:get_list("books")
2079         -- Inventory slots overlay
2080         local bx, by = 0, 0.3
2081         for i = 1, 16 do
2082                 if i == 9 then
2083                         bx = 0
2084                         by = by + 1
2085                 end
2086                 if not invlist or invlist[i]:is_empty() then
2087                         formspec = formspec ..
2088                                 "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]"
2089                 end
2090                 bx = bx + 1
2091         end
2092         return formspec
2093 end
2094
2095 minetest.register_node("default:bookshelf", {
2096         description = "Bookshelf",
2097         tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
2098                 "default_wood.png", "default_bookshelf.png", "default_bookshelf.png"},
2099         paramtype2 = "facedir",
2100         is_ground_content = false,
2101         groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2102         sounds = default.node_sound_wood_defaults(),
2103
2104         on_construct = function(pos)
2105                 local meta = minetest.get_meta(pos)
2106                 meta:set_string("formspec", get_bookshelf_formspec(nil))
2107                 local inv = meta:get_inventory()
2108                 inv:set_size("books", 8 * 2)
2109         end,
2110         can_dig = function(pos,player)
2111                 local inv = minetest.get_meta(pos):get_inventory()
2112                 return inv:is_empty("books")
2113         end,
2114         allow_metadata_inventory_put = function(pos, listname, index, stack)
2115                 if minetest.get_item_group(stack:get_name(), "book") ~= 0 then
2116                         return stack:get_count()
2117                 end
2118                 return 0
2119         end,
2120         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
2121                 minetest.log("action", player:get_player_name() ..
2122                         " moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
2123                 local meta = minetest.get_meta(pos)
2124                 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2125         end,
2126         on_metadata_inventory_put = function(pos, listname, index, stack, player)
2127                 minetest.log("action", player:get_player_name() ..
2128                         " moves stuff to bookshelf at " .. minetest.pos_to_string(pos))
2129                 local meta = minetest.get_meta(pos)
2130                 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2131         end,
2132         on_metadata_inventory_take = function(pos, listname, index, stack, player)
2133                 minetest.log("action", player:get_player_name() ..
2134                         " takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
2135                 local meta = minetest.get_meta(pos)
2136                 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2137         end,
2138         on_blast = function(pos)
2139                 local drops = {}
2140                 default.get_inventory_drops(pos, "books", drops)
2141                 drops[#drops+1] = "default:bookshelf"
2142                 minetest.remove_node(pos)
2143                 return drops
2144         end,
2145 })
2146
2147 local function register_sign(material, desc, def)
2148         minetest.register_node("default:sign_wall_" .. material, {
2149                 description = desc .. " Sign",
2150                 drawtype = "nodebox",
2151                 tiles = {"default_sign_wall_" .. material .. ".png"},
2152                 inventory_image = "default_sign_" .. material .. ".png",
2153                 wield_image = "default_sign_" .. material .. ".png",
2154                 paramtype = "light",
2155                 paramtype2 = "wallmounted",
2156                 sunlight_propagates = true,
2157                 is_ground_content = false,
2158                 walkable = false,
2159                 node_box = {
2160                         type = "wallmounted",
2161                         wall_top    = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
2162                         wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
2163                         wall_side   = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
2164                 },
2165                 groups = def.groups,
2166                 legacy_wallmounted = true,
2167                 sounds = def.sounds,
2168
2169                 on_construct = function(pos)
2170                         --local n = minetest.get_node(pos)
2171                         local meta = minetest.get_meta(pos)
2172                         meta:set_string("formspec", "field[text;;${text}]")
2173                 end,
2174                 on_receive_fields = function(pos, formname, fields, sender)
2175                         --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
2176                         local player_name = sender:get_player_name()
2177                         if minetest.is_protected(pos, player_name) then
2178                                 minetest.record_protection_violation(pos, player_name)
2179                                 return
2180                         end
2181                         local meta = minetest.get_meta(pos)
2182                         if not fields.text then return end
2183                         minetest.log("action", (player_name or "") .. " wrote \"" ..
2184                                 fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
2185                         meta:set_string("text", fields.text)
2186                         meta:set_string("infotext", '"' .. fields.text .. '"')
2187                 end,
2188         })
2189 end
2190
2191 register_sign("wood", "Wooden", {
2192         sounds = default.node_sound_wood_defaults(),
2193         groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
2194 })
2195
2196 register_sign("steel", "Steel", {
2197         sounds = default.node_sound_metal_defaults(),
2198         groups = {cracky = 2, attached_node = 1}
2199 })
2200
2201 minetest.register_node("default:ladder_wood", {
2202         description = "Wooden Ladder",
2203         drawtype = "signlike",
2204         tiles = {"default_ladder_wood.png"},
2205         inventory_image = "default_ladder_wood.png",
2206         wield_image = "default_ladder_wood.png",
2207         paramtype = "light",
2208         paramtype2 = "wallmounted",
2209         sunlight_propagates = true,
2210         walkable = false,
2211         climbable = true,
2212         is_ground_content = false,
2213         selection_box = {
2214                 type = "wallmounted",
2215                 --wall_top = = <default>
2216                 --wall_bottom = = <default>
2217                 --wall_side = = <default>
2218         },
2219         groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2},
2220         legacy_wallmounted = true,
2221         sounds = default.node_sound_wood_defaults(),
2222 })
2223
2224 minetest.register_node("default:ladder_steel", {
2225         description = "Steel Ladder",
2226         drawtype = "signlike",
2227         tiles = {"default_ladder_steel.png"},
2228         inventory_image = "default_ladder_steel.png",
2229         wield_image = "default_ladder_steel.png",
2230         paramtype = "light",
2231         paramtype2 = "wallmounted",
2232         sunlight_propagates = true,
2233         walkable = false,
2234         climbable = true,
2235         is_ground_content = false,
2236         selection_box = {
2237                 type = "wallmounted",
2238                 --wall_top = = <default>
2239                 --wall_bottom = = <default>
2240                 --wall_side = = <default>
2241         },
2242         groups = {cracky = 2},
2243         sounds = default.node_sound_metal_defaults(),
2244 })
2245
2246 default.register_fence("default:fence_wood", {
2247         description = "Wooden Fence",
2248         texture = "default_fence_wood.png",
2249         inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2250         wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2251         material = "default:wood",
2252         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2253         sounds = default.node_sound_wood_defaults()
2254 })
2255
2256 default.register_fence("default:fence_acacia_wood", {
2257         description = "Acacia Fence",
2258         texture = "default_fence_acacia_wood.png",
2259         inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2260         wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2261         material = "default:acacia_wood",
2262         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2263         sounds = default.node_sound_wood_defaults()
2264 })
2265
2266 default.register_fence("default:fence_junglewood", {
2267         description = "Jungle Wood Fence",
2268         texture = "default_fence_junglewood.png",
2269         inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
2270         wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
2271         material = "default:junglewood",
2272         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2273         sounds = default.node_sound_wood_defaults()
2274 })
2275
2276 default.register_fence("default:fence_pine_wood", {
2277         description = "Pine Fence",
2278         texture = "default_fence_pine_wood.png",
2279         inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2280         wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2281         material = "default:pine_wood",
2282         groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2283         sounds = default.node_sound_wood_defaults()
2284 })
2285
2286 default.register_fence("default:fence_aspen_wood", {
2287         description = "Aspen Fence",
2288         texture = "default_fence_aspen_wood.png",
2289         inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2290         wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2291         material = "default:aspen_wood",
2292         groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2293         sounds = default.node_sound_wood_defaults()
2294 })
2295
2296 minetest.register_node("default:glass", {
2297         description = "Glass",
2298         drawtype = "glasslike_framed_optional",
2299         tiles = {"default_glass.png", "default_glass_detail.png"},
2300         paramtype = "light",
2301         paramtype2 = "glasslikeliquidlevel",
2302         sunlight_propagates = true,
2303         is_ground_content = false,
2304         groups = {cracky = 3, oddly_breakable_by_hand = 3},
2305         sounds = default.node_sound_glass_defaults(),
2306 })
2307
2308 minetest.register_node("default:obsidian_glass", {
2309         description = "Obsidian Glass",
2310         drawtype = "glasslike_framed_optional",
2311         tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
2312         paramtype = "light",
2313         paramtype2 = "glasslikeliquidlevel",
2314         is_ground_content = false,
2315         sunlight_propagates = true,
2316         sounds = default.node_sound_glass_defaults(),
2317         groups = {cracky = 3},
2318 })
2319
2320
2321 minetest.register_node("default:brick", {
2322         description = "Brick Block",
2323         paramtype2 = "facedir",
2324         place_param2 = 0,
2325         tiles = {"default_brick.png"},
2326         is_ground_content = false,
2327         groups = {cracky = 3},
2328         sounds = default.node_sound_stone_defaults(),
2329 })
2330
2331
2332 minetest.register_node("default:meselamp", {
2333         description = "Mese Lamp",
2334         drawtype = "glasslike",
2335         tiles = {"default_meselamp.png"},
2336         paramtype = "light",
2337         sunlight_propagates = true,
2338         is_ground_content = false,
2339         groups = {cracky = 3, oddly_breakable_by_hand = 3},
2340         sounds = default.node_sound_glass_defaults(),
2341         light_source = default.LIGHT_MAX,
2342 })
2343
2344 minetest.register_node("default:mese_post_light", {
2345         description = "Mese Post Light",
2346         tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png",
2347                 "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png",
2348                 "default_mese_post_light_side.png", "default_mese_post_light_side.png"},
2349         wield_image = "default_mese_post_light_side.png",
2350         drawtype = "nodebox",
2351         node_box = {
2352                 type = "fixed",
2353                 fixed = {
2354                         {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16},
2355                 },
2356         },
2357         paramtype = "light",
2358         light_source = default.LIGHT_MAX,
2359         sunlight_propagates = true,
2360         is_ground_content = false,
2361         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2362         sounds = default.node_sound_wood_defaults(),
2363 })
2364
2365 --
2366 -- Misc
2367 --
2368
2369 minetest.register_node("default:cloud", {
2370         description = "Cloud",
2371         tiles = {"default_cloud.png"},
2372         is_ground_content = false,
2373         sounds = default.node_sound_defaults(),
2374         groups = {not_in_creative_inventory = 1},
2375 })
2376
2377 --
2378 -- register trees for leafdecay
2379 --
2380
2381 if minetest.get_mapgen_setting("mg_name") == "v6" then
2382         default.register_leafdecay({
2383                 trunks = {"default:tree"},
2384                 leaves = {"default:apple", "default:leaves"},
2385                 radius = 2,
2386         })
2387
2388         default.register_leafdecay({
2389                 trunks = {"default:jungletree"},
2390                 leaves = {"default:jungleleaves"},
2391                 radius = 3,
2392         })
2393
2394         default.register_leafdecay({
2395                 trunks = {"default:pine_tree"},
2396                 leaves = {"default:pine_needles"},
2397                 radius = 3,
2398         })
2399 else
2400         default.register_leafdecay({
2401                 trunks = {"default:tree"},
2402                 leaves = {"default:apple", "default:leaves"},
2403                 radius = 3,
2404         })
2405
2406         default.register_leafdecay({
2407                 trunks = {"default:jungletree"},
2408                 leaves = {"default:jungleleaves"},
2409                 radius = 2,
2410         })
2411
2412         default.register_leafdecay({
2413                 trunks = {"default:pine_tree"},
2414                 leaves = {"default:pine_needles"},
2415                 radius = 2,
2416         })
2417 end
2418
2419 default.register_leafdecay({
2420         trunks = {"default:acacia_tree"},
2421         leaves = {"default:acacia_leaves"},
2422         radius = 2,
2423 })
2424
2425 default.register_leafdecay({
2426         trunks = {"default:aspen_tree"},
2427         leaves = {"default:aspen_leaves"},
2428         radius = 3,
2429 })
2430
2431 default.register_leafdecay({
2432         trunks = {"default:bush_stem"},
2433         leaves = {"default:bush_leaves"},
2434         radius = 1,
2435 })
2436
2437 default.register_leafdecay({
2438         trunks = {"default:acacia_bush_stem"},
2439         leaves = {"default:acacia_bush_leaves"},
2440         radius = 1,
2441 })