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