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(300, 1500))
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 minetest.set_node(pos, {name = "default:apple", param2 = 1})
681 minetest.register_node("default:jungletree", {
682 description = "Jungle Tree",
683 tiles = {"default_jungletree_top.png", "default_jungletree_top.png",
684 "default_jungletree.png"},
685 paramtype2 = "facedir",
686 is_ground_content = false,
687 groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
688 sounds = default.node_sound_wood_defaults(),
690 on_place = minetest.rotate_node
693 minetest.register_node("default:junglewood", {
694 description = "Jungle Wood Planks",
695 paramtype2 = "facedir",
697 tiles = {"default_junglewood.png"},
698 is_ground_content = false,
699 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
700 sounds = default.node_sound_wood_defaults(),
703 minetest.register_node("default:jungleleaves", {
704 description = "Jungle Leaves",
705 drawtype = "allfaces_optional",
707 tiles = {"default_jungleleaves.png"},
708 special_tiles = {"default_jungleleaves_simple.png"},
710 is_ground_content = false,
711 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
715 {items = {'default:junglesapling'}, rarity = 20},
716 {items = {'default:jungleleaves'}}
719 sounds = default.node_sound_leaves_defaults(),
721 after_place_node = default.after_place_leaves,
724 minetest.register_node("default:junglesapling", {
725 description = "Jungle Sapling",
726 drawtype = "plantlike",
727 tiles = {"default_junglesapling.png"},
728 inventory_image = "default_junglesapling.png",
729 wield_image = "default_junglesapling.png",
731 sunlight_propagates = true,
733 on_timer = default.grow_sapling,
736 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
738 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
739 attached_node = 1, sapling = 1},
740 sounds = default.node_sound_leaves_defaults(),
742 on_construct = function(pos)
743 minetest.get_node_timer(pos):start(math.random(300, 1500))
746 on_place = function(itemstack, placer, pointed_thing)
747 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
748 "default:junglesapling",
749 -- minp, maxp to be checked, relative to sapling pos
750 -- minp_relative.y = 1 because sapling pos has been checked
751 {x = -2, y = 1, z = -2},
752 {x = 2, y = 15, z = 2},
753 -- maximum interval of interior volume check
761 minetest.register_node("default:pine_tree", {
762 description = "Pine Tree",
763 tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png",
764 "default_pine_tree.png"},
765 paramtype2 = "facedir",
766 is_ground_content = false,
767 groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
768 sounds = default.node_sound_wood_defaults(),
770 on_place = minetest.rotate_node
773 minetest.register_node("default:pine_wood", {
774 description = "Pine Wood Planks",
775 paramtype2 = "facedir",
777 tiles = {"default_pine_wood.png"},
778 is_ground_content = false,
779 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
780 sounds = default.node_sound_wood_defaults(),
783 minetest.register_node("default:pine_needles",{
784 description = "Pine Needles",
785 drawtype = "allfaces_optional",
786 tiles = {"default_pine_needles.png"},
789 is_ground_content = false,
790 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
794 {items = {"default:pine_sapling"}, rarity = 20},
795 {items = {"default:pine_needles"}}
798 sounds = default.node_sound_leaves_defaults(),
800 after_place_node = default.after_place_leaves,
803 minetest.register_node("default:pine_sapling", {
804 description = "Pine Sapling",
805 drawtype = "plantlike",
806 tiles = {"default_pine_sapling.png"},
807 inventory_image = "default_pine_sapling.png",
808 wield_image = "default_pine_sapling.png",
810 sunlight_propagates = true,
812 on_timer = default.grow_sapling,
815 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
817 groups = {snappy = 2, dig_immediate = 3, flammable = 3,
818 attached_node = 1, sapling = 1},
819 sounds = default.node_sound_leaves_defaults(),
821 on_construct = function(pos)
822 minetest.get_node_timer(pos):start(math.random(300, 1500))
825 on_place = function(itemstack, placer, pointed_thing)
826 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
827 "default:pine_sapling",
828 -- minp, maxp to be checked, relative to sapling pos
829 -- minp_relative.y = 1 because sapling pos has been checked
830 {x = -2, y = 1, z = -2},
831 {x = 2, y = 12, z = 2},
832 -- maximum interval of interior volume check
840 minetest.register_node("default:acacia_tree", {
841 description = "Acacia Tree",
842 tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png",
843 "default_acacia_tree.png"},
844 paramtype2 = "facedir",
845 is_ground_content = false,
846 groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
847 sounds = default.node_sound_wood_defaults(),
849 on_place = minetest.rotate_node
852 minetest.register_node("default:acacia_wood", {
853 description = "Acacia Wood Planks",
854 paramtype2 = "facedir",
856 tiles = {"default_acacia_wood.png"},
857 is_ground_content = false,
858 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
859 sounds = default.node_sound_wood_defaults(),
862 minetest.register_node("default:acacia_leaves", {
863 description = "Acacia Leaves",
864 drawtype = "allfaces_optional",
865 tiles = {"default_acacia_leaves.png"},
866 special_tiles = {"default_acacia_leaves_simple.png"},
869 is_ground_content = false,
870 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
874 {items = {"default:acacia_sapling"}, rarity = 20},
875 {items = {"default:acacia_leaves"}}
878 sounds = default.node_sound_leaves_defaults(),
880 after_place_node = default.after_place_leaves,
883 minetest.register_node("default:acacia_sapling", {
884 description = "Acacia Tree Sapling",
885 drawtype = "plantlike",
886 tiles = {"default_acacia_sapling.png"},
887 inventory_image = "default_acacia_sapling.png",
888 wield_image = "default_acacia_sapling.png",
890 sunlight_propagates = true,
892 on_timer = default.grow_sapling,
895 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
897 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
898 attached_node = 1, sapling = 1},
899 sounds = default.node_sound_leaves_defaults(),
901 on_construct = function(pos)
902 minetest.get_node_timer(pos):start(math.random(300, 1500))
905 on_place = function(itemstack, placer, pointed_thing)
906 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
907 "default:acacia_sapling",
908 -- minp, maxp to be checked, relative to sapling pos
909 -- minp_relative.y = 1 because sapling pos has been checked
910 {x = -4, y = 1, z = -4},
911 {x = 4, y = 6, z = 4},
912 -- maximum interval of interior volume check
919 minetest.register_node("default:aspen_tree", {
920 description = "Aspen Tree",
921 tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png",
922 "default_aspen_tree.png"},
923 paramtype2 = "facedir",
924 is_ground_content = false,
925 groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
926 sounds = default.node_sound_wood_defaults(),
928 on_place = minetest.rotate_node
931 minetest.register_node("default:aspen_wood", {
932 description = "Aspen Wood Planks",
933 paramtype2 = "facedir",
935 tiles = {"default_aspen_wood.png"},
936 is_ground_content = false,
937 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
938 sounds = default.node_sound_wood_defaults(),
941 minetest.register_node("default:aspen_leaves", {
942 description = "Aspen Leaves",
943 drawtype = "allfaces_optional",
944 tiles = {"default_aspen_leaves.png"},
947 is_ground_content = false,
948 groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
952 {items = {"default:aspen_sapling"}, rarity = 20},
953 {items = {"default:aspen_leaves"}}
956 sounds = default.node_sound_leaves_defaults(),
958 after_place_node = default.after_place_leaves,
961 minetest.register_node("default:aspen_sapling", {
962 description = "Aspen Tree Sapling",
963 drawtype = "plantlike",
964 tiles = {"default_aspen_sapling.png"},
965 inventory_image = "default_aspen_sapling.png",
966 wield_image = "default_aspen_sapling.png",
968 sunlight_propagates = true,
970 on_timer = default.grow_sapling,
973 fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16}
975 groups = {snappy = 2, dig_immediate = 3, flammable = 3,
976 attached_node = 1, sapling = 1},
977 sounds = default.node_sound_leaves_defaults(),
979 on_construct = function(pos)
980 minetest.get_node_timer(pos):start(math.random(300, 1500))
983 on_place = function(itemstack, placer, pointed_thing)
984 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
985 "default:aspen_sapling",
986 -- minp, maxp to be checked, relative to sapling pos
987 -- minp_relative.y = 1 because sapling pos has been checked
988 {x = -2, y = 1, z = -2},
989 {x = 2, y = 12, z = 2},
990 -- maximum interval of interior volume check
1001 minetest.register_node("default:stone_with_coal", {
1002 description = "Coal Ore",
1003 tiles = {"default_stone.png^default_mineral_coal.png"},
1004 groups = {cracky = 3},
1005 drop = 'default:coal_lump',
1006 sounds = default.node_sound_stone_defaults(),
1009 minetest.register_node("default:coalblock", {
1010 description = "Coal Block",
1011 tiles = {"default_coal_block.png"},
1012 is_ground_content = false,
1013 groups = {cracky = 3},
1014 sounds = default.node_sound_stone_defaults(),
1018 minetest.register_node("default:stone_with_iron", {
1019 description = "Iron Ore",
1020 tiles = {"default_stone.png^default_mineral_iron.png"},
1021 groups = {cracky = 2},
1022 drop = 'default:iron_lump',
1023 sounds = default.node_sound_stone_defaults(),
1026 minetest.register_node("default:steelblock", {
1027 description = "Steel Block",
1028 tiles = {"default_steel_block.png"},
1029 is_ground_content = false,
1030 groups = {cracky = 1, level = 2},
1031 sounds = default.node_sound_metal_defaults(),
1035 minetest.register_node("default:stone_with_copper", {
1036 description = "Copper Ore",
1037 tiles = {"default_stone.png^default_mineral_copper.png"},
1038 groups = {cracky = 2},
1039 drop = 'default:copper_lump',
1040 sounds = default.node_sound_stone_defaults(),
1043 minetest.register_node("default:copperblock", {
1044 description = "Copper Block",
1045 tiles = {"default_copper_block.png"},
1046 is_ground_content = false,
1047 groups = {cracky = 1, level = 2},
1048 sounds = default.node_sound_metal_defaults(),
1052 minetest.register_node("default:stone_with_tin", {
1053 description = "Tin Ore",
1054 tiles = {"default_stone.png^default_mineral_tin.png"},
1055 groups = {cracky = 2},
1056 drop = "default:tin_lump",
1057 sounds = default.node_sound_stone_defaults(),
1060 minetest.register_node("default:tinblock", {
1061 description = "Tin Block",
1062 tiles = {"default_tin_block.png"},
1063 is_ground_content = false,
1064 groups = {cracky = 1, level = 2},
1065 sounds = default.node_sound_metal_defaults(),
1069 minetest.register_node("default:bronzeblock", {
1070 description = "Bronze Block",
1071 tiles = {"default_bronze_block.png"},
1072 is_ground_content = false,
1073 groups = {cracky = 1, level = 2},
1074 sounds = default.node_sound_metal_defaults(),
1078 minetest.register_node("default:stone_with_mese", {
1079 description = "Mese Ore",
1080 tiles = {"default_stone.png^default_mineral_mese.png"},
1081 groups = {cracky = 1},
1082 drop = "default:mese_crystal",
1083 sounds = default.node_sound_stone_defaults(),
1086 minetest.register_node("default:mese", {
1087 description = "Mese Block",
1088 tiles = {"default_mese_block.png"},
1089 paramtype = "light",
1090 groups = {cracky = 1, level = 2},
1091 sounds = default.node_sound_stone_defaults(),
1096 minetest.register_node("default:stone_with_gold", {
1097 description = "Gold Ore",
1098 tiles = {"default_stone.png^default_mineral_gold.png"},
1099 groups = {cracky = 2},
1100 drop = "default:gold_lump",
1101 sounds = default.node_sound_stone_defaults(),
1104 minetest.register_node("default:goldblock", {
1105 description = "Gold Block",
1106 tiles = {"default_gold_block.png"},
1107 is_ground_content = false,
1108 groups = {cracky = 1},
1109 sounds = default.node_sound_metal_defaults(),
1113 minetest.register_node("default:stone_with_diamond", {
1114 description = "Diamond Ore",
1115 tiles = {"default_stone.png^default_mineral_diamond.png"},
1116 groups = {cracky = 1},
1117 drop = "default:diamond",
1118 sounds = default.node_sound_stone_defaults(),
1121 minetest.register_node("default:diamondblock", {
1122 description = "Diamond Block",
1123 tiles = {"default_diamond_block.png"},
1124 is_ground_content = false,
1125 groups = {cracky = 1, level = 3},
1126 sounds = default.node_sound_stone_defaults(),
1130 -- Plantlife (non-cubic)
1133 minetest.register_node("default:cactus", {
1134 description = "Cactus",
1135 tiles = {"default_cactus_top.png", "default_cactus_top.png",
1136 "default_cactus_side.png"},
1137 paramtype2 = "facedir",
1138 groups = {choppy = 3},
1139 sounds = default.node_sound_wood_defaults(),
1140 on_place = minetest.rotate_node,
1143 minetest.register_node("default:papyrus", {
1144 description = "Papyrus",
1145 drawtype = "plantlike",
1146 tiles = {"default_papyrus.png"},
1147 inventory_image = "default_papyrus.png",
1148 wield_image = "default_papyrus.png",
1149 paramtype = "light",
1150 sunlight_propagates = true,
1154 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
1156 groups = {snappy = 3, flammable = 2},
1157 sounds = default.node_sound_leaves_defaults(),
1159 after_dig_node = function(pos, node, metadata, digger)
1160 default.dig_up(pos, node, digger)
1164 minetest.register_node("default:dry_shrub", {
1165 description = "Dry Shrub",
1166 drawtype = "plantlike",
1168 tiles = {"default_dry_shrub.png"},
1169 inventory_image = "default_dry_shrub.png",
1170 wield_image = "default_dry_shrub.png",
1171 paramtype = "light",
1172 sunlight_propagates = true,
1174 buildable_to = true,
1175 groups = {snappy = 3, flammable = 3, attached_node = 1},
1176 sounds = default.node_sound_leaves_defaults(),
1179 fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16},
1183 minetest.register_node("default:junglegrass", {
1184 description = "Jungle Grass",
1185 drawtype = "plantlike",
1187 visual_scale = 1.69,
1188 tiles = {"default_junglegrass.png"},
1189 inventory_image = "default_junglegrass.png",
1190 wield_image = "default_junglegrass.png",
1191 paramtype = "light",
1192 sunlight_propagates = true,
1194 buildable_to = true,
1195 groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1},
1196 sounds = default.node_sound_leaves_defaults(),
1199 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16},
1204 minetest.register_node("default:grass_1", {
1205 description = "Grass",
1206 drawtype = "plantlike",
1208 tiles = {"default_grass_1.png"},
1209 -- Use texture of a taller grass stage in inventory
1210 inventory_image = "default_grass_3.png",
1211 wield_image = "default_grass_3.png",
1212 paramtype = "light",
1213 sunlight_propagates = true,
1215 buildable_to = true,
1216 groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1},
1217 sounds = default.node_sound_leaves_defaults(),
1220 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16},
1223 on_place = function(itemstack, placer, pointed_thing)
1224 -- place a random grass node
1225 local stack = ItemStack("default:grass_" .. math.random(1,5))
1226 local ret = minetest.item_place(stack, placer, pointed_thing)
1227 return ItemStack("default:grass_1 " ..
1228 itemstack:get_count() - (1 - ret:get_count()))
1233 minetest.register_node("default:grass_" .. i, {
1234 description = "Grass",
1235 drawtype = "plantlike",
1237 tiles = {"default_grass_" .. i .. ".png"},
1238 inventory_image = "default_grass_" .. i .. ".png",
1239 wield_image = "default_grass_" .. i .. ".png",
1240 paramtype = "light",
1241 sunlight_propagates = true,
1243 buildable_to = true,
1244 drop = "default:grass_1",
1245 groups = {snappy = 3, flora = 1, attached_node = 1,
1246 not_in_creative_inventory = 1, grass = 1, flammable = 1},
1247 sounds = default.node_sound_leaves_defaults(),
1250 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
1256 minetest.register_node("default:dry_grass_1", {
1257 description = "Dry Grass",
1258 drawtype = "plantlike",
1260 tiles = {"default_dry_grass_1.png"},
1261 inventory_image = "default_dry_grass_3.png",
1262 wield_image = "default_dry_grass_3.png",
1263 paramtype = "light",
1264 sunlight_propagates = true,
1266 buildable_to = true,
1267 groups = {snappy = 3, flammable = 3, flora = 1,
1268 attached_node = 1, dry_grass = 1},
1269 sounds = default.node_sound_leaves_defaults(),
1272 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
1275 on_place = function(itemstack, placer, pointed_thing)
1276 -- place a random dry grass node
1277 local stack = ItemStack("default:dry_grass_" .. math.random(1, 5))
1278 local ret = minetest.item_place(stack, placer, pointed_thing)
1279 return ItemStack("default:dry_grass_1 " ..
1280 itemstack:get_count() - (1 - ret:get_count()))
1285 minetest.register_node("default:dry_grass_" .. i, {
1286 description = "Dry Grass",
1287 drawtype = "plantlike",
1289 tiles = {"default_dry_grass_" .. i .. ".png"},
1290 inventory_image = "default_dry_grass_" .. i .. ".png",
1291 wield_image = "default_dry_grass_" .. i .. ".png",
1292 paramtype = "light",
1293 sunlight_propagates = true,
1295 buildable_to = true,
1296 groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
1297 not_in_creative_inventory=1, dry_grass = 1},
1298 drop = "default:dry_grass_1",
1299 sounds = default.node_sound_leaves_defaults(),
1302 fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16},
1308 minetest.register_node("default:bush_stem", {
1309 description = "Bush Stem",
1310 drawtype = "plantlike",
1311 visual_scale = 1.41,
1312 tiles = {"default_bush_stem.png"},
1313 inventory_image = "default_bush_stem.png",
1314 wield_image = "default_bush_stem.png",
1315 paramtype = "light",
1316 sunlight_propagates = true,
1317 groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
1318 sounds = default.node_sound_wood_defaults(),
1321 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
1325 minetest.register_node("default:bush_leaves", {
1326 description = "Bush Leaves",
1327 drawtype = "allfaces_optional",
1329 tiles = {"default_leaves_simple.png"},
1330 paramtype = "light",
1331 groups = {snappy = 3, flammable = 2, leaves = 1},
1335 {items = {"default:bush_sapling"}, rarity = 5},
1336 {items = {"default:bush_leaves"}}
1339 sounds = default.node_sound_leaves_defaults(),
1341 after_place_node = default.after_place_leaves,
1344 minetest.register_node("default:bush_sapling", {
1345 description = "Bush Sapling",
1346 drawtype = "plantlike",
1347 tiles = {"default_bush_sapling.png"},
1348 inventory_image = "default_bush_sapling.png",
1349 wield_image = "default_bush_sapling.png",
1350 paramtype = "light",
1351 sunlight_propagates = true,
1353 on_timer = default.grow_sapling,
1356 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
1358 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
1359 attached_node = 1, sapling = 1},
1360 sounds = default.node_sound_leaves_defaults(),
1362 on_construct = function(pos)
1363 minetest.get_node_timer(pos):start(math.random(300, 1500))
1366 on_place = function(itemstack, placer, pointed_thing)
1367 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
1368 "default:bush_sapling",
1369 -- minp, maxp to be checked, relative to sapling pos
1370 {x = -1, y = 0, z = -1},
1371 {x = 1, y = 1, z = 1},
1372 -- maximum interval of interior volume check
1379 minetest.register_node("default:acacia_bush_stem", {
1380 description = "Acacia Bush Stem",
1381 drawtype = "plantlike",
1382 visual_scale = 1.41,
1383 tiles = {"default_acacia_bush_stem.png"},
1384 inventory_image = "default_acacia_bush_stem.png",
1385 wield_image = "default_acacia_bush_stem.png",
1386 paramtype = "light",
1387 sunlight_propagates = true,
1388 groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
1389 sounds = default.node_sound_wood_defaults(),
1392 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
1396 minetest.register_node("default:acacia_bush_leaves", {
1397 description = "Acacia Bush Leaves",
1398 drawtype = "allfaces_optional",
1400 tiles = {"default_acacia_leaves_simple.png"},
1401 paramtype = "light",
1402 groups = {snappy = 3, flammable = 2, leaves = 1},
1406 {items = {"default:acacia_bush_sapling"}, rarity = 5},
1407 {items = {"default:acacia_bush_leaves"}}
1410 sounds = default.node_sound_leaves_defaults(),
1412 after_place_node = default.after_place_leaves,
1415 minetest.register_node("default:acacia_bush_sapling", {
1416 description = "Acacia Bush Sapling",
1417 drawtype = "plantlike",
1418 tiles = {"default_acacia_bush_sapling.png"},
1419 inventory_image = "default_acacia_bush_sapling.png",
1420 wield_image = "default_acacia_bush_sapling.png",
1421 paramtype = "light",
1422 sunlight_propagates = true,
1424 on_timer = default.grow_sapling,
1427 fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16}
1429 groups = {snappy = 2, dig_immediate = 3, flammable = 2,
1430 attached_node = 1, sapling = 1},
1431 sounds = default.node_sound_leaves_defaults(),
1433 on_construct = function(pos)
1434 minetest.get_node_timer(pos):start(math.random(300, 1500))
1437 on_place = function(itemstack, placer, pointed_thing)
1438 itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
1439 "default:acacia_bush_sapling",
1440 -- minp, maxp to be checked, relative to sapling pos
1441 {x = -1, y = 0, z = -1},
1442 {x = 1, y = 1, z = 1},
1443 -- maximum interval of interior volume check
1455 minetest.register_node("default:coral_brown", {
1456 description = "Brown Coral",
1457 tiles = {"default_coral_brown.png"},
1458 groups = {cracky = 3},
1459 drop = "default:coral_skeleton",
1460 sounds = default.node_sound_stone_defaults(),
1463 minetest.register_node("default:coral_orange", {
1464 description = "Orange Coral",
1465 tiles = {"default_coral_orange.png"},
1466 groups = {cracky = 3},
1467 drop = "default:coral_skeleton",
1468 sounds = default.node_sound_stone_defaults(),
1471 minetest.register_node("default:coral_skeleton", {
1472 description = "Coral Skeleton",
1473 tiles = {"default_coral_skeleton.png"},
1474 groups = {cracky = 3},
1475 sounds = default.node_sound_stone_defaults(),
1483 minetest.register_node("default:water_source", {
1484 description = "Water Source",
1485 drawtype = "liquid",
1488 name = "default_water_source_animated.png",
1490 type = "vertical_frames",
1498 -- New-style water source material (mostly unused)
1500 name = "default_water_source_animated.png",
1502 type = "vertical_frames",
1507 backface_culling = false,
1511 paramtype = "light",
1515 buildable_to = true,
1516 is_ground_content = false,
1519 liquidtype = "source",
1520 liquid_alternative_flowing = "default:water_flowing",
1521 liquid_alternative_source = "default:water_source",
1522 liquid_viscosity = 1,
1523 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1524 groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
1525 sounds = default.node_sound_water_defaults(),
1528 minetest.register_node("default:water_flowing", {
1529 description = "Flowing Water",
1530 drawtype = "flowingliquid",
1531 tiles = {"default_water.png"},
1534 name = "default_water_flowing_animated.png",
1535 backface_culling = false,
1537 type = "vertical_frames",
1544 name = "default_water_flowing_animated.png",
1545 backface_culling = true,
1547 type = "vertical_frames",
1555 paramtype = "light",
1556 paramtype2 = "flowingliquid",
1560 buildable_to = true,
1561 is_ground_content = false,
1564 liquidtype = "flowing",
1565 liquid_alternative_flowing = "default:water_flowing",
1566 liquid_alternative_source = "default:water_source",
1567 liquid_viscosity = 1,
1568 post_effect_color = {a = 103, r = 30, g = 60, b = 90},
1569 groups = {water = 3, liquid = 3, puts_out_fire = 1,
1570 not_in_creative_inventory = 1, cools_lava = 1},
1571 sounds = default.node_sound_water_defaults(),
1575 minetest.register_node("default:river_water_source", {
1576 description = "River Water Source",
1577 drawtype = "liquid",
1580 name = "default_river_water_source_animated.png",
1582 type = "vertical_frames",
1591 name = "default_river_water_source_animated.png",
1593 type = "vertical_frames",
1598 backface_culling = false,
1602 paramtype = "light",
1606 buildable_to = true,
1607 is_ground_content = false,
1610 liquidtype = "source",
1611 liquid_alternative_flowing = "default:river_water_flowing",
1612 liquid_alternative_source = "default:river_water_source",
1613 liquid_viscosity = 1,
1614 liquid_renewable = false,
1616 post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1617 groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
1618 sounds = default.node_sound_water_defaults(),
1621 minetest.register_node("default:river_water_flowing", {
1622 description = "Flowing River Water",
1623 drawtype = "flowingliquid",
1624 tiles = {"default_river_water.png"},
1627 name = "default_river_water_flowing_animated.png",
1628 backface_culling = false,
1630 type = "vertical_frames",
1637 name = "default_river_water_flowing_animated.png",
1638 backface_culling = true,
1640 type = "vertical_frames",
1648 paramtype = "light",
1649 paramtype2 = "flowingliquid",
1653 buildable_to = true,
1654 is_ground_content = false,
1657 liquidtype = "flowing",
1658 liquid_alternative_flowing = "default:river_water_flowing",
1659 liquid_alternative_source = "default:river_water_source",
1660 liquid_viscosity = 1,
1661 liquid_renewable = false,
1663 post_effect_color = {a = 103, r = 30, g = 76, b = 90},
1664 groups = {water = 3, liquid = 3, puts_out_fire = 1,
1665 not_in_creative_inventory = 1, cools_lava = 1},
1666 sounds = default.node_sound_water_defaults(),
1670 minetest.register_node("default:lava_source", {
1671 description = "Lava Source",
1672 drawtype = "liquid",
1675 name = "default_lava_source_animated.png",
1677 type = "vertical_frames",
1685 -- New-style lava source material (mostly unused)
1687 name = "default_lava_source_animated.png",
1689 type = "vertical_frames",
1694 backface_culling = false,
1697 paramtype = "light",
1698 light_source = default.LIGHT_MAX - 1,
1702 buildable_to = true,
1703 is_ground_content = false,
1706 liquidtype = "source",
1707 liquid_alternative_flowing = "default:lava_flowing",
1708 liquid_alternative_source = "default:lava_source",
1709 liquid_viscosity = 7,
1710 liquid_renewable = false,
1711 damage_per_second = 4 * 2,
1712 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1713 groups = {lava = 3, liquid = 2, igniter = 1},
1716 minetest.register_node("default:lava_flowing", {
1717 description = "Flowing Lava",
1718 drawtype = "flowingliquid",
1719 tiles = {"default_lava.png"},
1722 name = "default_lava_flowing_animated.png",
1723 backface_culling = false,
1725 type = "vertical_frames",
1732 name = "default_lava_flowing_animated.png",
1733 backface_culling = true,
1735 type = "vertical_frames",
1742 paramtype = "light",
1743 paramtype2 = "flowingliquid",
1744 light_source = default.LIGHT_MAX - 1,
1748 buildable_to = true,
1749 is_ground_content = false,
1752 liquidtype = "flowing",
1753 liquid_alternative_flowing = "default:lava_flowing",
1754 liquid_alternative_source = "default:lava_source",
1755 liquid_viscosity = 7,
1756 liquid_renewable = false,
1757 damage_per_second = 4 * 2,
1758 post_effect_color = {a = 191, r = 255, g = 64, b = 0},
1759 groups = {lava = 3, liquid = 2, igniter = 1,
1760 not_in_creative_inventory = 1},
1764 -- Tools / "Advanced" crafting / Non-"natural"
1767 local function get_chest_formspec(pos)
1768 local spos = pos.x .. "," .. pos.y .. "," .. pos.z
1772 default.gui_bg_img ..
1773 default.gui_slots ..
1774 "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
1775 "list[current_player;main;0,4.85;8,1;]" ..
1776 "list[current_player;main;0,6.08;8,3;8]" ..
1777 "listring[nodemeta:" .. spos .. ";main]" ..
1778 "listring[current_player;main]" ..
1779 default.get_hotbar_bg(0,4.85)
1783 local function chest_lid_obstructed(pos)
1784 local above = {x = pos.x, y = pos.y + 1, z = pos.z}
1785 local def = minetest.registered_nodes[minetest.get_node(above).name]
1786 -- allow ladders, signs, wallmounted things and torches to not obstruct
1788 (def.drawtype == "airlike" or
1789 def.drawtype == "signlike" or
1790 def.drawtype == "torchlike" or
1791 (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
1797 local open_chests = {}
1799 local function chest_lid_close(pn)
1800 local pos = open_chests[pn].pos
1801 local sound = open_chests[pn].sound
1802 local swap = open_chests[pn].swap
1804 open_chests[pn] = nil
1805 for k, v in pairs(open_chests) do
1806 if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
1811 local node = minetest.get_node(pos)
1812 minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
1813 param2 = node.param2 })
1814 minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
1817 minetest.register_on_player_receive_fields(function(player, formname, fields)
1818 if formname ~= "default:chest" then
1821 if not player or not fields.quit then
1824 local pn = player:get_player_name()
1826 if not open_chests[pn] then
1834 minetest.register_on_leaveplayer(function(player)
1835 local pn = player:get_player_name()
1836 if open_chests[pn] then
1841 function default.register_chest(name, d)
1842 local def = table.copy(d)
1843 def.drawtype = "mesh"
1845 def.paramtype = "light"
1846 def.paramtype2 = "facedir"
1847 def.legacy_facedir_simple = true
1848 def.is_ground_content = false
1850 if def.protected then
1851 def.on_construct = function(pos)
1852 local meta = minetest.get_meta(pos)
1853 meta:set_string("infotext", "Locked Chest")
1854 meta:set_string("owner", "")
1855 local inv = meta:get_inventory()
1856 inv:set_size("main", 8*4)
1858 def.after_place_node = function(pos, placer)
1859 local meta = minetest.get_meta(pos)
1860 meta:set_string("owner", placer:get_player_name() or "")
1861 meta:set_string("infotext", "Locked Chest (owned by " ..
1862 meta:get_string("owner") .. ")")
1864 def.can_dig = function(pos,player)
1865 local meta = minetest.get_meta(pos);
1866 local inv = meta:get_inventory()
1867 return inv:is_empty("main") and
1868 default.can_interact_with_node(player, pos)
1870 def.allow_metadata_inventory_move = function(pos, from_list, from_index,
1871 to_list, to_index, count, player)
1872 if not default.can_interact_with_node(player, pos) then
1877 def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
1878 if not default.can_interact_with_node(player, pos) then
1881 return stack:get_count()
1883 def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
1884 if not default.can_interact_with_node(player, pos) then
1887 return stack:get_count()
1889 def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
1890 if not default.can_interact_with_node(clicker, pos) then
1894 minetest.sound_play(def.sound_open, {gain = 0.3,
1895 pos = pos, max_hear_distance = 10})
1896 if not chest_lid_obstructed(pos) then
1897 minetest.swap_node(pos,
1898 { name = "default:" .. name .. "_open",
1899 param2 = node.param2 })
1901 minetest.after(0.2, minetest.show_formspec,
1902 clicker:get_player_name(),
1903 "default:chest", get_chest_formspec(pos))
1904 open_chests[clicker:get_player_name()] = { pos = pos,
1905 sound = def.sound_close, swap = name }
1907 def.on_blast = function() end
1908 def.on_key_use = function(pos, player)
1909 local secret = minetest.get_meta(pos):get_string("key_lock_secret")
1910 local itemstack = player:get_wielded_item()
1911 local key_meta = itemstack:get_meta()
1913 if key_meta:get_string("secret") == "" then
1914 key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
1915 itemstack:set_metadata("")
1918 if secret ~= key_meta:get_string("secret") then
1922 minetest.show_formspec(
1923 player:get_player_name(),
1924 "default:chest_locked",
1925 get_chest_formspec(pos)
1928 def.on_skeleton_key_use = function(pos, player, newsecret)
1929 local meta = minetest.get_meta(pos)
1930 local owner = meta:get_string("owner")
1931 local pn = player:get_player_name()
1933 -- verify placer is owner of lockable chest
1935 minetest.record_protection_violation(pos, pn)
1936 minetest.chat_send_player(pn, "You do not own this chest.")
1940 local secret = meta:get_string("key_lock_secret")
1941 if secret == "" then
1943 meta:set_string("key_lock_secret", secret)
1946 return secret, "a locked chest", owner
1949 def.on_construct = function(pos)
1950 local meta = minetest.get_meta(pos)
1951 meta:set_string("infotext", "Chest")
1952 local inv = meta:get_inventory()
1953 inv:set_size("main", 8*4)
1955 def.can_dig = function(pos,player)
1956 local meta = minetest.get_meta(pos);
1957 local inv = meta:get_inventory()
1958 return inv:is_empty("main")
1960 def.on_rightclick = function(pos, node, clicker)
1961 minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
1962 max_hear_distance = 10})
1963 if not chest_lid_obstructed(pos) then
1964 minetest.swap_node(pos, {
1965 name = "default:" .. name .. "_open",
1966 param2 = node.param2 })
1968 minetest.after(0.2, minetest.show_formspec,
1969 clicker:get_player_name(),
1970 "default:chest", get_chest_formspec(pos))
1971 open_chests[clicker:get_player_name()] = { pos = pos,
1972 sound = def.sound_close, swap = name }
1974 def.on_blast = function(pos)
1976 default.get_inventory_drops(pos, "main", drops)
1977 drops[#drops+1] = "default:" .. name
1978 minetest.remove_node(pos)
1983 def.on_metadata_inventory_move = function(pos, from_list, from_index,
1984 to_list, to_index, count, player)
1985 minetest.log("action", player:get_player_name() ..
1986 " moves stuff in chest at " .. minetest.pos_to_string(pos))
1988 def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
1989 minetest.log("action", player:get_player_name() ..
1990 " moves " .. stack:get_name() ..
1991 " to chest at " .. minetest.pos_to_string(pos))
1993 def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
1994 minetest.log("action", player:get_player_name() ..
1995 " takes " .. stack:get_name() ..
1996 " from chest at " .. minetest.pos_to_string(pos))
1999 local def_opened = table.copy(def)
2000 local def_closed = table.copy(def)
2002 def_opened.mesh = "chest_open.obj"
2003 for i = 1, #def_opened.tiles do
2004 if type(def_opened.tiles[i]) == "string" then
2005 def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true}
2006 elseif def_opened.tiles[i].backface_culling == nil then
2007 def_opened.tiles[i].backface_culling = true
2010 def_opened.drop = "default:" .. name
2011 def_opened.groups.not_in_creative_inventory = 1
2012 def_opened.selection_box = {
2014 fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
2016 def_opened.can_dig = function()
2019 def_opened.on_blast = function() end
2021 def_closed.mesh = nil
2022 def_closed.drawtype = nil
2023 def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal"
2024 def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh
2025 def_closed.tiles[3] = def.tiles[3].."^[transformFX"
2027 minetest.register_node("default:" .. name, def_closed)
2028 minetest.register_node("default:" .. name .. "_open", def_opened)
2030 -- convert old chests to this new variant
2031 minetest.register_lbm({
2032 label = "update chests to opening chests",
2033 name = "default:upgrade_" .. name .. "_v2",
2034 nodenames = {"default:" .. name},
2035 action = function(pos, node)
2036 local meta = minetest.get_meta(pos)
2037 meta:set_string("formspec", nil)
2038 local inv = meta:get_inventory()
2039 local list = inv:get_list("default:chest")
2041 inv:set_size("main", 8*4)
2042 inv:set_list("main", list)
2043 inv:set_list("default:chest", nil)
2050 default.register_chest("chest", {
2051 description = "Chest",
2053 "default_chest_top.png",
2054 "default_chest_top.png",
2055 "default_chest_side.png",
2056 "default_chest_side.png",
2057 "default_chest_front.png",
2058 "default_chest_inside.png"
2060 sounds = default.node_sound_wood_defaults(),
2061 sound_open = "default_chest_open",
2062 sound_close = "default_chest_close",
2063 groups = {choppy = 2, oddly_breakable_by_hand = 2},
2066 default.register_chest("chest_locked", {
2067 description = "Locked Chest",
2069 "default_chest_top.png",
2070 "default_chest_top.png",
2071 "default_chest_side.png",
2072 "default_chest_side.png",
2073 "default_chest_lock.png",
2074 "default_chest_inside.png"
2076 sounds = default.node_sound_wood_defaults(),
2077 sound_open = "default_chest_open",
2078 sound_close = "default_chest_close",
2079 groups = {choppy = 2, oddly_breakable_by_hand = 2},
2083 local bookshelf_formspec =
2086 default.gui_bg_img ..
2087 default.gui_slots ..
2088 "list[context;books;0,0.3;8,2;]" ..
2089 "list[current_player;main;0,2.85;8,1;]" ..
2090 "list[current_player;main;0,4.08;8,3;8]" ..
2091 "listring[context;books]" ..
2092 "listring[current_player;main]" ..
2093 default.get_hotbar_bg(0,2.85)
2095 local function get_bookshelf_formspec(inv)
2096 local formspec = bookshelf_formspec
2097 local invlist = inv and inv:get_list("books")
2098 -- Inventory slots overlay
2099 local bx, by = 0, 0.3
2105 if not invlist or invlist[i]:is_empty() then
2106 formspec = formspec ..
2107 "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]"
2114 minetest.register_node("default:bookshelf", {
2115 description = "Bookshelf",
2116 tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
2117 "default_wood.png", "default_bookshelf.png", "default_bookshelf.png"},
2118 paramtype2 = "facedir",
2119 is_ground_content = false,
2120 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2121 sounds = default.node_sound_wood_defaults(),
2123 on_construct = function(pos)
2124 local meta = minetest.get_meta(pos)
2125 meta:set_string("formspec", get_bookshelf_formspec(nil))
2126 local inv = meta:get_inventory()
2127 inv:set_size("books", 8 * 2)
2129 can_dig = function(pos,player)
2130 local inv = minetest.get_meta(pos):get_inventory()
2131 return inv:is_empty("books")
2133 allow_metadata_inventory_put = function(pos, listname, index, stack)
2134 if minetest.get_item_group(stack:get_name(), "book") ~= 0 then
2135 return stack:get_count()
2139 on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
2140 minetest.log("action", player:get_player_name() ..
2141 " moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
2142 local meta = minetest.get_meta(pos)
2143 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2145 on_metadata_inventory_put = function(pos, listname, index, stack, player)
2146 minetest.log("action", player:get_player_name() ..
2147 " moves stuff to bookshelf at " .. minetest.pos_to_string(pos))
2148 local meta = minetest.get_meta(pos)
2149 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2151 on_metadata_inventory_take = function(pos, listname, index, stack, player)
2152 minetest.log("action", player:get_player_name() ..
2153 " takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
2154 local meta = minetest.get_meta(pos)
2155 meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory()))
2157 on_blast = function(pos)
2159 default.get_inventory_drops(pos, "books", drops)
2160 drops[#drops+1] = "default:bookshelf"
2161 minetest.remove_node(pos)
2166 local function register_sign(material, desc, def)
2167 minetest.register_node("default:sign_wall_" .. material, {
2168 description = desc .. " Sign",
2169 drawtype = "nodebox",
2170 tiles = {"default_sign_wall_" .. material .. ".png"},
2171 inventory_image = "default_sign_" .. material .. ".png",
2172 wield_image = "default_sign_" .. material .. ".png",
2173 paramtype = "light",
2174 paramtype2 = "wallmounted",
2175 sunlight_propagates = true,
2176 is_ground_content = false,
2179 type = "wallmounted",
2180 wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
2181 wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
2182 wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
2184 groups = def.groups,
2185 legacy_wallmounted = true,
2186 sounds = def.sounds,
2188 on_construct = function(pos)
2189 --local n = minetest.get_node(pos)
2190 local meta = minetest.get_meta(pos)
2191 meta:set_string("formspec", "field[text;;${text}]")
2193 on_receive_fields = function(pos, formname, fields, sender)
2194 --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
2195 local player_name = sender:get_player_name()
2196 if minetest.is_protected(pos, player_name) then
2197 minetest.record_protection_violation(pos, player_name)
2200 local meta = minetest.get_meta(pos)
2201 if not fields.text then return end
2202 minetest.log("action", (player_name or "") .. " wrote \"" ..
2203 fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
2204 meta:set_string("text", fields.text)
2205 meta:set_string("infotext", '"' .. fields.text .. '"')
2210 register_sign("wood", "Wooden", {
2211 sounds = default.node_sound_wood_defaults(),
2212 groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
2215 register_sign("steel", "Steel", {
2216 sounds = default.node_sound_metal_defaults(),
2217 groups = {cracky = 2, attached_node = 1}
2220 minetest.register_node("default:ladder_wood", {
2221 description = "Wooden Ladder",
2222 drawtype = "signlike",
2223 tiles = {"default_ladder_wood.png"},
2224 inventory_image = "default_ladder_wood.png",
2225 wield_image = "default_ladder_wood.png",
2226 paramtype = "light",
2227 paramtype2 = "wallmounted",
2228 sunlight_propagates = true,
2231 is_ground_content = false,
2233 type = "wallmounted",
2234 --wall_top = = <default>
2235 --wall_bottom = = <default>
2236 --wall_side = = <default>
2238 groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2},
2239 legacy_wallmounted = true,
2240 sounds = default.node_sound_wood_defaults(),
2243 minetest.register_node("default:ladder_steel", {
2244 description = "Steel Ladder",
2245 drawtype = "signlike",
2246 tiles = {"default_ladder_steel.png"},
2247 inventory_image = "default_ladder_steel.png",
2248 wield_image = "default_ladder_steel.png",
2249 paramtype = "light",
2250 paramtype2 = "wallmounted",
2251 sunlight_propagates = true,
2254 is_ground_content = false,
2256 type = "wallmounted",
2257 --wall_top = = <default>
2258 --wall_bottom = = <default>
2259 --wall_side = = <default>
2261 groups = {cracky = 2},
2262 sounds = default.node_sound_metal_defaults(),
2265 default.register_fence("default:fence_wood", {
2266 description = "Wooden Fence",
2267 texture = "default_fence_wood.png",
2268 inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2269 wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2270 material = "default:wood",
2271 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2272 sounds = default.node_sound_wood_defaults()
2275 default.register_fence("default:fence_acacia_wood", {
2276 description = "Acacia Fence",
2277 texture = "default_fence_acacia_wood.png",
2278 inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2279 wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2280 material = "default:acacia_wood",
2281 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2282 sounds = default.node_sound_wood_defaults()
2285 default.register_fence("default:fence_junglewood", {
2286 description = "Jungle Wood Fence",
2287 texture = "default_fence_junglewood.png",
2288 inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
2289 wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
2290 material = "default:junglewood",
2291 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2292 sounds = default.node_sound_wood_defaults()
2295 default.register_fence("default:fence_pine_wood", {
2296 description = "Pine Fence",
2297 texture = "default_fence_pine_wood.png",
2298 inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2299 wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2300 material = "default:pine_wood",
2301 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2302 sounds = default.node_sound_wood_defaults()
2305 default.register_fence("default:fence_aspen_wood", {
2306 description = "Aspen Fence",
2307 texture = "default_fence_aspen_wood.png",
2308 inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2309 wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
2310 material = "default:aspen_wood",
2311 groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
2312 sounds = default.node_sound_wood_defaults()
2315 minetest.register_node("default:glass", {
2316 description = "Glass",
2317 drawtype = "glasslike_framed_optional",
2318 tiles = {"default_glass.png", "default_glass_detail.png"},
2319 paramtype = "light",
2320 paramtype2 = "glasslikeliquidlevel",
2321 sunlight_propagates = true,
2322 is_ground_content = false,
2323 groups = {cracky = 3, oddly_breakable_by_hand = 3},
2324 sounds = default.node_sound_glass_defaults(),
2327 minetest.register_node("default:obsidian_glass", {
2328 description = "Obsidian Glass",
2329 drawtype = "glasslike_framed_optional",
2330 tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
2331 paramtype = "light",
2332 paramtype2 = "glasslikeliquidlevel",
2333 is_ground_content = false,
2334 sunlight_propagates = true,
2335 sounds = default.node_sound_glass_defaults(),
2336 groups = {cracky = 3},
2340 minetest.register_node("default:brick", {
2341 description = "Brick Block",
2342 paramtype2 = "facedir",
2344 tiles = {"default_brick.png"},
2345 is_ground_content = false,
2346 groups = {cracky = 3},
2347 sounds = default.node_sound_stone_defaults(),
2351 minetest.register_node("default:meselamp", {
2352 description = "Mese Lamp",
2353 drawtype = "glasslike",
2354 tiles = {"default_meselamp.png"},
2355 paramtype = "light",
2356 sunlight_propagates = true,
2357 is_ground_content = false,
2358 groups = {cracky = 3, oddly_breakable_by_hand = 3},
2359 sounds = default.node_sound_glass_defaults(),
2360 light_source = default.LIGHT_MAX,
2363 minetest.register_node("default:mese_post_light", {
2364 description = "Mese Post Light",
2365 tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png",
2366 "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png",
2367 "default_mese_post_light_side.png", "default_mese_post_light_side.png"},
2368 wield_image = "default_mese_post_light_side.png",
2369 drawtype = "nodebox",
2373 {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16},
2376 paramtype = "light",
2377 light_source = default.LIGHT_MAX,
2378 sunlight_propagates = true,
2379 is_ground_content = false,
2380 groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
2381 sounds = default.node_sound_wood_defaults(),
2388 minetest.register_node("default:cloud", {
2389 description = "Cloud",
2390 tiles = {"default_cloud.png"},
2391 is_ground_content = false,
2392 sounds = default.node_sound_defaults(),
2393 groups = {not_in_creative_inventory = 1},
2397 -- register trees for leafdecay
2400 if minetest.get_mapgen_setting("mg_name") == "v6" then
2401 default.register_leafdecay({
2402 trunks = {"default:tree"},
2403 leaves = {"default:apple", "default:leaves"},
2407 default.register_leafdecay({
2408 trunks = {"default:jungletree"},
2409 leaves = {"default:jungleleaves"},
2413 default.register_leafdecay({
2414 trunks = {"default:pine_tree"},
2415 leaves = {"default:pine_needles"},
2419 default.register_leafdecay({
2420 trunks = {"default:tree"},
2421 leaves = {"default:apple", "default:leaves"},
2425 default.register_leafdecay({
2426 trunks = {"default:jungletree"},
2427 leaves = {"default:jungleleaves"},
2431 default.register_leafdecay({
2432 trunks = {"default:pine_tree"},
2433 leaves = {"default:pine_needles"},
2438 default.register_leafdecay({
2439 trunks = {"default:acacia_tree"},
2440 leaves = {"default:acacia_leaves"},
2444 default.register_leafdecay({
2445 trunks = {"default:aspen_tree"},
2446 leaves = {"default:aspen_leaves"},
2450 default.register_leafdecay({
2451 trunks = {"default:bush_stem"},
2452 leaves = {"default:bush_leaves"},
2456 default.register_leafdecay({
2457 trunks = {"default:acacia_bush_stem"},
2458 leaves = {"default:acacia_bush_leaves"},