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