Default: Prevent placing sapling if grown tree intersects protection
[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
34 default:obsidian
35 default:obsidianbrick
36 default:obsidian_block
37
38 Soft / Non-Stone
39 ----------------
40 (1. Material 2. Modified forms)
41
42 default:dirt
43 default:dirt_with_grass
44 default:dirt_with_grass_footsteps
45 default:dirt_with_dry_grass
46 default:dirt_with_snow
47
48 default:sand
49 default:desert_sand
50
51 default:gravel
52
53 default:clay
54
55 default:snow
56 default:snowblock
57
58 default:ice
59
60 Trees
61 -----
62 (1. Trunk 2. Fabricated trunk 3. Leaves 4. Sapling 5. Fruits)
63
64 default:tree
65 default:wood
66 default:leaves
67 default:sapling
68 default:apple
69
70 default:jungletree
71 default:junglewood
72 default:jungleleaves
73 default:junglesapling
74
75 default:pine_tree
76 default:pine_wood
77 default:pine_needles
78 default:pine_sapling
79
80 default:acacia_tree
81 default:acacia_wood
82 default:acacia_leaves
83 default:acacia_sapling
84
85 default:aspen_tree
86 default:aspen_wood
87 default:aspen_leaves
88 default:aspen_sapling
89
90 Ores
91 ----
92 (1. In stone 2. Blocks)
93
94 default:stone_with_coal
95 default:coalblock
96
97 default:stone_with_iron
98 default:steelblock
99
100 default:stone_with_copper
101 default:copperblock
102 default:bronzeblock
103
104 default:stone_with_gold
105 default:goldblock
106
107 default:stone_with_mese
108 default:mese
109
110 default:stone_with_diamond
111 default:diamondblock
112
113 Plantlife (non-cubic)
114 ---------------------
115
116 default:cactus
117 default:papyrus
118 default:dry_shrub
119 default:junglegrass
120
121 default:grass_1
122 default:grass_2
123 default:grass_3
124 default:grass_4
125 default:grass_5
126
127 default:dry_grass_1
128 default:dry_grass_2
129 default:dry_grass_3
130 default:dry_grass_4
131 default:dry_grass_5
132
133 Liquids
134 -------
135 (1. Source 2. Flowing)
136
137 default:water_source
138 default:water_flowing
139
140 default:river_water_source
141 default:river_water_flowing
142
143 default:lava_source
144 default:lava_flowing
145
146 Tools / "Advanced" crafting / Non-"natural"
147 -------------------------------------------
148
149 default:torch
150
151 default:chest
152 default:chest_locked
153
154 default:bookshelf
155
156 default:sign_wall_wood
157 default:sign_wall_steel
158
159 default:ladder_wood
160 default:ladder_steel
161
162 default:fence_wood
163 default:fence_acacia_wood
164 default:fence_junglewood
165 default:fence_pine_wood
166 default:fence_aspen_wood
167
168 default:glass
169 default:obsidian_glass
170
171 default:rail
172
173 default:brick
174
175 default:meselamp
176
177 Misc
178 ----
179
180 default:cloud
181
182 --]]
183
184 --
185 -- Stone
186 --
187
188 minetest.register_node("default:stone", {
189         description = "Stone",
190         tiles = {"default_stone.png"},
191         groups = {cracky = 3, stone = 1},
192         drop = 'default:cobble',
193         legacy_mineral = true,
194         sounds = default.node_sound_stone_defaults(),
195 })
196
197 minetest.register_node("default:cobble", {
198         description = "Cobblestone",
199         tiles = {"default_cobble.png"},
200         is_ground_content = false,
201         groups = {cracky = 3, stone = 2},
202         sounds = default.node_sound_stone_defaults(),
203 })
204
205 minetest.register_node("default:stonebrick", {
206         description = "Stone Brick",
207         paramtype2 = "facedir",
208         place_param2 = 0,
209         tiles = {"default_stone_brick.png"},
210         is_ground_content = false,
211         groups = {cracky = 2, stone = 1},
212         sounds = default.node_sound_stone_defaults(),
213 })
214
215 minetest.register_node("default:stone_block", {
216         description = "Stone Block",
217         tiles = {"default_stone_block.png"},
218         is_ground_content = false,
219         groups = {cracky = 2, stone = 1},
220         sounds = default.node_sound_stone_defaults(),
221 })
222
223 minetest.register_node("default:mossycobble", {
224         description = "Mossy Cobblestone",
225         tiles = {"default_mossycobble.png"},
226         is_ground_content = false,
227         groups = {cracky = 3, stone = 1},
228         sounds = default.node_sound_stone_defaults(),
229 })
230
231
232 minetest.register_node("default:desert_stone", {
233         description = "Desert Stone",
234         tiles = {"default_desert_stone.png"},
235         groups = {cracky = 3, stone = 1},
236         drop = 'default:desert_cobble',
237         legacy_mineral = true,
238         sounds = default.node_sound_stone_defaults(),
239 })
240
241 minetest.register_node("default:desert_cobble", {
242         description = "Desert Cobblestone",
243         tiles = {"default_desert_cobble.png"},
244         is_ground_content = false,
245         groups = {cracky = 3, stone = 2},
246         sounds = default.node_sound_stone_defaults(),
247 })
248
249 minetest.register_node("default:desert_stonebrick", {
250         description = "Desert Stone Brick",
251         paramtype2 = "facedir",
252         place_param2 = 0,
253         tiles = {"default_desert_stone_brick.png"},
254         is_ground_content = false,
255         groups = {cracky = 2, stone = 1},
256         sounds = default.node_sound_stone_defaults(),
257 })
258
259 minetest.register_node("default:desert_stone_block", {
260         description = "Desert Stone Block",
261         tiles = {"default_desert_stone_block.png"},
262         is_ground_content = false,
263         groups = {cracky = 2, stone = 1},
264         sounds = default.node_sound_stone_defaults(),
265 })
266
267
268 minetest.register_node("default:sandstone", {
269         description = "Sandstone",
270         tiles = {"default_sandstone.png"},
271         groups = {crumbly = 1, cracky = 3},
272         sounds = default.node_sound_stone_defaults(),
273 })
274
275 minetest.register_node("default:sandstonebrick", {
276         description = "Sandstone Brick",
277         paramtype2 = "facedir",
278         place_param2 = 0,
279         tiles = {"default_sandstone_brick.png"},
280         is_ground_content = false,
281         groups = {cracky = 2},
282         sounds = default.node_sound_stone_defaults(),
283 })
284
285 minetest.register_node("default:sandstone_block", {
286         description = "Sandstone Block",
287         tiles = {"default_sandstone_block.png"},
288         is_ground_content = false,
289         groups = {cracky = 2},
290         sounds = default.node_sound_stone_defaults(),
291 })
292
293
294 minetest.register_node("default:obsidian", {
295         description = "Obsidian",
296         tiles = {"default_obsidian.png"},
297         sounds = default.node_sound_stone_defaults(),
298         groups = {cracky = 1, level = 2},
299 })
300
301 minetest.register_node("default:obsidianbrick", {
302         description = "Obsidian Brick",
303         paramtype2 = "facedir",
304         place_param2 = 0,
305         tiles = {"default_obsidian_brick.png"},
306         is_ground_content = false,
307         sounds = default.node_sound_stone_defaults(),
308         groups = {cracky = 1, level = 2},
309 })
310
311 minetest.register_node("default:obsidian_block", {
312         description = "Obsidian Block",
313         tiles = {"default_obsidian_block.png"},
314         is_ground_content = false,
315         sounds = default.node_sound_stone_defaults(),
316         groups = {cracky = 1, level = 2},
317 })
318
319 --
320 -- Soft / Non-Stone
321 --
322
323 minetest.register_node("default:dirt", {
324         description = "Dirt",
325         tiles = {"default_dirt.png"},
326         groups = {crumbly = 3, soil = 1},
327         sounds = default.node_sound_dirt_defaults(),
328 })
329
330 minetest.register_node("default:dirt_with_grass", {
331         description = "Dirt with Grass",
332         tiles = {"default_grass.png", "default_dirt.png",
333                 {name = "default_dirt.png^default_grass_side.png",
334                         tileable_vertical = false}},
335         groups = {crumbly = 3, soil = 1},
336         drop = 'default:dirt',
337         sounds = default.node_sound_dirt_defaults({
338                 footstep = {name = "default_grass_footstep", gain = 0.25},
339         }),
340 })
341
342 minetest.register_node("default:dirt_with_grass_footsteps", {
343         description = "Dirt with Grass and Footsteps",
344         tiles = {"default_grass.png^default_footprint.png", "default_dirt.png",
345                 {name = "default_dirt.png^default_grass_side.png",
346                         tileable_vertical = false}},
347         groups = {crumbly = 3, soil = 1, not_in_creative_inventory = 1},
348         drop = 'default:dirt',
349         sounds = default.node_sound_dirt_defaults({
350                 footstep = {name = "default_grass_footstep", gain = 0.25},
351         }),
352 })
353
354 minetest.register_node("default:dirt_with_dry_grass", {
355         description = "Dirt with Dry Grass",
356         tiles = {"default_dry_grass.png",
357                 "default_dirt.png",
358                 {name = "default_dirt.png^default_dry_grass_side.png",
359                         tileable_vertical = false}},
360         groups = {crumbly = 3, soil = 1},
361         drop = 'default:dirt',
362         sounds = default.node_sound_dirt_defaults({
363                 footstep = {name = "default_grass_footstep", gain = 0.4},
364         }),
365 })
366
367 minetest.register_node("default:dirt_with_snow", {
368         description = "Dirt with Snow",
369         tiles = {"default_snow.png", "default_dirt.png",
370                 {name = "default_dirt.png^default_snow_side.png",
371                         tileable_vertical = false}},
372         groups = {crumbly = 3, soil = 1},
373         drop = 'default:dirt',
374         sounds = default.node_sound_dirt_defaults({
375                 footstep = {name = "default_snow_footstep", gain = 0.15},
376         }),
377 })
378
379 minetest.register_node("default:sand", {
380         description = "Sand",
381         tiles = {"default_sand.png"},
382         groups = {crumbly = 3, falling_node = 1, sand = 1},
383         sounds = default.node_sound_sand_defaults(),
384 })
385
386 minetest.register_node("default:desert_sand", {
387         description = "Desert Sand",
388         tiles = {"default_desert_sand.png"},
389         groups = {crumbly = 3, falling_node = 1, sand = 1},
390         sounds = default.node_sound_sand_defaults(),
391 })
392
393
394 minetest.register_node("default:gravel", {
395         description = "Gravel",
396         tiles = {"default_gravel.png"},
397         groups = {crumbly = 2, falling_node = 1},
398         sounds = default.node_sound_gravel_defaults(),
399         drop = {
400                 max_items = 1,
401                 items = {
402                         {items = {'default:flint'}, rarity = 16},
403                         {items = {'default:gravel'}}
404                 }
405         }
406 })
407
408 minetest.register_node("default:clay", {
409         description = "Clay",
410         tiles = {"default_clay.png"},
411         groups = {crumbly = 3},
412         drop = 'default:clay_lump 4',
413         sounds = default.node_sound_dirt_defaults(),
414 })
415
416
417 minetest.register_node("default:snow", {
418         description = "Snow",
419         tiles = {"default_snow.png"},
420         inventory_image = "default_snowball.png",
421         wield_image = "default_snowball.png",
422         paramtype = "light",
423         buildable_to = true,
424         floodable = true,
425         drawtype = "nodebox",
426         node_box = {
427                 type = "fixed",
428                 fixed = {
429                         {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
430                 },
431         },
432         groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1},
433         sounds = default.node_sound_dirt_defaults({
434                 footstep = {name = "default_snow_footstep", gain = 0.15},
435                 dug = {name = "default_snow_footstep", gain = 0.2},
436                 dig = {name = "default_snow_footstep", gain = 0.2}
437         }),
438
439         on_construct = function(pos)
440                 pos.y = pos.y - 1
441                 if minetest.get_node(pos).name == "default:dirt_with_grass" then
442                         minetest.set_node(pos, {name = "default:dirt_with_snow"})
443                 end
444         end,
445 })
446
447 minetest.register_node("default:snowblock", {
448         description = "Snow Block",
449         tiles = {"default_snow.png"},
450         groups = {crumbly = 3, puts_out_fire = 1},
451         sounds = default.node_sound_dirt_defaults({
452                 footstep = {name = "default_snow_footstep", gain = 0.15},
453                 dug = {name = "default_snow_footstep", gain = 0.2},
454                 dig = {name = "default_snow_footstep", gain = 0.2}
455         }),
456 })
457
458 minetest.register_node("default:ice", {
459         description = "Ice",
460         tiles = {"default_ice.png"},
461         is_ground_content = false,
462         paramtype = "light",
463         groups = {cracky = 3, puts_out_fire = 1},
464         sounds = default.node_sound_glass_defaults(),
465 })
466
467 --
468 -- Trees
469 --
470
471 minetest.register_node("default:tree", {
472         description = "Tree",
473         tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
474         paramtype2 = "facedir",
475         is_ground_content = false,
476         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
477         sounds = default.node_sound_wood_defaults(),
478
479         on_place = minetest.rotate_node
480 })
481
482 minetest.register_node("default:wood", {
483         description = "Wooden Planks",
484         paramtype2 = "facedir",
485         place_param2 = 0,
486         tiles = {"default_wood.png"},
487         is_ground_content = false,
488         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
489         sounds = default.node_sound_wood_defaults(),
490 })
491
492 minetest.register_node("default:sapling", {
493         description = "Sapling",
494         drawtype = "plantlike",
495         visual_scale = 1.0,
496         tiles = {"default_sapling.png"},
497         inventory_image = "default_sapling.png",
498         wield_image = "default_sapling.png",
499         paramtype = "light",
500         sunlight_propagates = true,
501         walkable = false,
502         on_timer = default.grow_sapling,
503         selection_box = {
504                 type = "fixed",
505                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
506         },
507         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
508                 attached_node = 1, sapling = 1},
509         sounds = default.node_sound_leaves_defaults(),
510
511         on_construct = function(pos)
512                 minetest.get_node_timer(pos):start(math.random(2400,4800))
513         end,
514
515         on_place = function(itemstack, placer, pointed_thing)
516                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
517                         "default:sapling",
518                         -- minp, maxp to be checked, relative to sapling pos
519                         -- minp_relative.y = 1 because sapling pos has been checked
520                         {x = -2, y = 1, z = -2},
521                         {x = 2, y = 6, z = 2},
522                         -- maximum interval of interior volume check
523                         4)
524
525                 return itemstack
526         end,
527 })
528
529 minetest.register_node("default:leaves", {
530         description = "Leaves",
531         drawtype = "allfaces_optional",
532         waving = 1,
533         visual_scale = 1.3,
534         tiles = {"default_leaves.png"},
535         special_tiles = {"default_leaves_simple.png"},
536         paramtype = "light",
537         is_ground_content = false,
538         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
539         drop = {
540                 max_items = 1,
541                 items = {
542                         {
543                                 -- player will get sapling with 1/20 chance
544                                 items = {'default:sapling'},
545                                 rarity = 20,
546                         },
547                         {
548                                 -- player will get leaves only if he get no saplings,
549                                 -- this is because max_items is 1
550                                 items = {'default:leaves'},
551                         }
552                 }
553         },
554         sounds = default.node_sound_leaves_defaults(),
555
556         after_place_node = default.after_place_leaves,
557 })
558
559 minetest.register_node("default:apple", {
560         description = "Apple",
561         drawtype = "plantlike",
562         visual_scale = 1.0,
563         tiles = {"default_apple.png"},
564         inventory_image = "default_apple.png",
565         paramtype = "light",
566         sunlight_propagates = true,
567         walkable = false,
568         is_ground_content = false,
569         selection_box = {
570                 type = "fixed",
571                 fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
572         },
573         groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
574                 leafdecay = 3, leafdecay_drop = 1},
575         on_use = minetest.item_eat(2),
576         sounds = default.node_sound_leaves_defaults(),
577
578         after_place_node = function(pos, placer, itemstack)
579                 if placer:is_player() then
580                         minetest.set_node(pos, {name = "default:apple", param2 = 1})
581                 end
582         end,
583 })
584
585
586 minetest.register_node("default:jungletree", {
587         description = "Jungle Tree",
588         tiles = {"default_jungletree_top.png", "default_jungletree_top.png",
589                 "default_jungletree.png"},
590         paramtype2 = "facedir",
591         is_ground_content = false,
592         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
593         sounds = default.node_sound_wood_defaults(),
594
595         on_place = minetest.rotate_node
596 })
597
598 minetest.register_node("default:junglewood", {
599         description = "Junglewood Planks",
600         paramtype2 = "facedir",
601         place_param2 = 0,
602         tiles = {"default_junglewood.png"},
603         is_ground_content = false,
604         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
605         sounds = default.node_sound_wood_defaults(),
606 })
607
608 minetest.register_node("default:jungleleaves", {
609         description = "Jungle Leaves",
610         drawtype = "allfaces_optional",
611         waving = 1,
612         visual_scale = 1.3,
613         tiles = {"default_jungleleaves.png"},
614         special_tiles = {"default_jungleleaves_simple.png"},
615         paramtype = "light",
616         is_ground_content = false,
617         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
618         drop = {
619                 max_items = 1,
620                 items = {
621                         {items = {'default:junglesapling'}, rarity = 20},
622                         {items = {'default:jungleleaves'}}
623                 }
624         },
625         sounds = default.node_sound_leaves_defaults(),
626
627         after_place_node = default.after_place_leaves,
628 })
629
630 minetest.register_node("default:junglesapling", {
631         description = "Jungle Sapling",
632         drawtype = "plantlike",
633         visual_scale = 1.0,
634         tiles = {"default_junglesapling.png"},
635         inventory_image = "default_junglesapling.png",
636         wield_image = "default_junglesapling.png",
637         paramtype = "light",
638         sunlight_propagates = true,
639         walkable = false,
640         on_timer = default.grow_sapling,
641         selection_box = {
642                 type = "fixed",
643                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
644         },
645         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
646                 attached_node = 1, sapling = 1},
647         sounds = default.node_sound_leaves_defaults(),
648
649         on_construct = function(pos)
650                 minetest.get_node_timer(pos):start(math.random(2400,4800))
651         end,
652
653         on_place = function(itemstack, placer, pointed_thing)
654                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
655                         "default:junglesapling",
656                         -- minp, maxp to be checked, relative to sapling pos
657                         -- minp_relative.y = 1 because sapling pos has been checked
658                         {x = -2, y = 1, z = -2},
659                         {x = 2, y = 15, z = 2},
660                         -- maximum interval of interior volume check
661                         4)
662
663                 return itemstack
664         end,
665 })
666
667
668 minetest.register_node("default:pine_tree", {
669         description = "Pine Tree",
670         tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png",
671                 "default_pine_tree.png"},
672         paramtype2 = "facedir",
673         is_ground_content = false,
674         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
675         sounds = default.node_sound_wood_defaults(),
676
677         on_place = minetest.rotate_node
678 })
679
680 minetest.register_node("default:pine_wood", {
681         description = "Pine Wood Planks",
682         paramtype2 = "facedir",
683         place_param2 = 0,
684         tiles = {"default_pine_wood.png"},
685         is_ground_content = false,
686         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
687         sounds = default.node_sound_wood_defaults(),
688 })
689
690 minetest.register_node("default:pine_needles",{
691         description = "Pine Needles",
692         drawtype = "allfaces_optional",
693         visual_scale = 1.3,
694         tiles = {"default_pine_needles.png"},
695         waving = 1,
696         paramtype = "light",
697         is_ground_content = false,
698         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
699         drop = {
700                 max_items = 1,
701                 items = {
702                         {items = {"default:pine_sapling"}, rarity = 20},
703                         {items = {"default:pine_needles"}}
704                 }
705         },
706         sounds = default.node_sound_leaves_defaults(),
707
708         after_place_node = default.after_place_leaves,
709 })
710
711 minetest.register_node("default:pine_sapling", {
712         description = "Pine Sapling",
713         drawtype = "plantlike",
714         visual_scale = 1.0,
715         tiles = {"default_pine_sapling.png"},
716         inventory_image = "default_pine_sapling.png",
717         wield_image = "default_pine_sapling.png",
718         paramtype = "light",
719         sunlight_propagates = true,
720         walkable = false,
721         on_timer = default.grow_sapling,
722         selection_box = {
723                 type = "fixed",
724                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
725         },
726         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
727                 attached_node = 1, sapling = 1},
728         sounds = default.node_sound_leaves_defaults(),
729
730         on_construct = function(pos)
731                 minetest.get_node_timer(pos):start(math.random(2400,4800))
732         end,
733
734         on_place = function(itemstack, placer, pointed_thing)
735                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
736                         "default:pine_sapling",
737                         -- minp, maxp to be checked, relative to sapling pos
738                         -- minp_relative.y = 1 because sapling pos has been checked
739                         {x = -2, y = 1, z = -2},
740                         {x = 2, y = 12, z = 2},
741                         -- maximum interval of interior volume check
742                         4)
743
744                 return itemstack
745         end,
746 })
747
748
749 minetest.register_node("default:acacia_tree", {
750         description = "Acacia Tree",
751         tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png",
752                 "default_acacia_tree.png"},
753         paramtype2 = "facedir",
754         is_ground_content = false,
755         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
756         sounds = default.node_sound_wood_defaults(),
757
758         on_place = minetest.rotate_node
759 })
760
761 minetest.register_node("default:acacia_wood", {
762         description = "Acacia Wood Planks",
763         paramtype2 = "facedir",
764         place_param2 = 0,
765         tiles = {"default_acacia_wood.png"},
766         is_ground_content = false,
767         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
768         sounds = default.node_sound_wood_defaults(),
769 })
770
771 minetest.register_node("default:acacia_leaves", {
772         description = "Acacia Leaves",
773         drawtype = "allfaces_optional",
774         visual_scale = 1.3,
775         tiles = {"default_acacia_leaves.png"},
776         waving = 1,
777         paramtype = "light",
778         is_ground_content = false,
779         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
780         drop = {
781                 max_items = 1,
782                 items = {
783                         {items = {"default:acacia_sapling"}, rarity = 20},
784                         {items = {"default:acacia_leaves"}}
785                 }
786         },
787         sounds = default.node_sound_leaves_defaults(),
788
789         after_place_node = default.after_place_leaves,
790 })
791
792 minetest.register_node("default:acacia_sapling", {
793         description = "Acacia Tree Sapling",
794         drawtype = "plantlike",
795         visual_scale = 1.0,
796         tiles = {"default_acacia_sapling.png"},
797         inventory_image = "default_acacia_sapling.png",
798         wield_image = "default_acacia_sapling.png",
799         paramtype = "light",
800         sunlight_propagates = true,
801         walkable = false,
802         on_timer = default.grow_sapling,
803         selection_box = {
804                 type = "fixed",
805                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
806         },
807         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
808                 attached_node = 1, sapling = 1},
809         sounds = default.node_sound_leaves_defaults(),
810
811         on_construct = function(pos)
812                 minetest.get_node_timer(pos):start(math.random(2400,4800))
813         end,
814
815         on_place = function(itemstack, placer, pointed_thing)
816                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
817                         "default:acacia_sapling",
818                         -- minp, maxp to be checked, relative to sapling pos
819                         -- minp_relative.y = 1 because sapling pos has been checked
820                         {x = -4, y = 1, z = -4},
821                         {x = 4, y = 6, z = 4},
822                         -- maximum interval of interior volume check
823                         4)
824
825                 return itemstack
826         end,
827 })
828
829 minetest.register_node("default:aspen_tree", {
830         description = "Aspen Tree",
831         tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png",
832                 "default_aspen_tree.png"},
833         paramtype2 = "facedir",
834         is_ground_content = false,
835         groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
836         sounds = default.node_sound_wood_defaults(),
837
838         on_place = minetest.rotate_node
839 })
840
841 minetest.register_node("default:aspen_wood", {
842         description = "Aspen Wood Planks",
843         paramtype2 = "facedir",
844         place_param2 = 0,
845         tiles = {"default_aspen_wood.png"},
846         is_ground_content = false,
847         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
848         sounds = default.node_sound_wood_defaults(),
849 })
850
851 minetest.register_node("default:aspen_leaves", {
852         description = "Aspen Leaves",
853         drawtype = "allfaces_optional",
854         visual_scale = 1.3,
855         tiles = {"default_aspen_leaves.png"},
856         waving = 1,
857         paramtype = "light",
858         is_ground_content = false,
859         groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
860         drop = {
861                 max_items = 1,
862                 items = {
863                         {items = {"default:aspen_sapling"}, rarity = 20},
864                         {items = {"default:aspen_leaves"}}
865                 }
866         },
867         sounds = default.node_sound_leaves_defaults(),
868
869         after_place_node = default.after_place_leaves,
870 })
871
872 minetest.register_node("default:aspen_sapling", {
873         description = "Aspen Tree Sapling",
874         drawtype = "plantlike",
875         visual_scale = 1.0,
876         tiles = {"default_aspen_sapling.png"},
877         inventory_image = "default_aspen_sapling.png",
878         wield_image = "default_aspen_sapling.png",
879         paramtype = "light",
880         sunlight_propagates = true,
881         walkable = false,
882         on_timer = default.grow_sapling,
883         selection_box = {
884                 type = "fixed",
885                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
886         },
887         groups = {snappy = 2, dig_immediate = 3, flammable = 2,
888                 attached_node = 1, sapling = 1},
889         sounds = default.node_sound_leaves_defaults(),
890
891         on_construct = function(pos)
892                 minetest.get_node_timer(pos):start(math.random(2400,4800))
893         end,
894
895         on_place = function(itemstack, placer, pointed_thing)
896                 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
897                         "default:aspen_sapling",
898                         -- minp, maxp to be checked, relative to sapling pos
899                         -- minp_relative.y = 1 because sapling pos has been checked
900                         {x = -2, y = 1, z = -2},
901                         {x = 2, y = 12, z = 2},
902                         -- maximum interval of interior volume check
903                         4)
904
905                 return itemstack
906         end,
907 })
908
909 --
910 -- Ores
911 --
912
913 minetest.register_node("default:stone_with_coal", {
914         description = "Coal Ore",
915         tiles = {"default_stone.png^default_mineral_coal.png"},
916         groups = {cracky = 3},
917         drop = 'default:coal_lump',
918         sounds = default.node_sound_stone_defaults(),
919 })
920
921 minetest.register_node("default:coalblock", {
922         description = "Coal Block",
923         tiles = {"default_coal_block.png"},
924         is_ground_content = false,
925         groups = {cracky = 3},
926         sounds = default.node_sound_stone_defaults(),
927 })
928
929
930 minetest.register_node("default:stone_with_iron", {
931         description = "Iron Ore",
932         tiles = {"default_stone.png^default_mineral_iron.png"},
933         groups = {cracky = 2},
934         drop = 'default:iron_lump',
935         sounds = default.node_sound_stone_defaults(),
936 })
937
938 minetest.register_node("default:steelblock", {
939         description = "Steel Block",
940         tiles = {"default_steel_block.png"},
941         is_ground_content = false,
942         groups = {cracky = 1, level = 2},
943         sounds = default.node_sound_stone_defaults(),
944 })
945
946
947 minetest.register_node("default:stone_with_copper", {
948         description = "Copper Ore",
949         tiles = {"default_stone.png^default_mineral_copper.png"},
950         groups = {cracky = 2},
951         drop = 'default:copper_lump',
952         sounds = default.node_sound_stone_defaults(),
953 })
954
955 minetest.register_node("default:copperblock", {
956         description = "Copper Block",
957         tiles = {"default_copper_block.png"},
958         is_ground_content = false,
959         groups = {cracky = 1, level = 2},
960         sounds = default.node_sound_stone_defaults(),
961 })
962
963 minetest.register_node("default:bronzeblock", {
964         description = "Bronze Block",
965         tiles = {"default_bronze_block.png"},
966         is_ground_content = false,
967         groups = {cracky = 1, level = 2},
968         sounds = default.node_sound_stone_defaults(),
969 })
970
971
972 minetest.register_node("default:stone_with_mese", {
973         description = "Mese Ore",
974         tiles = {"default_stone.png^default_mineral_mese.png"},
975         groups = {cracky = 1},
976         drop = "default:mese_crystal",
977         sounds = default.node_sound_stone_defaults(),
978 })
979
980 minetest.register_node("default:mese", {
981         description = "Mese Block",
982         tiles = {"default_mese_block.png"},
983         paramtype = "light",
984         groups = {cracky = 1, level = 2},
985         sounds = default.node_sound_stone_defaults(),
986         light_source = 3,
987 })
988
989
990 minetest.register_node("default:stone_with_gold", {
991         description = "Gold Ore",
992         tiles = {"default_stone.png^default_mineral_gold.png"},
993         groups = {cracky = 2},
994         drop = "default:gold_lump",
995         sounds = default.node_sound_stone_defaults(),
996 })
997
998 minetest.register_node("default:goldblock", {
999         description = "Gold Block",
1000         tiles = {"default_gold_block.png"},
1001         is_ground_content = false,
1002         groups = {cracky = 1},
1003         sounds = default.node_sound_stone_defaults(),
1004 })
1005
1006
1007 minetest.register_node("default:stone_with_diamond", {
1008         description = "Diamond Ore",
1009         tiles = {"default_stone.png^default_mineral_diamond.png"},
1010         groups = {cracky = 1},
1011         drop = "default:diamond",
1012         sounds = default.node_sound_stone_defaults(),
1013 })
1014
1015 minetest.register_node("default:diamondblock", {
1016         description = "Diamond Block",
1017         tiles = {"default_diamond_block.png"},
1018         is_ground_content = false,
1019         groups = {cracky = 1, level = 3},
1020         sounds = default.node_sound_stone_defaults(),
1021 })
1022
1023 --
1024 -- Plantlife (non-cubic)
1025 --
1026
1027 minetest.register_node("default:cactus", {
1028         description = "Cactus",
1029         tiles = {"default_cactus_top.png", "default_cactus_top.png",
1030                 "default_cactus_side.png"},
1031         paramtype2 = "facedir",
1032         groups = {snappy = 1, choppy = 3},
1033         sounds = default.node_sound_wood_defaults(),
1034         on_place = minetest.rotate_node,
1035 })
1036
1037 minetest.register_node("default:papyrus", {
1038         description = "Papyrus",
1039         drawtype = "plantlike",
1040         tiles = {"default_papyrus.png"},
1041         inventory_image = "default_papyrus.png",
1042         wield_image = "default_papyrus.png",
1043         paramtype = "light",
1044         sunlight_propagates = true,
1045         walkable = false,
1046         selection_box = {
1047                 type = "fixed",
1048                 fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
1049         },
1050         groups = {snappy = 3, flammable = 2},
1051         sounds = default.node_sound_leaves_defaults(),
1052
1053         after_dig_node = function(pos, node, metadata, digger)
1054                 default.dig_up(pos, node, digger)
1055         end,
1056 })
1057
1058 minetest.register_node("default:dry_shrub", {
1059         description = "Dry Shrub",
1060         drawtype = "plantlike",
1061         waving = 1,
1062         visual_scale = 1.0,
1063         tiles = {"default_dry_shrub.png"},
1064         inventory_image = "default_dry_shrub.png",
1065         wield_image = "default_dry_shrub.png",
1066         paramtype = "light",
1067         sunlight_propagates = true,
1068         walkable = false,
1069         buildable_to = true,
1070         groups = {snappy = 3, flammable = 3, attached_node = 1},
1071         sounds = default.node_sound_leaves_defaults(),
1072         selection_box = {
1073                 type = "fixed",
1074                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1075         },
1076 })
1077
1078 minetest.register_node("default:junglegrass", {
1079         description = "Jungle Grass",
1080         drawtype = "plantlike",
1081         waving = 1,
1082         visual_scale = 1.3,
1083         tiles = {"default_junglegrass.png"},
1084         inventory_image = "default_junglegrass.png",
1085         wield_image = "default_junglegrass.png",
1086         paramtype = "light",
1087         sunlight_propagates = true,
1088         walkable = false,
1089         buildable_to = true,
1090         groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1},
1091         sounds = default.node_sound_leaves_defaults(),
1092         selection_box = {
1093                 type = "fixed",
1094                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1095         },
1096 })
1097
1098
1099 minetest.register_node("default:grass_1", {
1100         description = "Grass",
1101         drawtype = "plantlike",
1102         waving = 1,
1103         tiles = {"default_grass_1.png"},
1104         -- Use texture of a taller grass stage in inventory
1105         inventory_image = "default_grass_3.png",
1106         wield_image = "default_grass_3.png",
1107         paramtype = "light",
1108         sunlight_propagates = true,
1109         walkable = false,
1110         buildable_to = true,
1111         groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1},
1112         sounds = default.node_sound_leaves_defaults(),
1113         selection_box = {
1114                 type = "fixed",
1115                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1116         },
1117
1118         on_place = function(itemstack, placer, pointed_thing)
1119                 -- place a random grass node
1120                 local stack = ItemStack("default:grass_" .. math.random(1,5))
1121                 local ret = minetest.item_place(stack, placer, pointed_thing)
1122                 return ItemStack("default:grass_1 " ..
1123                         itemstack:get_count() - (1 - ret:get_count()))
1124         end,
1125 })
1126
1127 for i = 2, 5 do
1128         minetest.register_node("default:grass_" .. i, {
1129                 description = "Grass",
1130                 drawtype = "plantlike",
1131                 waving = 1,
1132                 tiles = {"default_grass_" .. i .. ".png"},
1133                 inventory_image = "default_grass_" .. i .. ".png",
1134                 wield_image = "default_grass_" .. i .. ".png",
1135                 paramtype = "light",
1136                 sunlight_propagates = true,
1137                 walkable = false,
1138                 buildable_to = true,
1139                 drop = "default:grass_1",
1140                 groups = {snappy = 3, flora = 1, attached_node = 1,
1141                         not_in_creative_inventory = 1, grass = 1},
1142                 sounds = default.node_sound_leaves_defaults(),
1143                 selection_box = {
1144                         type = "fixed",
1145                         fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1146                 },
1147         })
1148 end
1149
1150
1151 minetest.register_node("default:dry_grass_1", {
1152         description = "Dry Grass",
1153         drawtype = "plantlike",
1154         waving = 1,
1155         tiles = {"default_dry_grass_1.png"},
1156         inventory_image = "default_dry_grass_3.png",
1157         wield_image = "default_dry_grass_3.png",
1158         paramtype = "light",
1159         sunlight_propagates = true,
1160         walkable = false,
1161         buildable_to = true,
1162         groups = {snappy = 3, flammable = 3, flora = 1,
1163                 attached_node = 1, dry_grass = 1},
1164         sounds = default.node_sound_leaves_defaults(),
1165         selection_box = {
1166                 type = "fixed",
1167                 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1168         },
1169
1170         on_place = function(itemstack, placer, pointed_thing)
1171                 -- place a random dry grass node
1172                 local stack = ItemStack("default:dry_grass_" .. math.random(1, 5))
1173                 local ret = minetest.item_place(stack, placer, pointed_thing)
1174                 return ItemStack("default:dry_grass_1 " ..
1175                         itemstack:get_count() - (1 - ret:get_count()))
1176         end,
1177 })
1178
1179 for i = 2, 5 do
1180         minetest.register_node("default:dry_grass_" .. i, {
1181                 description = "Dry Grass",
1182                 drawtype = "plantlike",
1183                 waving = 1,
1184                 tiles = {"default_dry_grass_" .. i .. ".png"},
1185                 inventory_image = "default_dry_grass_" .. i .. ".png",
1186                 wield_image = "default_dry_grass_" .. i .. ".png",
1187                 paramtype = "light",
1188                 sunlight_propagates = true,
1189                 walkable = false,
1190                 buildable_to = true,
1191                 groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
1192                         not_in_creative_inventory=1, dry_grass = 1},
1193                 drop = "default:dry_grass_1",
1194                 sounds = default.node_sound_leaves_defaults(),
1195                 selection_box = {
1196                         type = "fixed",
1197                         fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1198                 },
1199         })
1200 end
1201
1202 --
1203 -- Liquids
1204 --
1205
1206 minetest.register_node("default:water_source", {
1207         description = "Water Source",
1208         drawtype = "liquid",
1209         tiles = {
1210                 {
1211                         name = "default_water_source_animated.png",
1212                         animation = {
1213                                 type = "vertical_frames",
1214                                 aspect_w = 16,
1215                                 aspect_h = 16,
1216                                 length = 2.0,
1217                         },
1218                 },
1219         },
1220         special_tiles = {
1221                 -- New-style water source material (mostly unused)
1222                 {
1223                         name = "default_water_source_animated.png",
1224                         animation = {
1225                                 type = "vertical_frames",
1226                                 aspect_w = 16,
1227                                 aspect_h = 16,
1228                                 length = 2.0,
1229                         },
1230                         backface_culling = false,
1231                 },
1232         },
1233         alpha = 160,
1234         paramtype = "light",
1235         walkable = false,
1236         pointable = false,
1237         diggable = false,
1238         buildable_to = true,
1239         is_ground_content = false,
1240         drop = "",
1241         drowning = 1,
1242         liquidtype = "source",
1243         liquid_alternative_flowing = "default:water_flowing",
1244         liquid_alternative_source = "default:water_source",
1245         liquid_viscosity = 1,
1246         post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1247         groups = {water = 3, liquid = 3, puts_out_fire = 1},
1248 })
1249
1250 minetest.register_node("default:water_flowing", {
1251         description = "Flowing Water",
1252         drawtype = "flowingliquid",
1253         tiles = {"default_water.png"},
1254         special_tiles = {
1255                 {
1256                         name = "default_water_flowing_animated.png",
1257                         backface_culling = false,
1258                         animation = {
1259                                 type = "vertical_frames",
1260                                 aspect_w = 16,
1261                                 aspect_h = 16,
1262                                 length = 0.8,
1263                         },
1264                 },
1265                 {
1266                         name = "default_water_flowing_animated.png",
1267                         backface_culling = true,
1268                         animation = {
1269                                 type = "vertical_frames",
1270                                 aspect_w = 16,
1271                                 aspect_h = 16,
1272                                 length = 0.8,
1273                         },
1274                 },
1275         },
1276         alpha = 160,
1277         paramtype = "light",
1278         paramtype2 = "flowingliquid",
1279         walkable = false,
1280         pointable = false,
1281         diggable = false,
1282         buildable_to = true,
1283         is_ground_content = false,
1284         drop = "",
1285         drowning = 1,
1286         liquidtype = "flowing",
1287         liquid_alternative_flowing = "default:water_flowing",
1288         liquid_alternative_source = "default:water_source",
1289         liquid_viscosity = 1,
1290         post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1291         groups = {water = 3, liquid = 3, puts_out_fire = 1,
1292                 not_in_creative_inventory = 1},
1293 })
1294
1295
1296 minetest.register_node("default:river_water_source", {
1297         description = "River Water Source",
1298         drawtype = "liquid",
1299         tiles = {
1300                 {
1301                         name = "default_river_water_source_animated.png",
1302                         animation = {
1303                                 type = "vertical_frames",
1304                                 aspect_w = 16,
1305                                 aspect_h = 16,
1306                                 length = 2.0,
1307                         },
1308                 },
1309         },
1310         special_tiles = {
1311                 {
1312                         name = "default_river_water_source_animated.png",
1313                         animation = {
1314                                 type = "vertical_frames",
1315                                 aspect_w = 16,
1316                                 aspect_h = 16,
1317                                 length = 2.0,
1318                         },
1319                         backface_culling = false,
1320                 },
1321         },
1322         alpha = 160,
1323         paramtype = "light",
1324         walkable = false,
1325         pointable = false,
1326         diggable = false,
1327         buildable_to = true,
1328         is_ground_content = false,
1329         drop = "",
1330         drowning = 1,
1331         liquidtype = "source",
1332         liquid_alternative_flowing = "default:river_water_flowing",
1333         liquid_alternative_source = "default:river_water_source",
1334         liquid_viscosity = 1,
1335         liquid_renewable = false,
1336         liquid_range = 2,
1337         post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1338         groups = {water = 3, liquid = 3, puts_out_fire = 1},
1339 })
1340
1341 minetest.register_node("default:river_water_flowing", {
1342         description = "Flowing River Water",
1343         drawtype = "flowingliquid",
1344         tiles = {"default_river_water.png"},
1345         special_tiles = {
1346                 {
1347                         name = "default_river_water_flowing_animated.png",
1348                         backface_culling = false,
1349                         animation = {
1350                                 type = "vertical_frames",
1351                                 aspect_w = 16,
1352                                 aspect_h = 16,
1353                                 length = 0.8,
1354                         },
1355                 },
1356                 {
1357                         name = "default_river_water_flowing_animated.png",
1358                         backface_culling = true,
1359                         animation = {
1360                                 type = "vertical_frames",
1361                                 aspect_w = 16,
1362                                 aspect_h = 16,
1363                                 length = 0.8,
1364                         },
1365                 },
1366         },
1367         alpha = 160,
1368         paramtype = "light",
1369         paramtype2 = "flowingliquid",
1370         walkable = false,
1371         pointable = false,
1372         diggable = false,
1373         buildable_to = true,
1374         is_ground_content = false,
1375         drop = "",
1376         drowning = 1,
1377         liquidtype = "flowing",
1378         liquid_alternative_flowing = "default:river_water_flowing",
1379         liquid_alternative_source = "default:river_water_source",
1380         liquid_viscosity = 1,
1381         liquid_renewable = false,
1382         liquid_range = 2,
1383         post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1384         groups = {water = 3, liquid = 3, puts_out_fire = 1,
1385                 not_in_creative_inventory = 1},
1386 })
1387
1388
1389 minetest.register_node("default:lava_source", {
1390         description = "Lava Source",
1391         drawtype = "liquid",
1392         tiles = {
1393                 {
1394                         name = "default_lava_source_animated.png",
1395                         animation = {
1396                                 type = "vertical_frames",
1397                                 aspect_w = 16,
1398                                 aspect_h = 16,
1399                                 length = 3.0,
1400                         },
1401                 },
1402         },
1403         special_tiles = {
1404                 -- New-style lava source material (mostly unused)
1405                 {
1406                         name = "default_lava_source_animated.png",
1407                         animation = {
1408                                 type = "vertical_frames",
1409                                 aspect_w = 16,
1410                                 aspect_h = 16,
1411                                 length = 3.0,
1412                         },
1413                         backface_culling = false,
1414                 },
1415         },
1416         paramtype = "light",
1417         light_source = default.LIGHT_MAX - 1,
1418         walkable = false,
1419         pointable = false,
1420         diggable = false,
1421         buildable_to = true,
1422         is_ground_content = false,
1423         drop = "",
1424         drowning = 1,
1425         liquidtype = "source",
1426         liquid_alternative_flowing = "default:lava_flowing",
1427         liquid_alternative_source = "default:lava_source",
1428         liquid_viscosity = 7,
1429         liquid_renewable = false,
1430         damage_per_second = 4 * 2,
1431         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1432         groups = {lava = 3, liquid = 2, igniter = 1},
1433 })
1434
1435 minetest.register_node("default:lava_flowing", {
1436         description = "Flowing Lava",
1437         drawtype = "flowingliquid",
1438         tiles = {"default_lava.png"},
1439         special_tiles = {
1440                 {
1441                         name = "default_lava_flowing_animated.png",
1442                         backface_culling = false,
1443                         animation = {
1444                                 type = "vertical_frames",
1445                                 aspect_w = 16,
1446                                 aspect_h = 16,
1447                                 length = 3.3,
1448                         },
1449                 },
1450                 {
1451                         name = "default_lava_flowing_animated.png",
1452                         backface_culling = true,
1453                         animation = {
1454                                 type = "vertical_frames",
1455                                 aspect_w = 16,
1456                                 aspect_h = 16,
1457                                 length = 3.3,
1458                         },
1459                 },
1460         },
1461         paramtype = "light",
1462         paramtype2 = "flowingliquid",
1463         light_source = default.LIGHT_MAX - 1,
1464         walkable = false,
1465         pointable = false,
1466         diggable = false,
1467         buildable_to = true,
1468         is_ground_content = false,
1469         drop = "",
1470         drowning = 1,
1471         liquidtype = "flowing",
1472         liquid_alternative_flowing = "default:lava_flowing",
1473         liquid_alternative_source = "default:lava_source",
1474         liquid_viscosity = 7,
1475         liquid_renewable = false,
1476         damage_per_second = 4 * 2,
1477         post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1478         groups = {lava = 3, liquid = 2, igniter = 1,
1479                 not_in_creative_inventory = 1},
1480 })
1481
1482 --
1483 -- Tools / "Advanced" crafting / Non-"natural"
1484 --
1485
1486 minetest.register_node("default:torch", {
1487         description = "Torch",
1488         drawtype = "torchlike",
1489         tiles = {
1490                 {
1491                         name = "default_torch_on_floor_animated.png",
1492                         animation = {
1493                                 type = "vertical_frames",
1494                                 aspect_w = 16,
1495                                 aspect_h = 16,
1496                                 length = 3.0
1497                         },
1498                 },
1499                 {
1500                         name="default_torch_on_ceiling_animated.png",
1501                         animation = {
1502                                 type = "vertical_frames",
1503                                 aspect_w = 16,
1504                                 aspect_h = 16,
1505                                 length = 3.0
1506                         },
1507                 },
1508                 {
1509                         name="default_torch_animated.png",
1510                         animation = {
1511                                 type = "vertical_frames",
1512                                 aspect_w = 16,
1513                                 aspect_h = 16,
1514                                 length = 3.0
1515                         },
1516                 },
1517         },
1518         inventory_image = "default_torch_on_floor.png",
1519         wield_image = "default_torch_on_floor.png",
1520         paramtype = "light",
1521         paramtype2 = "wallmounted",
1522         sunlight_propagates = true,
1523         is_ground_content = false,
1524         walkable = false,
1525         light_source = default.LIGHT_MAX - 1,
1526         selection_box = {
1527                 type = "wallmounted",
1528                 wall_top = {-0.1, 0.5 - 0.6, -0.1, 0.1, 0.5, 0.1},
1529                 wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5 + 0.6, 0.1},
1530                 wall_side = {-0.5, -0.3, -0.1, -0.5 + 0.3, 0.3, 0.1},
1531         },
1532         groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1},
1533         legacy_wallmounted = true,
1534         sounds = default.node_sound_defaults(),
1535 })
1536
1537
1538 local chest_formspec =
1539         "size[8,9]" ..
1540         default.gui_bg ..
1541         default.gui_bg_img ..
1542         default.gui_slots ..
1543         "list[current_name;main;0,0.3;8,4;]" ..
1544         "list[current_player;main;0,4.85;8,1;]" ..
1545         "list[current_player;main;0,6.08;8,3;8]" ..
1546         "listring[current_name;main]" ..
1547         "listring[current_player;main]" ..
1548         default.get_hotbar_bg(0,4.85)
1549
1550 local function get_locked_chest_formspec(pos)
1551         local spos = pos.x .. "," .. pos.y .. "," .. pos.z
1552         local formspec =
1553                 "size[8,9]" ..
1554                 default.gui_bg ..
1555                 default.gui_bg_img ..
1556                 default.gui_slots ..
1557                 "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
1558                 "list[current_player;main;0,4.85;8,1;]" ..
1559                 "list[current_player;main;0,6.08;8,3;8]" ..
1560                 "listring[nodemeta:" .. spos .. ";main]" ..
1561                 "listring[current_player;main]" ..
1562                 default.get_hotbar_bg(0,4.85)
1563  return formspec
1564 end
1565
1566 local function has_locked_chest_privilege(meta, player)
1567         local name = ""
1568         if player then
1569                 if minetest.check_player_privs(player, "protection_bypass") then
1570                         return true
1571                 end
1572                 name = player:get_player_name()
1573         end
1574         if name ~= meta:get_string("owner") then
1575                 return false
1576         end
1577         return true
1578 end
1579
1580 minetest.register_node("default:chest", {
1581         description = "Chest",
1582         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
1583                 "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
1584         paramtype2 = "facedir",
1585         groups = {choppy = 2, oddly_breakable_by_hand = 2},
1586         legacy_facedir_simple = true,
1587         is_ground_content = false,
1588         sounds = default.node_sound_wood_defaults(),
1589
1590         on_construct = function(pos)
1591                 local meta = minetest.get_meta(pos)
1592                 meta:set_string("formspec", chest_formspec)
1593                 local inv = meta:get_inventory()
1594                 inv:set_size("main", 8*4)
1595         end,
1596         can_dig = function(pos,player)
1597                 local meta = minetest.get_meta(pos);
1598                 local inv = meta:get_inventory()
1599                 return inv:is_empty("main")
1600         end,
1601         on_metadata_inventory_move = function(pos, from_list, from_index,
1602                         to_list, to_index, count, player)
1603                 minetest.log("action", player:get_player_name() ..
1604                         " moves stuff in chest at " .. minetest.pos_to_string(pos))
1605         end,
1606     on_metadata_inventory_put = function(pos, listname, index, stack, player)
1607                 minetest.log("action", player:get_player_name() ..
1608                         " moves " .. stack:get_name() ..
1609                         " to chest at " .. minetest.pos_to_string(pos))
1610         end,
1611     on_metadata_inventory_take = function(pos, listname, index, stack, player)
1612                 minetest.log("action", player:get_player_name() ..
1613                         " takes " .. stack:get_name() ..
1614                         " from chest at " .. minetest.pos_to_string(pos))
1615         end,
1616         on_blast = function(pos)
1617                 local drops = {}
1618                 default.get_inventory_drops(pos, "main", drops)
1619                 drops[#drops+1] = "default:chest"
1620                 minetest.remove_node(pos)
1621                 return drops
1622         end,
1623 })
1624
1625 minetest.register_node("default:chest_locked", {
1626         description = "Locked Chest",
1627         tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
1628                 "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
1629         paramtype2 = "facedir",
1630         groups = {choppy = 2, oddly_breakable_by_hand = 2},
1631         legacy_facedir_simple = true,
1632         is_ground_content = false,
1633         sounds = default.node_sound_wood_defaults(),
1634
1635         after_place_node = function(pos, placer)
1636                 local meta = minetest.get_meta(pos)
1637                 meta:set_string("owner", placer:get_player_name() or "")
1638                 meta:set_string("infotext", "Locked Chest (owned by " ..
1639                                 meta:get_string("owner") .. ")")
1640         end,
1641         on_construct = function(pos)
1642                 local meta = minetest.get_meta(pos)
1643                 meta:set_string("owner", "")
1644                 local inv = meta:get_inventory()
1645                 inv:set_size("main", 8 * 4)
1646         end,
1647         can_dig = function(pos,player)
1648                 local meta = minetest.get_meta(pos);
1649                 local inv = meta:get_inventory()
1650                 return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
1651         end,
1652         allow_metadata_inventory_move = function(pos, from_list, from_index,
1653                         to_list, to_index, count, player)
1654                 local meta = minetest.get_meta(pos)
1655                 if not has_locked_chest_privilege(meta, player) then
1656                         return 0
1657                 end
1658                 return count
1659         end,
1660     allow_metadata_inventory_put = function(pos, listname, index, stack, player)
1661                 local meta = minetest.get_meta(pos)
1662                 if not has_locked_chest_privilege(meta, player) then
1663                         return 0
1664                 end
1665                 return stack:get_count()
1666         end,
1667     allow_metadata_inventory_take = function(pos, listname, index, stack, player)
1668                 local meta = minetest.get_meta(pos)
1669                 if not has_locked_chest_privilege(meta, player) then
1670                         return 0
1671                 end
1672                 return stack:get_count()
1673         end,
1674     on_metadata_inventory_put = function(pos, listname, index, stack, player)
1675                 minetest.log("action", player:get_player_name() ..
1676                         " moves " .. stack:get_name() ..
1677                         " to locked chest at " .. minetest.pos_to_string(pos))
1678         end,
1679     on_metadata_inventory_take = function(pos, listname, index, stack, player)
1680                 minetest.log("action", player:get_player_name() ..
1681                         " takes " .. stack:get_name()  ..
1682                         " from locked chest at " .. minetest.pos_to_string(pos))
1683         end,
1684         on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
1685                 local meta = minetest.get_meta(pos)
1686                 if has_locked_chest_privilege(meta, clicker) then
1687                         minetest.show_formspec(
1688                                 clicker:get_player_name(),
1689                                 "default:chest_locked",
1690                                 get_locked_chest_formspec(pos)
1691                         )
1692                 end
1693                 return itemstack
1694         end,
1695         on_blast = function() end,
1696 })
1697
1698
1699 local bookshelf_formspec =
1700         "size[8,7;]" ..
1701         default.gui_bg ..
1702         default.gui_bg_img ..
1703         default.gui_slots ..
1704         "list[context;books;0,0.3;8,2;]" ..
1705         "list[current_player;main;0,2.85;8,1;]" ..
1706         "list[current_player;main;0,4.08;8,3;8]" ..
1707         "listring[context;books]" ..
1708         "listring[current_player;main]" ..
1709         default.get_hotbar_bg(0,2.85)
1710
1711 minetest.register_node("default:bookshelf", {
1712         description = "Bookshelf",
1713         tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
1714                 "default_wood.png", "default_bookshelf.png", "default_bookshelf.png"},
1715         paramtype2 = "facedir",
1716         is_ground_content = false,
1717         groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
1718         sounds = default.node_sound_wood_defaults(),
1719
1720         on_construct = function(pos)
1721                 local meta = minetest.get_meta(pos)
1722                 meta:set_string("formspec", bookshelf_formspec)
1723                 local inv = meta:get_inventory()
1724                 inv:set_size("books", 8 * 2)
1725         end,
1726         can_dig = function(pos,player)
1727                 local inv = minetest.get_meta(pos):get_inventory()
1728                 return inv:is_empty("books")
1729         end,
1730         allow_metadata_inventory_put = function(pos, listname, index, stack)
1731                 if minetest.get_item_group(stack:get_name(), "book") ~= 0 then
1732                         return stack:get_count()
1733                 end
1734                 return 0
1735         end,
1736         on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
1737                 minetest.log("action", player:get_player_name() ..
1738                         " moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
1739         end,
1740         on_metadata_inventory_put = function(pos, listname, index, stack, player)
1741                 minetest.log("action", player:get_player_name() ..
1742                         " moves stuff to bookshelf at " .. minetest.pos_to_string(pos))
1743         end,
1744         on_metadata_inventory_take = function(pos, listname, index, stack, player)
1745                 minetest.log("action", player:get_player_name() ..
1746                         " takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
1747         end,
1748         on_blast = function(pos)
1749                 local drops = {}
1750                 default.get_inventory_drops(pos, "books", drops)
1751                 drops[#drops+1] = "default:bookshelf"
1752                 minetest.remove_node(pos)
1753                 return drops
1754         end,
1755 })
1756
1757 local function register_sign(material, desc, def)
1758         minetest.register_node("default:sign_wall_" .. material, {
1759                 description = desc .. " Sign",
1760                 drawtype = "nodebox",
1761                 tiles = {"default_sign_wall_" .. material .. ".png"},
1762                 inventory_image = "default_sign_" .. material .. ".png",
1763                 wield_image = "default_sign_" .. material .. ".png",
1764                 paramtype = "light",
1765                 paramtype2 = "wallmounted",
1766                 sunlight_propagates = true,
1767                 is_ground_content = false,
1768                 walkable = false,
1769                 node_box = {
1770                         type = "wallmounted",
1771                         wall_top    = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
1772                         wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
1773                         wall_side   = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
1774                 },
1775                 groups = def.groups,
1776                 legacy_wallmounted = true,
1777                 sounds = def.sounds,
1778
1779                 on_construct = function(pos)
1780                         --local n = minetest.get_node(pos)
1781                         local meta = minetest.get_meta(pos)
1782                         meta:set_string("formspec", "field[text;;${text}]")
1783                 end,
1784                 on_receive_fields = function(pos, formname, fields, sender)
1785                         --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
1786                         local player_name = sender:get_player_name()
1787                         if minetest.is_protected(pos, player_name) then
1788                                 minetest.record_protection_violation(pos, player_name)
1789                                 return
1790                         end
1791                         local meta = minetest.get_meta(pos)
1792                         if not fields.text then return end
1793                         minetest.log("action", (player_name or "") .. " wrote \"" ..
1794                                 fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
1795                         meta:set_string("text", fields.text)
1796                         meta:set_string("infotext", '"' .. fields.text .. '"')
1797                 end,
1798         })
1799 end
1800
1801 register_sign("wood", "Wooden", {
1802         sounds = default.node_sound_wood_defaults(),
1803         groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
1804 })
1805
1806 register_sign("steel", "Steel", {
1807         sounds = default.node_sound_defaults(),
1808         groups = {cracky = 2, attached_node = 1}
1809 })
1810
1811 minetest.register_node("default:ladder_wood", {
1812         description = "Wooden Ladder",
1813         drawtype = "signlike",
1814         tiles = {"default_ladder_wood.png"},
1815         inventory_image = "default_ladder_wood.png",
1816         wield_image = "default_ladder_wood.png",
1817         paramtype = "light",
1818         paramtype2 = "wallmounted",
1819         sunlight_propagates = true,
1820         walkable = false,
1821         climbable = true,
1822         is_ground_content = false,
1823         selection_box = {
1824                 type = "wallmounted",
1825                 --wall_top = = <default>
1826                 --wall_bottom = = <default>
1827                 --wall_side = = <default>
1828         },
1829         groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2},
1830         legacy_wallmounted = true,
1831         sounds = default.node_sound_wood_defaults(),
1832 })
1833
1834 minetest.register_node("default:ladder_steel", {
1835         description = "Steel Ladder",
1836         drawtype = "signlike",
1837         tiles = {"default_ladder_steel.png"},
1838         inventory_image = "default_ladder_steel.png",
1839         wield_image = "default_ladder_steel.png",
1840         paramtype = "light",
1841         paramtype2 = "wallmounted",
1842         sunlight_propagates = true,
1843         walkable = false,
1844         climbable = true,
1845         is_ground_content = false,
1846         selection_box = {
1847                 type = "wallmounted",
1848                 --wall_top = = <default>
1849                 --wall_bottom = = <default>
1850                 --wall_side = = <default>
1851         },
1852         groups = {cracky = 2},
1853         sounds = default.node_sound_stone_defaults(),
1854 })
1855
1856 default.register_fence("default:fence_wood", {
1857         description = "Wooden Fence",
1858         texture = "default_fence_wood.png",
1859         material = "default:wood",
1860         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
1861         sounds = default.node_sound_wood_defaults()
1862 })
1863
1864 default.register_fence("default:fence_acacia_wood", {
1865         description = "Acacia Fence",
1866         texture = "default_fence_acacia_wood.png",
1867         material = "default:acacia_wood",
1868         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
1869         sounds = default.node_sound_wood_defaults()
1870 })
1871
1872 default.register_fence("default:fence_junglewood", {
1873         description = "Junglewood Fence",
1874         texture = "default_fence_junglewood.png",
1875         material = "default:junglewood",
1876         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
1877         sounds = default.node_sound_wood_defaults()
1878 })
1879
1880 default.register_fence("default:fence_pine_wood", {
1881         description = "Pine Fence",
1882         texture = "default_fence_pine_wood.png",
1883         material = "default:pine_wood",
1884         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
1885         sounds = default.node_sound_wood_defaults()
1886 })
1887
1888 default.register_fence("default:fence_aspen_wood", {
1889         description = "Aspen Fence",
1890         texture = "default_fence_aspen_wood.png",
1891         material = "default:aspen_wood",
1892         groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
1893         sounds = default.node_sound_wood_defaults()
1894 })
1895
1896 minetest.register_node("default:glass", {
1897         description = "Glass",
1898         drawtype = "glasslike_framed_optional",
1899         tiles = {"default_glass.png", "default_glass_detail.png"},
1900         paramtype = "light",
1901         sunlight_propagates = true,
1902         is_ground_content = false,
1903         groups = {cracky = 3, oddly_breakable_by_hand = 3},
1904         sounds = default.node_sound_glass_defaults(),
1905 })
1906
1907 minetest.register_node("default:obsidian_glass", {
1908         description = "Obsidian Glass",
1909         drawtype = "glasslike_framed_optional",
1910         tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
1911         paramtype = "light",
1912         is_ground_content = false,
1913         sunlight_propagates = true,
1914         sounds = default.node_sound_glass_defaults(),
1915         groups = {cracky = 3},
1916 })
1917
1918
1919 minetest.register_node("default:rail", {
1920         description = "Rail",
1921         drawtype = "raillike",
1922         tiles = {"default_rail.png", "default_rail_curved.png",
1923                 "default_rail_t_junction.png", "default_rail_crossing.png"},
1924         inventory_image = "default_rail.png",
1925         wield_image = "default_rail.png",
1926         paramtype = "light",
1927         sunlight_propagates = true,
1928         walkable = false,
1929         is_ground_content = false,
1930         selection_box = {
1931                 type = "fixed",
1932                 -- but how to specify the dimensions for curved and sideways rails?
1933                 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
1934         },
1935         groups = {dig_immediate = 2, attached_node = 1,
1936                 connect_to_raillike = minetest.raillike_group("rail")},
1937 })
1938
1939
1940 minetest.register_node("default:brick", {
1941         description = "Brick Block",
1942         paramtype2 = "facedir",
1943         place_param2 = 0,
1944         tiles = {"default_brick.png"},
1945         is_ground_content = false,
1946         groups = {cracky = 3},
1947         sounds = default.node_sound_stone_defaults(),
1948 })
1949
1950
1951 minetest.register_node("default:meselamp", {
1952         description = "Mese Lamp",
1953         drawtype = "glasslike",
1954         tiles = {"default_meselamp.png"},
1955         paramtype = "light",
1956         sunlight_propagates = true,
1957         is_ground_content = false,
1958         groups = {cracky = 3, oddly_breakable_by_hand = 3},
1959         sounds = default.node_sound_glass_defaults(),
1960         light_source = default.LIGHT_MAX,
1961 })
1962
1963 --
1964 -- Misc
1965 --
1966
1967 minetest.register_node("default:cloud", {
1968         description = "Cloud",
1969         tiles = {"default_cloud.png"},
1970         is_ground_content = false,
1971         sounds = default.node_sound_defaults(),
1972         groups = {not_in_creative_inventory = 1},
1973 })