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