1 -- mods/default/nodes.lua
4 --[[ Node name convention:
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.
17 (1. Material 2. Cobble variant 3. Brick variant 4. Modified forms)
27 default:desert_stonebrick
28 default:desert_stone_block
31 default:sandstonebrick
32 default:sandstone_block
33 default:desert_sandstone
34 default:desert_sandstone_brick
35 default:desert_sandstone_block
36 default:silver_sandstone
37 default:silver_sandstone_brick
38 default:silver_sandstone_block
42 default:obsidian_block
46 (1. Material 2. Modified forms)
49 default:dirt_with_grass
50 default:dirt_with_grass_footsteps
51 default:dirt_with_dry_grass
52 default:dirt_with_snow
53 default:dirt_with_rainforest_litter
70 (1. Trunk 2. Fabricated trunk 3. Leaves 4. Sapling 5. Fruits)
91 default:acacia_sapling
100 (1. In stone 2. Blocks)
102 default:stone_with_coal
105 default:stone_with_iron
108 default:stone_with_copper
111 default:stone_with_tin
116 default:stone_with_gold
119 default:stone_with_mese
122 default:stone_with_diamond
148 default:acacia_bush_stem
149 default:acacia_bush_leaves
150 default:acacia_bush_sapling
157 default:coral_skeleton
161 (1. Source 2. Flowing)
164 default:water_flowing
166 default:river_water_source
167 default:river_water_flowing
172 Tools / "Advanced" crafting / Non-"natural"
173 -------------------------------------------
180 default:sign_wall_wood
181 default:sign_wall_steel
187 default:fence_acacia_wood
188 default:fence_junglewood
189 default:fence_pine_wood
190 default:fence_aspen_wood
193 default:obsidian_glass
198 default:mese_post_light
211 minetest.register_node("default:stone", {
212 description = "Stone",
213 tiles = {"default_stone.png"},
214 groups = {cracky = 3, stone = 1},
215 drop = 'default:cobble',
216 legacy_mineral = true,
217 sounds = default.node_sound_stone_defaults(),
220 minetest.register_node("default:cobble", {
221 description = "Cobblestone",
222 tiles = {"default_cobble.png"},
223 is_ground_content = false,
224 groups = {cracky = 3, stone = 2},
225 sounds = default.node_sound_stone_defaults(),
228 minetest.register_node("default:stonebrick", {
229 description = "Stone Brick",
230 paramtype2 = "facedir",
232 tiles = {"default_stone_brick.png"},
233 is_ground_content = false,
234 groups = {cracky = 2, stone = 1},
235 sounds = default.node_sound_stone_defaults(),
238 minetest.register_node("default:stone_block", {
239 description = "Stone Block",
240 tiles = {"default_stone_block.png"},
241 is_ground_content = false,
242 groups = {cracky = 2, stone = 1},
243 sounds = default.node_sound_stone_defaults(),
246 minetest.register_node("default:mossycobble", {
247 description = "Mossy Cobblestone",
248 tiles = {"default_mossycobble.png"},
249 is_ground_content = false,
250 groups = {cracky = 3, stone = 1},
251 sounds = default.node_sound_stone_defaults(),
255 minetest.register_node("default:desert_stone", {
256 description = "Desert Stone",
257 tiles = {"default_desert_stone.png"},
258 groups = {cracky = 3, stone = 1},
259 drop = 'default:desert_cobble',
260 legacy_mineral = true,
261 sounds = default.node_sound_stone_defaults(),
264 minetest.register_node("default:desert_cobble", {
265 description = "Desert Cobblestone",
266 tiles = {"default_desert_cobble.png"},
267 is_ground_content = false,
268 groups = {cracky = 3, stone = 2},
269 sounds = default.node_sound_stone_defaults(),
272 minetest.register_node("default:desert_stonebrick", {
273 description = "Desert Stone Brick",
274 paramtype2 = "facedir",
276 tiles = {"default_desert_stone_brick.png"},
277 is_ground_content = false,
278 groups = {cracky = 2, stone = 1},
279 sounds = default.node_sound_stone_defaults(),
282 minetest.register_node("default:desert_stone_block", {
283 description = "Desert Stone Block",
284 tiles = {"default_desert_stone_block.png"},
285 is_ground_content = false,
286 groups = {cracky = 2, stone = 1},
287 sounds = default.node_sound_stone_defaults(),
290 minetest.register_node("default:sandstone", {
291 description = "Sandstone",
292 tiles = {"default_sandstone.png"},
293 groups = {crumbly = 1, cracky = 3},
294 sounds = default.node_sound_stone_defaults(),
297 minetest.register_node("default:sandstonebrick", {
298 description = "Sandstone Brick",
299 paramtype2 = "facedir",
301 tiles = {"default_sandstone_brick.png"},
302 is_ground_content = false,
303 groups = {cracky = 2},
304 sounds = default.node_sound_stone_defaults(),
307 minetest.register_node("default:sandstone_block", {
308 description = "Sandstone Block",
309 tiles = {"default_sandstone_block.png"},
310 is_ground_content = false,
311 groups = {cracky = 2},
312 sounds = default.node_sound_stone_defaults(),
315 minetest.register_node("default:desert_sandstone", {
316 description = "Desert Sandstone",
317 tiles = {"default_desert_sandstone.png"},
318 groups = {crumbly = 1, cracky = 3},
319 sounds = default.node_sound_stone_defaults(),
322 minetest.register_node("default:desert_sandstone_brick", {
323 description = "Desert Sandstone Brick",
324 paramtype2 = "facedir",
326 tiles = {"default_desert_sandstone_brick.png"},
327 is_ground_content = false,
328 groups = {cracky = 2},
329 sounds = default.node_sound_stone_defaults(),
332 minetest.register_node("default:desert_sandstone_block", {
333 description = "Desert Sandstone Block",
334 tiles = {"default_desert_sandstone_block.png"},
335 is_ground_content = false,
336 groups = {cracky = 2},
337 sounds = default.node_sound_stone_defaults(),
340 minetest.register_node("default:silver_sandstone", {
341 description = "Silver Sandstone",
342 tiles = {"default_silver_sandstone.png"},
343 groups = {crumbly = 1, cracky = 3},
344 sounds = default.node_sound_stone_defaults(),
347 minetest.register_node("default:silver_sandstone_brick", {
348 description = "Silver Sandstone Brick",
349 paramtype2 = "facedir",
351 tiles = {"default_silver_sandstone_brick.png"},
352 is_ground_content = false,
353 groups = {cracky = 2},
354 sounds = default.node_sound_stone_defaults(),
357 minetest.register_node("default:silver_sandstone_block", {
358 description = "Silver Sandstone Block",
359 tiles = {"default_silver_sandstone_block.png"},
360 is_ground_content = false,
361 groups = {cracky = 2},
362 sounds = default.node_sound_stone_defaults(),
365 minetest.register_node("default:obsidian", {
366 description = "Obsidian",
367 tiles = {"default_obsidian.png"},
368 sounds = default.node_sound_stone_defaults(),
369 groups = {cracky = 1, level = 2},
372 minetest.register_node("default:obsidianbrick", {
373 description = "Obsidian Brick",
374 paramtype2 = "facedir",
376 tiles = {"default_obsidian_brick.png"},
377 is_ground_content = false,
378 sounds = default.node_sound_stone_defaults(),
379 groups = {cracky = 1, level = 2},
382 minetest.register_node("default:obsidian_block", {
383 description = "Obsidian Block",
384 tiles = {"default_obsidian_block.png"},
385 is_ground_content = false,
386 sounds = default.node_sound_stone_defaults(),
387 groups = {cracky = 1, level = 2},
394 minetest.register_node("default:dirt", {
395 description = "Dirt",
396 tiles = {"default_dirt.png"},
397 groups = {crumbly = 3, soil = 1},
398 sounds = default.node_sound_dirt_defaults(),
401 minetest.register_node("default:dirt_with_grass", {
402 description = "Dirt with Grass",
403 tiles = {"default_grass.png", "default_dirt.png",
404 {name = "default_dirt.png^default_grass_side.png",
405 tileable_vertical = false}},
406 groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
407 drop = 'default:dirt',
408 sounds = default.node_sound_dirt_defaults({
409 footstep = {name = "default_grass_footstep", gain = 0.25},
413 minetest.register_node("default:dirt_with_grass_footsteps", {
414 description = "Dirt with Grass and Footsteps",
415 tiles = {"default_grass.png^default_footprint.png", "default_dirt.png",
416 {name = "default_dirt.png^default_grass_side.png",
417 tileable_vertical = false}},
418 groups = {crumbly = 3, soil = 1, not_in_creative_inventory = 1},
419 drop = 'default:dirt',
420 sounds = default.node_sound_dirt_defaults({
421 footstep = {name = "default_grass_footstep", gain = 0.25},
425 minetest.register_node("default:dirt_with_dry_grass", {
426 description = "Dirt with Dry Grass",
427 tiles = {"default_dry_grass.png",
429 {name = "default_dirt.png^default_dry_grass_side.png",
430 tileable_vertical = false}},
431 groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
432 drop = 'default:dirt',
433 sounds = default.node_sound_dirt_defaults({
434 footstep = {name = "default_grass_footstep", gain = 0.4},
438 minetest.register_node("default:dirt_with_snow", {
439 description = "Dirt with Snow",
440 tiles = {"default_snow.png", "default_dirt.png",
441 {name = "default_dirt.png^default_snow_side.png",
442 tileable_vertical = false}},
443 groups = {crumbly = 3, spreading_dirt_type = 1, snowy = 1},
444 drop = 'default:dirt',
445 sounds = default.node_sound_dirt_defaults({
446 footstep = {name = "default_snow_footstep", gain = 0.15},
450 minetest.register_node("default:dirt_with_rainforest_litter", {
451 description = "Dirt with Rainforest Litter",
453 "default_rainforest_litter.png",
455 {name = "default_dirt.png^default_rainforest_litter_side.png",
456 tileable_vertical = false}
458 groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
459 drop = "default:dirt",
460 sounds = default.node_sound_dirt_defaults({
461 footstep = {name = "default_grass_footstep", gain = 0.4},
465 minetest.register_node("default:sand", {
466 description = "Sand",
467 tiles = {"default_sand.png"},
468 groups = {crumbly = 3, falling_node = 1, sand = 1},
469 sounds = default.node_sound_sand_defaults(),
472 minetest.register_node("default:desert_sand", {
473 description = "Desert Sand",
474 tiles = {"default_desert_sand.png"},
475 groups = {crumbly = 3, falling_node = 1, sand = 1},
476 sounds = default.node_sound_sand_defaults(),
479 minetest.register_node("default:silver_sand", {
480 description = "Silver Sand",
481 tiles = {"default_silver_sand.png"},
482 groups = {crumbly = 3, falling_node = 1, sand = 1},
483 sounds = default.node_sound_sand_defaults(),
487 minetest.register_node("default:gravel", {
488 description = "Gravel",
489 tiles = {"default_gravel.png"},
490 groups = {crumbly = 2, falling_node = 1},
491 sounds = default.node_sound_gravel_defaults(),
495 {items = {'default:flint'}, rarity = 16},
496 {items = {'default:gravel'}}
501 minetest.register_node("default:clay", {
502 description = "Clay",
503 tiles = {"default_clay.png"},
504 groups = {crumbly = 3},
505 drop = 'default:clay_lump 4',
506 sounds = default.node_sound_dirt_defaults(),
510 minetest.register_node("default:snow", {
511 description = "Snow",
512 tiles = {"default_snow.png"},
513 inventory_image = "default_snowball.png",
514 wield_image = "default_snowball.png",
518 drawtype = "nodebox",
522 {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
525 groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 1},
526 sounds = default.node_sound_dirt_defaults({
527 footstep = {name = "default_snow_footstep", gain = 0.15},
528 dug = {name = "default_snow_footstep", gain = 0.2},
529 dig = {name = "default_snow_footstep", gain = 0.2}
532 on_construct = function(pos)
534 if minetest.get_node(pos).name == "default:dirt_with_grass" then
535 minetest.set_node(pos, {name = "default:dirt_with_snow"})
540 minetest.register_node("default:snowblock", {
541 description = "Snow Block",
542 tiles = {"default_snow.png"},
543 groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
544 sounds = default.node_sound_dirt_defaults({
545 footstep = {name = "default_snow_footstep", gain = 0.15},
546 dug = {name = "default_snow_footstep", gain = 0.2},
547 dig = {name = "default_snow_footstep", gain = 0.2}
550 on_construct = function(pos)
552 if minetest.get_node(pos).name == "default:dirt_with_grass" then
553 minetest.set_node(pos, {name = "default:dirt_with_snow"})
558 minetest.register_node("default:ice", {
560 tiles = {"default_ice.png"},
561 is_ground_content = false,
563 groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1},
564 sounds = default.node_sound_glass_defaults(),
571 minetest.register_node("default:tree", {
572 description = "Tree",
573 tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
574 paramtype2 = "facedir",
575 is_ground_content = false,
576 groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
577 sounds = default.node_sound_wood_defaults(),
579 on_place = minetest.rotate_node
582 minetest.register_node("default:wood", {
583 description = "Wooden Planks",
584 paramtype2 = "facedir",
586 tiles = {"default_wood.png"},
587 is_ground_content = false,
588 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
589 sounds = default.node_sound_wood_defaults(),
592 minetest.register_node("default:sapling", {
593 description = "Sapling",
594 drawtype = "plantlike",
595 tiles = {"default_sapling.png"},
596 inventory_image = "default_sapling.png",
597 wield_image = "default_sapling.png",
599 sunlight_propagates = true,
601 on_timer = default.grow_sapling,
604 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
606 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
607 attached_node = 1, sapling = 1},
608 sounds = default.node_sound_leaves_defaults(),
610 on_construct = function(pos)
611 minetest.get_node_timer(pos):start(math.random(2400,4800))
614 on_place = function(itemstack, placer, pointed_thing)
615 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
617 -- minp, maxp to be checked, relative to sapling pos
618 -- minp_relative.y = 1 because sapling pos has been checked
619 {x = -2, y = 1, z = -2},
620 {x = 2, y = 6, z = 2},
621 -- maximum interval of interior volume check
628 minetest.register_node("default:leaves", {
629 description = "Leaves",
630 drawtype = "allfaces_optional",
632 tiles = {"default_leaves.png"},
633 special_tiles = {"default_leaves_simple.png"},
635 is_ground_content = false,
636 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
641 -- player will get sapling with 1/20 chance
642 items = {'default:sapling'},
646 -- player will get leaves only if he get no saplings,
647 -- this is because max_items is 1
648 items = {'default:leaves'},
652 sounds = default.node_sound_leaves_defaults(),
654 after_place_node = default.after_place_leaves,
657 minetest.register_node("default:apple", {
658 description = "Apple",
659 drawtype = "plantlike",
660 tiles = {"default_apple.png"},
661 inventory_image = "default_apple.png",
663 sunlight_propagates = true,
665 is_ground_content = false,
668 fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16}
670 groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
671 leafdecay = 3, leafdecay_drop = 1},
672 on_use = minetest.item_eat(2),
673 sounds = default.node_sound_leaves_defaults(),
675 after_place_node = function(pos, placer, itemstack)
676 if placer:is_player() then
677 minetest.set_node(pos, {name = "default:apple", param2 = 1})
683 minetest.register_node("default:jungletree", {
684 description = "Jungle Tree",
685 tiles = {"default_jungletree_top.png", "default_jungletree_top.png",
686 "default_jungletree.png"},
687 paramtype2 = "facedir",
688 is_ground_content = false,
689 groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
690 sounds = default.node_sound_wood_defaults(),
692 on_place = minetest.rotate_node
695 minetest.register_node("default:junglewood", {
696 description = "Junglewood Planks",
697 paramtype2 = "facedir",
699 tiles = {"default_junglewood.png"},
700 is_ground_content = false,
701 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
702 sounds = default.node_sound_wood_defaults(),
705 minetest.register_node("default:jungleleaves", {
706 description = "Jungle Leaves",
707 drawtype = "allfaces_optional",
709 tiles = {"default_jungleleaves.png"},
710 special_tiles = {"default_jungleleaves_simple.png"},
712 is_ground_content = false,
713 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
717 {items = {'default:junglesapling'}, rarity = 20},
718 {items = {'default:jungleleaves'}}
721 sounds = default.node_sound_leaves_defaults(),
723 after_place_node = default.after_place_leaves,
726 minetest.register_node("default:junglesapling", {
727 description = "Jungle Sapling",
728 drawtype = "plantlike",
729 tiles = {"default_junglesapling.png"},
730 inventory_image = "default_junglesapling.png",
731 wield_image = "default_junglesapling.png",
733 sunlight_propagates = true,
735 on_timer = default.grow_sapling,
738 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
740 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
741 attached_node = 1, sapling = 1},
742 sounds = default.node_sound_leaves_defaults(),
744 on_construct = function(pos)
745 minetest.get_node_timer(pos):start(math.random(2400,4800))
748 on_place = function(itemstack, placer, pointed_thing)
749 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
750 "default:junglesapling",
751 -- minp, maxp to be checked, relative to sapling pos
752 -- minp_relative.y = 1 because sapling pos has been checked
753 {x = -2, y = 1, z = -2},
754 {x = 2, y = 15, z = 2},
755 -- maximum interval of interior volume check
763 minetest.register_node("default:pine_tree", {
764 description = "Pine Tree",
765 tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png",
766 "default_pine_tree.png"},
767 paramtype2 = "facedir",
768 is_ground_content = false,
769 groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
770 sounds = default.node_sound_wood_defaults(),
772 on_place = minetest.rotate_node
775 minetest.register_node("default:pine_wood", {
776 description = "Pine Wood Planks",
777 paramtype2 = "facedir",
779 tiles = {"default_pine_wood.png"},
780 is_ground_content = false,
781 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
782 sounds = default.node_sound_wood_defaults(),
785 minetest.register_node("default:pine_needles",{
786 description = "Pine Needles",
787 drawtype = "allfaces_optional",
788 tiles = {"default_pine_needles.png"},
791 is_ground_content = false,
792 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
796 {items = {"default:pine_sapling"}, rarity = 20},
797 {items = {"default:pine_needles"}}
800 sounds = default.node_sound_leaves_defaults(),
802 after_place_node = default.after_place_leaves,
805 minetest.register_node("default:pine_sapling", {
806 description = "Pine Sapling",
807 drawtype = "plantlike",
808 tiles = {"default_pine_sapling.png"},
809 inventory_image = "default_pine_sapling.png",
810 wield_image = "default_pine_sapling.png",
812 sunlight_propagates = true,
814 on_timer = default.grow_sapling,
817 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
819 groups = {snappy = 2, dig_immediate = 3, flammable = 3,
820 attached_node = 1, sapling = 1},
821 sounds = default.node_sound_leaves_defaults(),
823 on_construct = function(pos)
824 minetest.get_node_timer(pos):start(math.random(2400,4800))
827 on_place = function(itemstack, placer, pointed_thing)
828 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
829 "default:pine_sapling",
830 -- minp, maxp to be checked, relative to sapling pos
831 -- minp_relative.y = 1 because sapling pos has been checked
832 {x = -2, y = 1, z = -2},
833 {x = 2, y = 12, z = 2},
834 -- maximum interval of interior volume check
842 minetest.register_node("default:acacia_tree", {
843 description = "Acacia Tree",
844 tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png",
845 "default_acacia_tree.png"},
846 paramtype2 = "facedir",
847 is_ground_content = false,
848 groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
849 sounds = default.node_sound_wood_defaults(),
851 on_place = minetest.rotate_node
854 minetest.register_node("default:acacia_wood", {
855 description = "Acacia Wood Planks",
856 paramtype2 = "facedir",
858 tiles = {"default_acacia_wood.png"},
859 is_ground_content = false,
860 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
861 sounds = default.node_sound_wood_defaults(),
864 minetest.register_node("default:acacia_leaves", {
865 description = "Acacia Leaves",
866 drawtype = "allfaces_optional",
867 tiles = {"default_acacia_leaves.png"},
868 special_tiles = {"default_acacia_leaves_simple.png"},
871 is_ground_content = false,
872 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
876 {items = {"default:acacia_sapling"}, rarity = 20},
877 {items = {"default:acacia_leaves"}}
880 sounds = default.node_sound_leaves_defaults(),
882 after_place_node = default.after_place_leaves,
885 minetest.register_node("default:acacia_sapling", {
886 description = "Acacia Tree Sapling",
887 drawtype = "plantlike",
888 tiles = {"default_acacia_sapling.png"},
889 inventory_image = "default_acacia_sapling.png",
890 wield_image = "default_acacia_sapling.png",
892 sunlight_propagates = true,
894 on_timer = default.grow_sapling,
897 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
899 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
900 attached_node = 1, sapling = 1},
901 sounds = default.node_sound_leaves_defaults(),
903 on_construct = function(pos)
904 minetest.get_node_timer(pos):start(math.random(2400,4800))
907 on_place = function(itemstack, placer, pointed_thing)
908 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
909 "default:acacia_sapling",
910 -- minp, maxp to be checked, relative to sapling pos
911 -- minp_relative.y = 1 because sapling pos has been checked
912 {x = -4, y = 1, z = -4},
913 {x = 4, y = 6, z = 4},
914 -- maximum interval of interior volume check
921 minetest.register_node("default:aspen_tree", {
922 description = "Aspen Tree",
923 tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png",
924 "default_aspen_tree.png"},
925 paramtype2 = "facedir",
926 is_ground_content = false,
927 groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
928 sounds = default.node_sound_wood_defaults(),
930 on_place = minetest.rotate_node
933 minetest.register_node("default:aspen_wood", {
934 description = "Aspen Wood Planks",
935 paramtype2 = "facedir",
937 tiles = {"default_aspen_wood.png"},
938 is_ground_content = false,
939 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
940 sounds = default.node_sound_wood_defaults(),
943 minetest.register_node("default:aspen_leaves", {
944 description = "Aspen Leaves",
945 drawtype = "allfaces_optional",
946 tiles = {"default_aspen_leaves.png"},
949 is_ground_content = false,
950 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
954 {items = {"default:aspen_sapling"}, rarity = 20},
955 {items = {"default:aspen_leaves"}}
958 sounds = default.node_sound_leaves_defaults(),
960 after_place_node = default.after_place_leaves,
963 minetest.register_node("default:aspen_sapling", {
964 description = "Aspen Tree Sapling",
965 drawtype = "plantlike",
966 tiles = {"default_aspen_sapling.png"},
967 inventory_image = "default_aspen_sapling.png",
968 wield_image = "default_aspen_sapling.png",
970 sunlight_propagates = true,
972 on_timer = default.grow_sapling,
975 fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16}
977 groups = {snappy = 2, dig_immediate = 3, flammable = 3,
978 attached_node = 1, sapling = 1},
979 sounds = default.node_sound_leaves_defaults(),
981 on_construct = function(pos)
982 minetest.get_node_timer(pos):start(math.random(2400,4800))
985 on_place = function(itemstack, placer, pointed_thing)
986 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
987 "default:aspen_sapling",
988 -- minp, maxp to be checked, relative to sapling pos
989 -- minp_relative.y = 1 because sapling pos has been checked
990 {x = -2, y = 1, z = -2},
991 {x = 2, y = 12, z = 2},
992 -- maximum interval of interior volume check
1003 minetest.register_node("default:stone_with_coal", {
1004 description = "Coal Ore",
1005 tiles = {"default_stone.png^default_mineral_coal.png"},
1006 groups = {cracky = 3},
1007 drop = 'default:coal_lump',
1008 sounds = default.node_sound_stone_defaults(),
1011 minetest.register_node("default:coalblock", {
1012 description = "Coal Block",
1013 tiles = {"default_coal_block.png"},
1014 is_ground_content = false,
1015 groups = {cracky = 3},
1016 sounds = default.node_sound_stone_defaults(),
1020 minetest.register_node("default:stone_with_iron", {
1021 description = "Iron Ore",
1022 tiles = {"default_stone.png^default_mineral_iron.png"},
1023 groups = {cracky = 2},
1024 drop = 'default:iron_lump',
1025 sounds = default.node_sound_stone_defaults(),
1028 minetest.register_node("default:steelblock", {
1029 description = "Steel Block",
1030 tiles = {"default_steel_block.png"},
1031 is_ground_content = false,
1032 groups = {cracky = 1, level = 2},
1033 sounds = default.node_sound_metal_defaults(),
1037 minetest.register_node("default:stone_with_copper", {
1038 description = "Copper Ore",
1039 tiles = {"default_stone.png^default_mineral_copper.png"},
1040 groups = {cracky = 2},
1041 drop = 'default:copper_lump',
1042 sounds = default.node_sound_stone_defaults(),
1045 minetest.register_node("default:copperblock", {
1046 description = "Copper Block",
1047 tiles = {"default_copper_block.png"},
1048 is_ground_content = false,
1049 groups = {cracky = 1, level = 2},
1050 sounds = default.node_sound_metal_defaults(),
1054 minetest.register_node("default:stone_with_tin", {
1055 description = "Tin Ore",
1056 tiles = {"default_stone.png^default_mineral_tin.png"},
1057 groups = {cracky = 2},
1058 drop = "default:tin_lump",
1059 sounds = default.node_sound_stone_defaults(),
1062 minetest.register_node("default:tinblock", {
1063 description = "Tin Block",
1064 tiles = {"default_tin_block.png"},
1065 is_ground_content = false,
1066 groups = {cracky = 1, level = 2},
1067 sounds = default.node_sound_metal_defaults(),
1071 minetest.register_node("default:bronzeblock", {
1072 description = "Bronze Block",
1073 tiles = {"default_bronze_block.png"},
1074 is_ground_content = false,
1075 groups = {cracky = 1, level = 2},
1076 sounds = default.node_sound_metal_defaults(),
1080 minetest.register_node("default:stone_with_mese", {
1081 description = "Mese Ore",
1082 tiles = {"default_stone.png^default_mineral_mese.png"},
1083 groups = {cracky = 1},
1084 drop = "default:mese_crystal",
1085 sounds = default.node_sound_stone_defaults(),
1088 minetest.register_node("default:mese", {
1089 description = "Mese Block",
1090 tiles = {"default_mese_block.png"},
1091 paramtype = "light",
1092 groups = {cracky = 1, level = 2},
1093 sounds = default.node_sound_stone_defaults(),
1098 minetest.register_node("default:stone_with_gold", {
1099 description = "Gold Ore",
1100 tiles = {"default_stone.png^default_mineral_gold.png"},
1101 groups = {cracky = 2},
1102 drop = "default:gold_lump",
1103 sounds = default.node_sound_stone_defaults(),
1106 minetest.register_node("default:goldblock", {
1107 description = "Gold Block",
1108 tiles = {"default_gold_block.png"},
1109 is_ground_content = false,
1110 groups = {cracky = 1},
1111 sounds = default.node_sound_metal_defaults(),
1115 minetest.register_node("default:stone_with_diamond", {
1116 description = "Diamond Ore",
1117 tiles = {"default_stone.png^default_mineral_diamond.png"},
1118 groups = {cracky = 1},
1119 drop = "default:diamond",
1120 sounds = default.node_sound_stone_defaults(),
1123 minetest.register_node("default:diamondblock", {
1124 description = "Diamond Block",
1125 tiles = {"default_diamond_block.png"},
1126 is_ground_content = false,
1127 groups = {cracky = 1, level = 3},
1128 sounds = default.node_sound_stone_defaults(),
1132 -- Plantlife (non-cubic)
1135 minetest.register_node("default:cactus", {
1136 description = "Cactus",
1137 tiles = {"default_cactus_top.png", "default_cactus_top.png",
1138 "default_cactus_side.png"},
1139 paramtype2 = "facedir",
1140 groups = {choppy = 3},
1141 sounds = default.node_sound_wood_defaults(),
1142 on_place = minetest.rotate_node,
1145 minetest.register_node("default:papyrus", {
1146 description = "Papyrus",
1147 drawtype = "plantlike",
1148 tiles = {"default_papyrus.png"},
1149 inventory_image = "default_papyrus.png",
1150 wield_image = "default_papyrus.png",
1151 paramtype = "light",
1152 sunlight_propagates = true,
1156 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
1158 groups = {snappy = 3, flammable = 2},
1159 sounds = default.node_sound_leaves_defaults(),
1161 after_dig_node = function(pos, node, metadata, digger)
1162 default.dig_up(pos, node, digger)
1166 minetest.register_node("default:dry_shrub", {
1167 description = "Dry Shrub",
1168 drawtype = "plantlike",
1170 tiles = {"default_dry_shrub.png"},
1171 inventory_image = "default_dry_shrub.png",
1172 wield_image = "default_dry_shrub.png",
1173 paramtype = "light",
1174 sunlight_propagates = true,
1176 buildable_to = true,
1177 groups = {snappy = 3, flammable = 3, attached_node = 1},
1178 sounds = default.node_sound_leaves_defaults(),
1181 fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16},
1185 minetest.register_node("default:junglegrass", {
1186 description = "Jungle Grass",
1187 drawtype = "plantlike",
1189 visual_scale = 1.69,
1190 tiles = {"default_junglegrass.png"},
1191 inventory_image = "default_junglegrass.png",
1192 wield_image = "default_junglegrass.png",
1193 paramtype = "light",
1194 sunlight_propagates = true,
1196 buildable_to = true,
1197 groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1},
1198 sounds = default.node_sound_leaves_defaults(),
1201 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16},
1206 minetest.register_node("default:grass_1", {
1207 description = "Grass",
1208 drawtype = "plantlike",
1210 tiles = {"default_grass_1.png"},
1211 -- Use texture of a taller grass stage in inventory
1212 inventory_image = "default_grass_3.png",
1213 wield_image = "default_grass_3.png",
1214 paramtype = "light",
1215 sunlight_propagates = true,
1217 buildable_to = true,
1218 groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1},
1219 sounds = default.node_sound_leaves_defaults(),
1222 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16},
1225 on_place = function(itemstack, placer, pointed_thing)
1226 -- place a random grass node
1227 local stack = ItemStack("default:grass_" .. math.random(1,5))
1228 local ret = minetest.item_place(stack, placer, pointed_thing)
1229 return ItemStack("default:grass_1 " ..
1230 itemstack:get_count() - (1 - ret:get_count()))
1235 minetest.register_node("default:grass_" .. i, {
1236 description = "Grass",
1237 drawtype = "plantlike",
1239 tiles = {"default_grass_" .. i .. ".png"},
1240 inventory_image = "default_grass_" .. i .. ".png",
1241 wield_image = "default_grass_" .. i .. ".png",
1242 paramtype = "light",
1243 sunlight_propagates = true,
1245 buildable_to = true,
1246 drop = "default:grass_1",
1247 groups = {snappy = 3, flora = 1, attached_node = 1,
1248 not_in_creative_inventory = 1, grass = 1, flammable = 1},
1249 sounds = default.node_sound_leaves_defaults(),
1252 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
1258 minetest.register_node("default:dry_grass_1", {
1259 description = "Dry Grass",
1260 drawtype = "plantlike",
1262 tiles = {"default_dry_grass_1.png"},
1263 inventory_image = "default_dry_grass_3.png",
1264 wield_image = "default_dry_grass_3.png",
1265 paramtype = "light",
1266 sunlight_propagates = true,
1268 buildable_to = true,
1269 groups = {snappy = 3, flammable = 3, flora = 1,
1270 attached_node = 1, dry_grass = 1},
1271 sounds = default.node_sound_leaves_defaults(),
1274 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
1277 on_place = function(itemstack, placer, pointed_thing)
1278 -- place a random dry grass node
1279 local stack = ItemStack("default:dry_grass_" .. math.random(1, 5))
1280 local ret = minetest.item_place(stack, placer, pointed_thing)
1281 return ItemStack("default:dry_grass_1 " ..
1282 itemstack:get_count() - (1 - ret:get_count()))
1287 minetest.register_node("default:dry_grass_" .. i, {
1288 description = "Dry Grass",
1289 drawtype = "plantlike",
1291 tiles = {"default_dry_grass_" .. i .. ".png"},
1292 inventory_image = "default_dry_grass_" .. i .. ".png",
1293 wield_image = "default_dry_grass_" .. i .. ".png",
1294 paramtype = "light",
1295 sunlight_propagates = true,
1297 buildable_to = true,
1298 groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
1299 not_in_creative_inventory=1, dry_grass = 1},
1300 drop = "default:dry_grass_1",
1301 sounds = default.node_sound_leaves_defaults(),
1304 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16},
1310 minetest.register_node("default:bush_stem", {
1311 description = "Bush Stem",
1312 drawtype = "plantlike",
1313 visual_scale = 1.41,
1314 tiles = {"default_bush_stem.png"},
1315 inventory_image = "default_bush_stem.png",
1316 wield_image = "default_bush_stem.png",
1317 paramtype = "light",
1318 sunlight_propagates = true,
1319 groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
1320 sounds = default.node_sound_wood_defaults(),
1323 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
1327 minetest.register_node("default:bush_leaves", {
1328 description = "Bush Leaves",
1329 drawtype = "allfaces_optional",
1331 tiles = {"default_leaves_simple.png"},
1332 paramtype = "light",
1333 groups = {snappy = 3, flammable = 2, leaves = 1},
1337 {items = {"default:bush_sapling"}, rarity = 5},
1338 {items = {"default:bush_leaves"}}
1341 sounds = default.node_sound_leaves_defaults(),
1343 after_place_node = default.after_place_leaves,
1346 minetest.register_node("default:bush_sapling", {
1347 description = "Bush Sapling",
1348 drawtype = "plantlike",
1349 tiles = {"default_bush_sapling.png"},
1350 inventory_image = "default_bush_sapling.png",
1351 wield_image = "default_bush_sapling.png",
1352 paramtype = "light",
1353 sunlight_propagates = true,
1355 on_timer = default.grow_sapling,
1358 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
1360 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
1361 attached_node = 1, sapling = 1},
1362 sounds = default.node_sound_leaves_defaults(),
1364 on_construct = function(pos)
1365 minetest.get_node_timer(pos):start(math.random(1200, 2400))
1368 on_place = function(itemstack, placer, pointed_thing)
1369 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
1370 "default:bush_sapling",
1371 -- minp, maxp to be checked, relative to sapling pos
1372 {x = -1, y = 0, z = -1},
1373 {x = 1, y = 1, z = 1},
1374 -- maximum interval of interior volume check
1381 minetest.register_node("default:acacia_bush_stem", {
1382 description = "Acacia Bush Stem",
1383 drawtype = "plantlike",
1384 visual_scale = 1.41,
1385 tiles = {"default_acacia_bush_stem.png"},
1386 inventory_image = "default_acacia_bush_stem.png",
1387 wield_image = "default_acacia_bush_stem.png",
1388 paramtype = "light",
1389 sunlight_propagates = true,
1390 groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
1391 sounds = default.node_sound_wood_defaults(),
1394 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
1398 minetest.register_node("default:acacia_bush_leaves", {
1399 description = "Acacia Bush Leaves",
1400 drawtype = "allfaces_optional",
1402 tiles = {"default_acacia_leaves_simple.png"},
1403 paramtype = "light",
1404 groups = {snappy = 3, flammable = 2, leaves = 1},
1408 {items = {"default:acacia_bush_sapling"}, rarity = 5},
1409 {items = {"default:acacia_bush_leaves"}}
1412 sounds = default.node_sound_leaves_defaults(),
1414 after_place_node = default.after_place_leaves,
1417 minetest.register_node("default:acacia_bush_sapling", {
1418 description = "Acacia Bush Sapling",
1419 drawtype = "plantlike",
1420 tiles = {"default_acacia_bush_sapling.png"},
1421 inventory_image = "default_acacia_bush_sapling.png",
1422 wield_image = "default_acacia_bush_sapling.png",
1423 paramtype = "light",
1424 sunlight_propagates = true,
1426 on_timer = default.grow_sapling,
1429 fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16}
1431 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
1432 attached_node = 1, sapling = 1},
1433 sounds = default.node_sound_leaves_defaults(),
1435 on_construct = function(pos)
1436 minetest.get_node_timer(pos):start(math.random(1200, 2400))
1439 on_place = function(itemstack, placer, pointed_thing)
1440 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
1441 "default:acacia_bush_sapling",
1442 -- minp, maxp to be checked, relative to sapling pos
1443 {x = -1, y = 0, z = -1},
1444 {x = 1, y = 1, z = 1},
1445 -- maximum interval of interior volume check
1457 minetest.register_node("default:coral_brown", {
1458 description = "Brown Coral",
1459 tiles = {"default_coral_brown.png"},
1460 groups = {cracky = 3},
1461 drop = "default:coral_skeleton",
1462 sounds = default.node_sound_stone_defaults(),
1465 minetest.register_node("default:coral_orange", {
1466 description = "Orange Coral",
1467 tiles = {"default_coral_orange.png"},
1468 groups = {cracky = 3},
1469 drop = "default:coral_skeleton",
1470 sounds = default.node_sound_stone_defaults(),
1473 minetest.register_node("default:coral_skeleton", {
1474 description = "Coral Skeleton",
1475 tiles = {"default_coral_skeleton.png"},
1476 groups = {cracky = 3},
1477 sounds = default.node_sound_stone_defaults(),
1485 minetest.register_node("default:water_source", {
1486 description = "Water Source",
1487 drawtype = "liquid",
1490 name = "default_water_source_animated.png",
1492 type = "vertical_frames",
1500 -- New-style water source material (mostly unused)
1502 name = "default_water_source_animated.png",
1504 type = "vertical_frames",
1509 backface_culling = false,
1513 paramtype = "light",
1517 buildable_to = true,
1518 is_ground_content = false,
1521 liquidtype = "source",
1522 liquid_alternative_flowing = "default:water_flowing",
1523 liquid_alternative_source = "default:water_source",
1524 liquid_viscosity = 1,
1525 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1526 groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
1527 sounds = default.node_sound_water_defaults(),
1530 minetest.register_node("default:water_flowing", {
1531 description = "Flowing Water",
1532 drawtype = "flowingliquid",
1533 tiles = {"default_water.png"},
1536 name = "default_water_flowing_animated.png",
1537 backface_culling = false,
1539 type = "vertical_frames",
1546 name = "default_water_flowing_animated.png",
1547 backface_culling = true,
1549 type = "vertical_frames",
1557 paramtype = "light",
1558 paramtype2 = "flowingliquid",
1562 buildable_to = true,
1563 is_ground_content = false,
1566 liquidtype = "flowing",
1567 liquid_alternative_flowing = "default:water_flowing",
1568 liquid_alternative_source = "default:water_source",
1569 liquid_viscosity = 1,
1570 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1571 groups = {water = 3, liquid = 3, puts_out_fire = 1,
1572 not_in_creative_inventory = 1, cools_lava = 1},
1573 sounds = default.node_sound_water_defaults(),
1577 minetest.register_node("default:river_water_source", {
1578 description = "River Water Source",
1579 drawtype = "liquid",
1582 name = "default_river_water_source_animated.png",
1584 type = "vertical_frames",
1593 name = "default_river_water_source_animated.png",
1595 type = "vertical_frames",
1600 backface_culling = false,
1604 paramtype = "light",
1608 buildable_to = true,
1609 is_ground_content = false,
1612 liquidtype = "source",
1613 liquid_alternative_flowing = "default:river_water_flowing",
1614 liquid_alternative_source = "default:river_water_source",
1615 liquid_viscosity = 1,
1616 liquid_renewable = false,
1618 post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1619 groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
1620 sounds = default.node_sound_water_defaults(),
1623 minetest.register_node("default:river_water_flowing", {
1624 description = "Flowing River Water",
1625 drawtype = "flowingliquid",
1626 tiles = {"default_river_water.png"},
1629 name = "default_river_water_flowing_animated.png",
1630 backface_culling = false,
1632 type = "vertical_frames",
1639 name = "default_river_water_flowing_animated.png",
1640 backface_culling = true,
1642 type = "vertical_frames",
1650 paramtype = "light",
1651 paramtype2 = "flowingliquid",
1655 buildable_to = true,
1656 is_ground_content = false,
1659 liquidtype = "flowing",
1660 liquid_alternative_flowing = "default:river_water_flowing",
1661 liquid_alternative_source = "default:river_water_source",
1662 liquid_viscosity = 1,
1663 liquid_renewable = false,
1665 post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1666 groups = {water = 3, liquid = 3, puts_out_fire = 1,
1667 not_in_creative_inventory = 1, cools_lava = 1},
1668 sounds = default.node_sound_water_defaults(),
1672 minetest.register_node("default:lava_source", {
1673 description = "Lava Source",
1674 drawtype = "liquid",
1677 name = "default_lava_source_animated.png",
1679 type = "vertical_frames",
1687 -- New-style lava source material (mostly unused)
1689 name = "default_lava_source_animated.png",
1691 type = "vertical_frames",
1696 backface_culling = false,
1699 paramtype = "light",
1700 light_source = default.LIGHT_MAX - 1,
1704 buildable_to = true,
1705 is_ground_content = false,
1708 liquidtype = "source",
1709 liquid_alternative_flowing = "default:lava_flowing",
1710 liquid_alternative_source = "default:lava_source",
1711 liquid_viscosity = 7,
1712 liquid_renewable = false,
1713 damage_per_second = 4 * 2,
1714 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1715 groups = {lava = 3, liquid = 2, igniter = 1},
1718 minetest.register_node("default:lava_flowing", {
1719 description = "Flowing Lava",
1720 drawtype = "flowingliquid",
1721 tiles = {"default_lava.png"},
1724 name = "default_lava_flowing_animated.png",
1725 backface_culling = false,
1727 type = "vertical_frames",
1734 name = "default_lava_flowing_animated.png",
1735 backface_culling = true,
1737 type = "vertical_frames",
1744 paramtype = "light",
1745 paramtype2 = "flowingliquid",
1746 light_source = default.LIGHT_MAX - 1,
1750 buildable_to = true,
1751 is_ground_content = false,
1754 liquidtype = "flowing",
1755 liquid_alternative_flowing = "default:lava_flowing",
1756 liquid_alternative_source = "default:lava_source",
1757 liquid_viscosity = 7,
1758 liquid_renewable = false,
1759 damage_per_second = 4 * 2,
1760 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1761 groups = {lava = 3, liquid = 2, igniter = 1,
1762 not_in_creative_inventory = 1},
1766 -- Tools / "Advanced" crafting / Non-"natural"
1769 local function get_chest_formspec(pos)
1770 local spos = pos.x .. "," .. pos.y .. "," .. pos.z
1774 default.gui_bg_img ..
1775 default.gui_slots ..
1776 "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
1777 "list[current_player;main;0,4.85;8,1;]" ..
1778 "list[current_player;main;0,6.08;8,3;8]" ..
1779 "listring[nodemeta:" .. spos .. ";main]" ..
1780 "listring[current_player;main]" ..
1781 default.get_hotbar_bg(0,4.85)
1785 local function chest_lid_obstructed(pos)
1786 local above = { x = pos.x, y = pos.y + 1, z = pos.z }
1787 local def = minetest.registered_nodes[minetest.get_node(above).name]
1788 -- allow ladders, signs, wallmounted things and torches to not obstruct
1789 if def.drawtype == "airlike" or
1790 def.drawtype == "signlike" or
1791 def.drawtype == "torchlike" or
1792 (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
1798 local open_chests = {}
1800 minetest.register_on_player_receive_fields(function(player, formname, fields)
1801 if formname ~= "default:chest" then
1804 if not player or not fields.quit then
1807 local pn = player:get_player_name()
1809 if not open_chests[pn] then
1813 local pos = open_chests[pn].pos
1814 local sound = open_chests[pn].sound
1815 local swap = open_chests[pn].swap
1816 local node = minetest.get_node(pos)
1818 open_chests[pn] = nil
1819 for k, v in pairs(open_chests) do
1820 if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
1824 minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
1825 param2 = node.param2 })
1826 minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
1830 function default.register_chest(name, d)
1831 local def = table.copy(d)
1832 def.drawtype = "mesh"
1834 def.paramtype = "light"
1835 def.paramtype2 = "facedir"
1836 def.legacy_facedir_simple = true
1837 def.is_ground_content = false
1839 if def.protected then
1840 def.on_construct = function(pos)
1841 local meta = minetest.get_meta(pos)
1842 meta:set_string("infotext", "Locked Chest")
1843 meta:set_string("owner", "")
1844 local inv = meta:get_inventory()
1845 inv:set_size("main", 8*4)
1847 def.after_place_node = function(pos, placer)
1848 local meta = minetest.get_meta(pos)
1849 meta:set_string("owner", placer:get_player_name() or "")
1850 meta:set_string("infotext", "Locked Chest (owned by " ..
1851 meta:get_string("owner") .. ")")
1853 def.can_dig = function(pos,player)
1854 local meta = minetest.get_meta(pos);
1855 local inv = meta:get_inventory()
1856 return inv:is_empty("main") and
1857 default.can_interact_with_node(player, pos)
1859 def.allow_metadata_inventory_move = function(pos, from_list, from_index,
1860 to_list, to_index, count, player)
1861 if not default.can_interact_with_node(player, pos) then
1866 def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
1867 if not default.can_interact_with_node(player, pos) then
1870 return stack:get_count()
1872 def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
1873 if not default.can_interact_with_node(player, pos) then
1876 return stack:get_count()
1878 def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
1879 if not default.can_interact_with_node(clicker, pos) then
1883 minetest.sound_play(def.sound_open, {gain = 0.3,
1884 pos = pos, max_hear_distance = 10})
1885 if not chest_lid_obstructed(pos) then
1886 minetest.swap_node(pos,
1887 { name = "default:" .. name .. "_open",
1888 param2 = node.param2 })
1890 minetest.after(0.2, minetest.show_formspec,
1891 clicker:get_player_name(),
1892 "default:chest", get_chest_formspec(pos))
1893 open_chests[clicker:get_player_name()] = { pos = pos,
1894 sound = def.sound_close, swap = name }
1896 def.on_blast = function() end
1897 def.on_key_use = function(pos, player)
1898 local secret = minetest.get_meta(pos):get_string("key_lock_secret")
1899 local itemstack = player:get_wielded_item()
1900 local key_meta = itemstack:get_meta()
1902 if key_meta:get_string("secret") == "" then
1903 key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
1904 itemstack:set_metadata("")
1907 if secret ~= key_meta:get_string("secret") then
1911 minetest.show_formspec(
1912 player:get_player_name(),
1913 "default:chest_locked",
1914 get_chest_formspec(pos)
1917 def.on_skeleton_key_use = function(pos, player, newsecret)
1918 local meta = minetest.get_meta(pos)
1919 local owner = meta:get_string("owner")
1920 local pn = player:get_player_name()
1922 -- verify placer is owner of lockable chest
1924 minetest.record_protection_violation(pos, pn)
1925 minetest.chat_send_player(pn, "You do not own this chest.")
1929 local secret = meta:get_string("key_lock_secret")
1930 if secret == "" then
1932 meta:set_string("key_lock_secret", secret)
1935 return secret, "a locked chest", owner
1938 def.on_construct = function(pos)
1939 local meta = minetest.get_meta(pos)
1940 meta:set_string("infotext", "Chest")
1941 local inv = meta:get_inventory()
1942 inv:set_size("main", 8*4)
1944 def.can_dig = function(pos,player)
1945 local meta = minetest.get_meta(pos);
1946 local inv = meta:get_inventory()
1947 return inv:is_empty("main")
1949 def.on_rightclick = function(pos, node, clicker)
1950 minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
1951 max_hear_distance = 10})
1952 if not chest_lid_obstructed(pos) then
1953 minetest.swap_node(pos, {
1954 name = "default:" .. name .. "_open",
1955 param2 = node.param2 })
1957 minetest.after(0.2, minetest.show_formspec,
1958 clicker:get_player_name(),
1959 "default:chest", get_chest_formspec(pos))
1960 open_chests[clicker:get_player_name()] = { pos = pos,
1961 sound = def.sound_close, swap = name }
1965 def.on_metadata_inventory_move = function(pos, from_list, from_index,
1966 to_list, to_index, count, player)
1967 minetest.log("action", player:get_player_name() ..
1968 " moves stuff in chest at " .. minetest.pos_to_string(pos))
1970 def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
1971 minetest.log("action", player:get_player_name() ..
1972 " moves " .. stack:get_name() ..
1973 " to chest at " .. minetest.pos_to_string(pos))
1975 def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
1976 minetest.log("action", player:get_player_name() ..
1977 " takes " .. stack:get_name() ..
1978 " from chest at " .. minetest.pos_to_string(pos))
1980 def.on_blast = function(pos)
1982 default.get_inventory_drops(pos, "main", drops)
1983 drops[#drops+1] = "default:chest"
1984 minetest.remove_node(pos)
1988 local def_opened = table.copy(def)
1989 local def_closed = table.copy(def)
1991 def_opened.mesh = "chest_open.obj"
1992 def_opened.drop = "default:" .. name
1993 def_opened.groups.not_in_creative_inventory = 1
1994 def_opened.selection_box = {
1996 fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
1998 def_opened.can_dig = function()
2002 def_closed.mesh = "cube.obj"
2004 minetest.register_node("default:" .. name, def_closed)
2005 minetest.register_node("default:" .. name .. "_open", def_opened)
2007 -- convert old chests to this new variant
2008 minetest.register_lbm({
2009 label = "update chests to opening chests",
2010 name = "default:upgrade_" .. name .. "_v2",
2011 nodenames = {"default:" .. name},
2012 action = function(pos, node)
2013 local meta = minetest.get_meta(pos)
2014 meta:set_string("formspec", nil)
2015 local inv = meta:get_inventory()
2016 local list = inv:get_list("default:chest")
2018 inv:set_size("main", 8*4)
2019 inv:set_list("main", list)
2020 inv:set_list("default:chest", nil)
2027 default.register_chest("chest", {
2028 description = "Chest",
2029 tiles = { "default_chest_wood.png" },
2030 sounds = default.node_sound_wood_defaults(),
2031 sound_open = "default_chest_open",
2032 sound_close = "default_chest_close",
2033 groups = {choppy = 2, oddly_breakable_by_hand = 2},
2036 default.register_chest("chest_locked", {
2037 description = "Locked Chest",
2038 tiles = { "default_chest_wood_locked.png" },
2039 sounds = default.node_sound_wood_defaults(),
2040 sound_open = "default_chest_open",
2041 sound_close = "default_chest_close",
2042 groups = {choppy = 2, oddly_breakable_by_hand = 2},
2046 local bookshelf_formspec =
2049 default.gui_bg_img ..
2050 default.gui_slots ..
2051 "list[context;books;0,0.3;8,2;]" ..
2052 "list[current_player;main;0,2.85;8,1;]" ..
2053 "list[current_player;main;0,4.08;8,3;8]" ..
2054 "listring[context;books]" ..
2055 "listring[current_player;main]" ..
2056 default.get_hotbar_bg(0,2.85)
2058 local function get_bookshelf_formspec(inv)
2059 local formspec = bookshelf_formspec
2060 local invlist = inv and inv:get_list("books")
2061 -- Inventory slots overlay
2062 local bx, by = 0, 0.3
2068 if not invlist or invlist[i]:is_empty() then
2069 formspec = formspec ..
2070 "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]"
2077 minetest.register_node("default:bookshelf", {
2078 description = "Bookshelf",
2079 tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
2080 "default_wood.png", "default_bookshelf.png", "default_bookshelf.png"},
2081 paramtype2 = "facedir",
2082 is_ground_content = false,
2083 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2084 sounds = default.node_sound_wood_defaults(),
2086 on_construct = function(pos)
2087 local meta = minetest.get_meta(pos)
2088 meta:set_string("formspec", get_bookshelf_formspec(nil))
2089 local inv = meta:get_inventory()
2090 inv:set_size("books", 8 * 2)
2092 can_dig = function(pos,player)
2093 local inv = minetest.get_meta(pos):get_inventory()
2094 return inv:is_empty("books")
2096 allow_metadata_inventory_put = function(pos, listname, index, stack)
2097 if minetest.get_item_group(stack:get_name(), "book") ~= 0 then
2098 return stack:get_count()
2102 on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
2103 minetest.log("action", player:get_player_name() ..
2104 " moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
2105 local meta = minetest.get_meta(pos)
2106 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2108 on_metadata_inventory_put = function(pos, listname, index, stack, player)
2109 minetest.log("action", player:get_player_name() ..
2110 " moves stuff to bookshelf at " .. minetest.pos_to_string(pos))
2111 local meta = minetest.get_meta(pos)
2112 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2114 on_metadata_inventory_take = function(pos, listname, index, stack, player)
2115 minetest.log("action", player:get_player_name() ..
2116 " takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
2117 local meta = minetest.get_meta(pos)
2118 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2120 on_blast = function(pos)
2122 default.get_inventory_drops(pos, "books", drops)
2123 drops[#drops+1] = "default:bookshelf"
2124 minetest.remove_node(pos)
2129 local function register_sign(material, desc, def)
2130 minetest.register_node("default:sign_wall_" .. material, {
2131 description = desc .. " Sign",
2132 drawtype = "nodebox",
2133 tiles = {"default_sign_wall_" .. material .. ".png"},
2134 inventory_image = "default_sign_" .. material .. ".png",
2135 wield_image = "default_sign_" .. material .. ".png",
2136 paramtype = "light",
2137 paramtype2 = "wallmounted",
2138 sunlight_propagates = true,
2139 is_ground_content = false,
2142 type = "wallmounted",
2143 wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
2144 wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
2145 wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
2147 groups = def.groups,
2148 legacy_wallmounted = true,
2149 sounds = def.sounds,
2151 on_construct = function(pos)
2152 --local n = minetest.get_node(pos)
2153 local meta = minetest.get_meta(pos)
2154 meta:set_string("formspec", "field[text;;${text}]")
2156 on_receive_fields = function(pos, formname, fields, sender)
2157 --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
2158 local player_name = sender:get_player_name()
2159 if minetest.is_protected(pos, player_name) then
2160 minetest.record_protection_violation(pos, player_name)
2163 local meta = minetest.get_meta(pos)
2164 if not fields.text then return end
2165 minetest.log("action", (player_name or "") .. " wrote \"" ..
2166 fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
2167 meta:set_string("text", fields.text)
2168 meta:set_string("infotext", '"' .. fields.text .. '"')
2173 register_sign("wood", "Wooden", {
2174 sounds = default.node_sound_wood_defaults(),
2175 groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
2178 register_sign("steel", "Steel", {
2179 sounds = default.node_sound_metal_defaults(),
2180 groups = {cracky = 2, attached_node = 1}
2183 minetest.register_node("default:ladder_wood", {
2184 description = "Wooden Ladder",
2185 drawtype = "signlike",
2186 tiles = {"default_ladder_wood.png"},
2187 inventory_image = "default_ladder_wood.png",
2188 wield_image = "default_ladder_wood.png",
2189 paramtype = "light",
2190 paramtype2 = "wallmounted",
2191 sunlight_propagates = true,
2194 is_ground_content = false,
2196 type = "wallmounted",
2197 --wall_top = = <default>
2198 --wall_bottom = = <default>
2199 --wall_side = = <default>
2201 groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2},
2202 legacy_wallmounted = true,
2203 sounds = default.node_sound_wood_defaults(),
2206 minetest.register_node("default:ladder_steel", {
2207 description = "Steel Ladder",
2208 drawtype = "signlike",
2209 tiles = {"default_ladder_steel.png"},
2210 inventory_image = "default_ladder_steel.png",
2211 wield_image = "default_ladder_steel.png",
2212 paramtype = "light",
2213 paramtype2 = "wallmounted",
2214 sunlight_propagates = true,
2217 is_ground_content = false,
2219 type = "wallmounted",
2220 --wall_top = = <default>
2221 --wall_bottom = = <default>
2222 --wall_side = = <default>
2224 groups = {cracky = 2},
2225 sounds = default.node_sound_metal_defaults(),
2228 default.register_fence("default:fence_wood", {
2229 description = "Wooden Fence",
2230 texture = "default_fence_wood.png",
2231 inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2232 wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2233 material = "default:wood",
2234 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2235 sounds = default.node_sound_wood_defaults()
2238 default.register_fence("default:fence_acacia_wood", {
2239 description = "Acacia Fence",
2240 texture = "default_fence_acacia_wood.png",
2241 inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2242 wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2243 material = "default:acacia_wood",
2244 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2245 sounds = default.node_sound_wood_defaults()
2248 default.register_fence("default:fence_junglewood", {
2249 description = "Junglewood Fence",
2250 texture = "default_fence_junglewood.png",
2251 inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
2252 wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
2253 material = "default:junglewood",
2254 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2255 sounds = default.node_sound_wood_defaults()
2258 default.register_fence("default:fence_pine_wood", {
2259 description = "Pine Fence",
2260 texture = "default_fence_pine_wood.png",
2261 inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2262 wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2263 material = "default:pine_wood",
2264 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2265 sounds = default.node_sound_wood_defaults()
2268 default.register_fence("default:fence_aspen_wood", {
2269 description = "Aspen Fence",
2270 texture = "default_fence_aspen_wood.png",
2271 inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2272 wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2273 material = "default:aspen_wood",
2274 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2275 sounds = default.node_sound_wood_defaults()
2278 minetest.register_node("default:glass", {
2279 description = "Glass",
2280 drawtype = "glasslike_framed_optional",
2281 tiles = {"default_glass.png", "default_glass_detail.png"},
2282 paramtype = "light",
2283 paramtype2 = "glasslikeliquidlevel",
2284 sunlight_propagates = true,
2285 is_ground_content = false,
2286 groups = {cracky = 3, oddly_breakable_by_hand = 3},
2287 sounds = default.node_sound_glass_defaults(),
2290 minetest.register_node("default:obsidian_glass", {
2291 description = "Obsidian Glass",
2292 drawtype = "glasslike_framed_optional",
2293 tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
2294 paramtype = "light",
2295 paramtype2 = "glasslikeliquidlevel",
2296 is_ground_content = false,
2297 sunlight_propagates = true,
2298 sounds = default.node_sound_glass_defaults(),
2299 groups = {cracky = 3},
2303 minetest.register_node("default:brick", {
2304 description = "Brick Block",
2305 paramtype2 = "facedir",
2307 tiles = {"default_brick.png"},
2308 is_ground_content = false,
2309 groups = {cracky = 3},
2310 sounds = default.node_sound_stone_defaults(),
2314 minetest.register_node("default:meselamp", {
2315 description = "Mese Lamp",
2316 drawtype = "glasslike",
2317 tiles = {"default_meselamp.png"},
2318 paramtype = "light",
2319 sunlight_propagates = true,
2320 is_ground_content = false,
2321 groups = {cracky = 3, oddly_breakable_by_hand = 3},
2322 sounds = default.node_sound_glass_defaults(),
2323 light_source = default.LIGHT_MAX,
2326 minetest.register_node("default:mese_post_light", {
2327 description = "Mese Post Light",
2328 tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png",
2329 "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png",
2330 "default_mese_post_light_side.png", "default_mese_post_light_side.png"},
2331 wield_image = "default_mese_post_light_side.png",
2332 drawtype = "nodebox",
2336 {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16},
2339 paramtype = "light",
2340 light_source = default.LIGHT_MAX,
2341 sunlight_propagates = true,
2342 is_ground_content = false,
2343 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2344 sounds = default.node_sound_wood_defaults(),
2351 minetest.register_node("default:cloud", {
2352 description = "Cloud",
2353 tiles = {"default_cloud.png"},
2354 is_ground_content = false,
2355 sounds = default.node_sound_defaults(),
2356 groups = {not_in_creative_inventory = 1},
2360 -- register trees for leafdecay
2363 if minetest.get_mapgen_setting("mg_name") == "v6" then
2364 default.register_leafdecay({
2365 trunks = {"default:tree"},
2366 leaves = {"default:apple", "default:leaves"},
2370 default.register_leafdecay({
2371 trunks = {"default:jungletree"},
2372 leaves = {"default:jungleleaves"},
2376 default.register_leafdecay({
2377 trunks = {"default:pine_tree"},
2378 leaves = {"default:pine_needles"},
2382 default.register_leafdecay({
2383 trunks = {"default:tree"},
2384 leaves = {"default:apple", "default:leaves"},
2388 default.register_leafdecay({
2389 trunks = {"default:jungletree"},
2390 leaves = {"default:jungleleaves"},
2394 default.register_leafdecay({
2395 trunks = {"default:pine_tree"},
2396 leaves = {"default:pine_needles"},
2401 default.register_leafdecay({
2402 trunks = {"default:acacia_tree"},
2403 leaves = {"default:acacia_leaves"},
2407 default.register_leafdecay({
2408 trunks = {"default:aspen_tree"},
2409 leaves = {"default:aspen_leaves"},
2413 default.register_leafdecay({
2414 trunks = {"default:bush_stem"},
2415 leaves = {"default:bush_leaves"},
2419 default.register_leafdecay({
2420 trunks = {"default:acacia_bush_stem"},
2421 leaves = {"default:acacia_bush_leaves"},