1 -- default (Minetest 0.4 mod)
4 -- The API documentation in here was moved into doc/lua_api.txt
11 -- Definitions made by this mod that other mods can use too
19 minetest.register_item(":", {
21 wield_image = "wieldhand.png",
22 wield_scale = {x=1,y=1,z=2.5},
24 full_punch_interval = 1.0,
27 fleshy = {times={[2]=2.00, [3]=1.00}, maxwear=0, maxlevel=1},
28 crumbly = {times={[3]=0.70}, maxwear=0, maxlevel=1},
29 snappy = {times={[3]=0.40}, maxwear=0, maxlevel=1},
30 oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, maxwear=0, maxlevel=3},
35 minetest.register_tool("default:pick_wood", {
36 description = "Wooden Pickaxe",
37 inventory_image = "default_tool_woodpick.png",
41 cracky={times={[2]=1.50, [3]=0.80}, maxwear=0.1, maxlevel=1}
45 minetest.register_tool("default:pick_stone", {
46 description = "Stone Pickaxe",
47 inventory_image = "default_tool_stonepick.png",
51 cracky={times={[1]=1.50, [2]=0.80, [3]=0.60}, maxwear=0.05, maxlevel=1}
55 minetest.register_tool("default:pick_steel", {
56 description = "Steel Pickaxe",
57 inventory_image = "default_tool_steelpick.png",
61 cracky={times={[1]=1.00, [2]=0.60, [3]=0.40}, maxwear=0.1, maxlevel=2}
65 minetest.register_tool("default:pick_mese", {
66 description = "Mese Pickaxe",
67 inventory_image = "default_tool_mesepick.png",
69 full_punch_interval = 1.0,
72 cracky={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3},
73 crumbly={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3},
74 snappy={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3}
78 minetest.register_tool("default:shovel_wood", {
79 description = "Wooden Shovel",
80 inventory_image = "default_tool_woodshovel.png",
84 crumbly={times={[1]=1.50, [2]=0.80, [3]=0.50}, maxwear=0.1, maxlevel=1}
88 minetest.register_tool("default:shovel_stone", {
89 description = "Stone Shovel",
90 inventory_image = "default_tool_stoneshovel.png",
94 crumbly={times={[1]=0.80, [2]=0.50, [3]=0.30}, maxwear=0.05, maxlevel=1}
98 minetest.register_tool("default:shovel_steel", {
99 description = "Steel Shovel",
100 inventory_image = "default_tool_steelshovel.png",
101 tool_capabilities = {
104 crumbly={times={[1]=0.50, [2]=0.35, [3]=0.30}, maxwear=0.1, maxlevel=2}
108 minetest.register_tool("default:axe_wood", {
109 description = "Wooden Axe",
110 inventory_image = "default_tool_woodaxe.png",
111 tool_capabilities = {
114 choppy={times={[2]=1.40, [3]=0.80}, maxwear=0.1, maxlevel=1},
115 fleshy={times={[2]=1.50, [3]=0.80}, maxwear=0.1, maxlevel=1}
119 minetest.register_tool("default:axe_stone", {
120 description = "Stone Axe",
121 inventory_image = "default_tool_stoneaxe.png",
122 tool_capabilities = {
125 choppy={times={[1]=1.50, [2]=1.00, [3]=0.60}, maxwear=0.05, maxlevel=1},
126 fleshy={times={[2]=1.30, [3]=0.70}, maxwear=0.05, maxlevel=1}
130 minetest.register_tool("default:axe_steel", {
131 description = "Steel Axe",
132 inventory_image = "default_tool_steelaxe.png",
133 tool_capabilities = {
136 choppy={times={[1]=1.00, [2]=0.80, [3]=0.50}, maxwear=0.1, maxlevel=2},
137 fleshy={times={[2]=1.10, [3]=0.60}, maxwear=0.03, maxlevel=1}
141 minetest.register_tool("default:sword_wood", {
142 description = "Wooden Sword",
143 inventory_image = "default_tool_woodsword.png",
144 tool_capabilities = {
145 full_punch_interval = 1.0,
148 fleshy={times={[2]=1.10, [3]=0.60}, maxwear=0.1, maxlevel=1},
149 snappy={times={[2]=1.00, [3]=0.50}, maxwear=0.1, maxlevel=1},
150 choppy={times={[3]=1.00}, maxwear=0.05, maxlevel=0}
154 minetest.register_tool("default:sword_stone", {
155 description = "Stone Sword",
156 inventory_image = "default_tool_stonesword.png",
157 tool_capabilities = {
158 full_punch_interval = 1.0,
161 fleshy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1},
162 snappy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1},
163 choppy={times={[3]=0.90}, maxwear=0.05, maxlevel=0}
167 minetest.register_tool("default:sword_steel", {
168 description = "Steel Sword",
169 inventory_image = "default_tool_steelsword.png",
170 tool_capabilities = {
171 full_punch_interval = 1.0,
174 fleshy={times={[1]=1.00, [2]=0.40, [3]=0.20}, maxwear=0.1, maxlevel=2},
175 snappy={times={[2]=0.70, [3]=0.30}, maxwear=0.03, maxlevel=1},
176 choppy={times={[3]=0.70}, maxwear=0.03, maxlevel=0}
182 -- Crafting definition
185 minetest.register_craft({
186 output = 'default:wood 4',
192 minetest.register_craft({
193 output = 'default:stick 4',
199 minetest.register_craft({
200 output = 'default:fence_wood 2',
202 {'default:stick', 'default:stick', 'default:stick'},
203 {'default:stick', 'default:stick', 'default:stick'},
207 minetest.register_craft({
208 output = 'default:sign_wall',
210 {'default:wood', 'default:wood', 'default:wood'},
211 {'default:wood', 'default:wood', 'default:wood'},
212 {'', 'default:stick', ''},
216 minetest.register_craft({
217 output = 'default:torch 4',
219 {'default:coal_lump'},
224 minetest.register_craft({
225 output = 'default:pick_wood',
227 {'default:wood', 'default:wood', 'default:wood'},
228 {'', 'default:stick', ''},
229 {'', 'default:stick', ''},
233 minetest.register_craft({
234 output = 'default:pick_stone',
236 {'default:cobble', 'default:cobble', 'default:cobble'},
237 {'', 'default:stick', ''},
238 {'', 'default:stick', ''},
242 minetest.register_craft({
243 output = 'default:pick_steel',
245 {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
246 {'', 'default:stick', ''},
247 {'', 'default:stick', ''},
251 minetest.register_craft({
252 output = 'default:pick_mese',
254 {'default:mese', 'default:mese', 'default:mese'},
255 {'', 'default:stick', ''},
256 {'', 'default:stick', ''},
260 minetest.register_craft({
261 output = 'default:shovel_wood',
269 minetest.register_craft({
270 output = 'default:shovel_stone',
278 minetest.register_craft({
279 output = 'default:shovel_steel',
281 {'default:steel_ingot'},
287 minetest.register_craft({
288 output = 'default:axe_wood',
290 {'default:wood', 'default:wood'},
291 {'default:wood', 'default:stick'},
292 {'', 'default:stick'},
296 minetest.register_craft({
297 output = 'default:axe_stone',
299 {'default:cobble', 'default:cobble'},
300 {'default:cobble', 'default:stick'},
301 {'', 'default:stick'},
305 minetest.register_craft({
306 output = 'default:axe_steel',
308 {'default:steel_ingot', 'default:steel_ingot'},
309 {'default:steel_ingot', 'default:stick'},
310 {'', 'default:stick'},
314 minetest.register_craft({
315 output = 'default:sword_wood',
323 minetest.register_craft({
324 output = 'default:sword_stone',
332 minetest.register_craft({
333 output = 'default:sword_steel',
335 {'default:steel_ingot'},
336 {'default:steel_ingot'},
341 minetest.register_craft({
342 output = 'default:rail 15',
344 {'default:steel_ingot', '', 'default:steel_ingot'},
345 {'default:steel_ingot', 'default:stick', 'default:steel_ingot'},
346 {'default:steel_ingot', '', 'default:steel_ingot'},
350 minetest.register_craft({
351 output = 'default:chest',
353 {'default:wood', 'default:wood', 'default:wood'},
354 {'default:wood', '', 'default:wood'},
355 {'default:wood', 'default:wood', 'default:wood'},
359 minetest.register_craft({
360 output = 'default:chest_locked',
362 {'default:wood', 'default:wood', 'default:wood'},
363 {'default:wood', 'default:steel_ingot', 'default:wood'},
364 {'default:wood', 'default:wood', 'default:wood'},
368 minetest.register_craft({
369 output = 'default:furnace',
371 {'default:cobble', 'default:cobble', 'default:cobble'},
372 {'default:cobble', '', 'default:cobble'},
373 {'default:cobble', 'default:cobble', 'default:cobble'},
377 minetest.register_craft({
378 output = 'default:steelblock',
380 {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
381 {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
382 {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
386 minetest.register_craft({
387 output = 'default:sandstone',
389 {'default:sand', 'default:sand'},
390 {'default:sand', 'default:sand'},
394 minetest.register_craft({
395 output = 'default:clay',
397 {'default:clay_lump', 'default:clay_lump'},
398 {'default:clay_lump', 'default:clay_lump'},
402 minetest.register_craft({
403 output = 'default:brick',
405 {'default:clay_brick', 'default:clay_brick'},
406 {'default:clay_brick', 'default:clay_brick'},
410 minetest.register_craft({
411 output = 'default:paper',
413 {'default:papyrus', 'default:papyrus', 'default:papyrus'},
417 minetest.register_craft({
418 output = 'default:book',
426 minetest.register_craft({
427 output = 'default:bookshelf',
429 {'default:wood', 'default:wood', 'default:wood'},
430 {'default:book', 'default:book', 'default:book'},
431 {'default:wood', 'default:wood', 'default:wood'},
435 minetest.register_craft({
436 output = 'default:ladder',
438 {'default:stick', '', 'default:stick'},
439 {'default:stick', 'default:stick', 'default:stick'},
440 {'default:stick', '', 'default:stick'},
445 -- Crafting (tool repair)
447 minetest.register_craft({
449 additional_wear = -0.02,
456 minetest.register_craft({
458 output = "default:glass",
459 recipe = "default:sand",
462 minetest.register_craft({
464 output = "default:coal_lump",
465 recipe = "default:tree",
468 minetest.register_craft({
470 output = "default:coal_lump",
471 recipe = "default:jungletree",
474 minetest.register_craft({
476 output = "default:stone",
477 recipe = "default:cobble",
480 minetest.register_craft({
482 output = "default:steel_ingot",
483 recipe = "default:iron_lump",
486 minetest.register_craft({
488 output = "default:clay_brick",
489 recipe = "default:clay_lump",
496 minetest.register_craft({
498 recipe = "default:tree",
502 minetest.register_craft({
504 recipe = "default:jungletree",
508 minetest.register_craft({
510 recipe = "default:junglegrass",
514 minetest.register_craft({
516 recipe = "default:leaves",
520 minetest.register_craft({
522 recipe = "default:cactus",
526 minetest.register_craft({
528 recipe = "default:papyrus",
532 minetest.register_craft({
534 recipe = "default:bookshelf",
538 minetest.register_craft({
540 recipe = "default:fence_wood",
544 minetest.register_craft({
546 recipe = "default:ladder",
550 minetest.register_craft({
552 recipe = "default:wood",
556 minetest.register_craft({
558 recipe = "default:mese",
562 minetest.register_craft({
564 recipe = "default:lava_source",
568 minetest.register_craft({
570 recipe = "default:torch",
574 minetest.register_craft({
576 recipe = "default:sign_wall",
580 minetest.register_craft({
582 recipe = "default:chest",
586 minetest.register_craft({
588 recipe = "default:chest_locked",
592 minetest.register_craft({
594 recipe = "default:nyancat",
598 minetest.register_craft({
600 recipe = "default:nyancat_rainbow",
604 minetest.register_craft({
606 recipe = "default:sapling",
610 minetest.register_craft({
612 recipe = "default:apple",
616 minetest.register_craft({
618 recipe = "default:coal_lump",
626 -- Default node sounds
628 function default.node_sound_defaults(table)
630 table.footstep = table.footstep or
632 table.dug = table.dug or
633 {name="default_dug_node", gain=1.0}
637 function default.node_sound_stone_defaults(table)
639 table.footstep = table.footstep or
640 {name="default_hard_footstep", gain=0.2}
641 default.node_sound_defaults(table)
645 function default.node_sound_dirt_defaults(table)
647 table.footstep = table.footstep or
649 --table.dug = table.dug or
650 -- {name="default_dirt_break", gain=0.5}
651 default.node_sound_defaults(table)
655 function default.node_sound_sand_defaults(table)
657 table.footstep = table.footstep or
658 {name="default_grass_footstep", gain=0.25}
659 --table.dug = table.dug or
660 -- {name="default_dirt_break", gain=0.25}
661 table.dug = table.dug or
663 default.node_sound_defaults(table)
667 function default.node_sound_wood_defaults(table)
669 table.footstep = table.footstep or
670 {name="default_hard_footstep", gain=0.3}
671 default.node_sound_defaults(table)
675 function default.node_sound_leaves_defaults(table)
677 table.footstep = table.footstep or
678 {name="default_grass_footstep", gain=0.25}
679 table.dig = table.dig or
680 {name="default_dig_crumbly", gain=0.4}
681 table.dug = table.dug or
683 default.node_sound_defaults(table)
687 function default.node_sound_glass_defaults(table)
689 table.footstep = table.footstep or
690 {name="default_stone_footstep", gain=0.25}
691 table.dug = table.dug or
692 {name="default_break_glass", gain=1.0}
693 default.node_sound_defaults(table)
699 minetest.register_node("default:stone", {
700 description = "Stone",
701 tile_images = {"default_stone.png"},
702 is_ground_content = true,
704 drop = 'default:cobble',
705 legacy_mineral = true,
706 sounds = default.node_sound_stone_defaults(),
709 minetest.register_node("default:stone_with_coal", {
710 description = "Stone with coal",
711 tile_images = {"default_stone.png^default_mineral_coal.png"},
712 is_ground_content = true,
714 drop = 'default:coal_lump',
715 sounds = default.node_sound_stone_defaults(),
718 minetest.register_node("default:stone_with_iron", {
719 description = "Stone with iron",
720 tile_images = {"default_stone.png^default_mineral_iron.png"},
721 is_ground_content = true,
723 drop = 'default:iron_lump',
724 sounds = default.node_sound_stone_defaults(),
727 minetest.register_node("default:dirt_with_grass", {
728 description = "Dirt with grass",
729 tile_images = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
730 is_ground_content = true,
731 groups = {crumbly=3},
732 drop = 'default:dirt',
733 sounds = default.node_sound_dirt_defaults({
734 footstep = {name="default_grass_footstep", gain=0.4},
738 minetest.register_node("default:dirt_with_grass_footsteps", {
739 description = "Dirt with grass and footsteps",
740 tile_images = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
741 is_ground_content = true,
742 groups = {crumbly=3},
743 drop = 'default:dirt',
744 sounds = default.node_sound_dirt_defaults({
745 footstep = {name="default_grass_footstep", gain=0.4},
749 minetest.register_node("default:dirt", {
750 description = "Dirt",
751 tile_images = {"default_dirt.png"},
752 is_ground_content = true,
753 groups = {crumbly=3},
754 sounds = default.node_sound_dirt_defaults(),
757 minetest.register_node("default:sand", {
758 description = "Sand",
759 tile_images = {"default_sand.png"},
760 is_ground_content = true,
761 groups = {crumbly=3},
762 sounds = default.node_sound_sand_defaults(),
765 minetest.register_node("default:gravel", {
766 description = "Gravel",
767 tile_images = {"default_gravel.png"},
768 is_ground_content = true,
769 groups = {crumbly=2},
770 sounds = default.node_sound_dirt_defaults({
771 footstep = {name="default_gravel_footstep", gain=0.45},
775 minetest.register_node("default:sandstone", {
776 description = "Sandstone",
777 tile_images = {"default_sandstone.png"},
778 is_ground_content = true,
779 groups = {crumbly=2,cracky=2},
780 drop = 'default:sand',
781 sounds = default.node_sound_stone_defaults(),
784 minetest.register_node("default:clay", {
785 description = "Clay",
786 tile_images = {"default_clay.png"},
787 is_ground_content = true,
788 groups = {crumbly=3},
789 drop = 'default:clay_lump 4',
790 sounds = default.node_sound_dirt_defaults({
795 minetest.register_node("default:brick", {
796 description = "Brick",
797 tile_images = {"default_brick.png"},
798 is_ground_content = true,
800 drop = 'default:clay_brick 4',
801 sounds = default.node_sound_stone_defaults(),
804 minetest.register_node("default:tree", {
805 description = "Tree",
806 tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
807 is_ground_content = true,
808 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=1},
809 sounds = default.node_sound_wood_defaults(),
812 minetest.register_node("default:jungletree", {
813 description = "Jungle Tree",
814 tile_images = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
815 is_ground_content = true,
816 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=1},
817 sounds = default.node_sound_wood_defaults(),
820 minetest.register_node("default:junglegrass", {
821 description = "Jungle Grass",
822 drawtype = "plantlike",
824 tile_images = {"default_junglegrass.png"},
825 inventory_image = "default_junglegrass.png",
826 wield_image = "default_junglegrass.png",
830 sounds = default.node_sound_leaves_defaults(),
833 minetest.register_node("default:leaves", {
834 description = "Leaves",
835 drawtype = "allfaces_optional",
837 tile_images = {"default_leaves.png"},
844 -- player will get sapling with 1/20 chance
845 items = {'default:sapling'},
849 -- player will get leaves only if he get no saplings,
850 -- this is because max_items is 1
851 items = {'default:leaves'},
855 sounds = default.node_sound_leaves_defaults(),
858 minetest.register_node("default:cactus", {
859 description = "Cactus",
860 tile_images = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
861 is_ground_content = true,
862 groups = {snappy=2,choppy=3},
863 sounds = default.node_sound_wood_defaults(),
866 minetest.register_node("default:papyrus", {
867 description = "Papyrus",
868 drawtype = "plantlike",
869 tile_images = {"default_papyrus.png"},
870 inventory_image = "default_papyrus.png",
871 wield_image = "default_papyrus.png",
873 is_ground_content = true,
876 sounds = default.node_sound_leaves_defaults(),
879 minetest.register_node("default:bookshelf", {
880 description = "Bookshelf",
881 tile_images = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
882 is_ground_content = true,
883 groups = {snappy=2,choppy=3,oddly_breakable_by_hand=2},
884 sounds = default.node_sound_wood_defaults(),
887 minetest.register_node("default:glass", {
888 description = "Glass",
889 drawtype = "glasslike",
890 tile_images = {"default_glass.png"},
891 inventory_image = minetest.inventorycube("default_glass.png"),
893 sunlight_propagates = true,
894 is_ground_content = true,
895 groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
896 sounds = default.node_sound_glass_defaults(),
899 minetest.register_node("default:fence_wood", {
900 description = "Wooden Fence",
901 drawtype = "fencelike",
902 tile_images = {"default_wood.png"},
903 inventory_image = "default_fence.png",
904 wield_image = "default_fence.png",
906 is_ground_content = true,
909 fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
911 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
912 sounds = default.node_sound_wood_defaults(),
915 minetest.register_node("default:rail", {
916 description = "Rail",
917 drawtype = "raillike",
918 tile_images = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
919 inventory_image = "default_rail.png",
920 wield_image = "default_rail.png",
922 is_ground_content = true,
928 groups = {bendy=2,snappy=1,dig_immediate=2},
931 minetest.register_node("default:ladder", {
932 description = "Ladder",
933 drawtype = "signlike",
934 tile_images = {"default_ladder.png"},
935 inventory_image = "default_ladder.png",
936 wield_image = "default_ladder.png",
938 paramtype2 = "wallmounted",
939 is_ground_content = true,
943 type = "wallmounted",
944 --wall_top = = <default>
945 --wall_bottom = = <default>
946 --wall_side = = <default>
948 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3},
949 legacy_wallmounted = true,
950 sounds = default.node_sound_wood_defaults(),
953 minetest.register_node("default:wood", {
954 description = "Wood",
955 tile_images = {"default_wood.png"},
956 is_ground_content = true,
957 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
958 sounds = default.node_sound_wood_defaults(),
961 minetest.register_node("default:mese", {
962 description = "Mese",
963 tile_images = {"default_mese.png"},
964 is_ground_content = true,
966 sounds = default.node_sound_defaults(),
969 minetest.register_node("default:cloud", {
970 description = "Cloud",
971 tile_images = {"default_cloud.png"},
972 is_ground_content = true,
973 sounds = default.node_sound_defaults(),
976 minetest.register_node("default:water_flowing", {
977 description = "Water (flowing)",
978 inventory_image = minetest.inventorycube("default_water.png"),
979 drawtype = "flowingliquid",
980 tile_images = {"default_water.png"},
987 liquidtype = "flowing",
988 liquid_alternative_flowing = "default:water_flowing",
989 liquid_alternative_source = "default:water_source",
990 liquid_viscosity = WATER_VISC,
991 post_effect_color = {a=64, r=100, g=100, b=200},
992 special_materials = {
993 {image="default_water.png", backface_culling=false},
994 {image="default_water.png", backface_culling=true},
996 groups = {water=3, liquid=3},
999 minetest.register_node("default:water_source", {
1000 description = "Water",
1001 inventory_image = minetest.inventorycube("default_water.png"),
1002 drawtype = "liquid",
1003 tile_images = {"default_water.png"},
1004 alpha = WATER_ALPHA,
1005 paramtype = "light",
1009 buildable_to = true,
1010 liquidtype = "source",
1011 liquid_alternative_flowing = "default:water_flowing",
1012 liquid_alternative_source = "default:water_source",
1013 liquid_viscosity = WATER_VISC,
1014 post_effect_color = {a=64, r=100, g=100, b=200},
1015 special_materials = {
1016 -- New-style water source material (mostly unused)
1017 {image="default_water.png", backface_culling=false},
1019 groups = {water=3, liquid=3},
1022 minetest.register_node("default:lava_flowing", {
1023 description = "Lava (flowing)",
1024 inventory_image = minetest.inventorycube("default_lava.png"),
1025 drawtype = "flowingliquid",
1026 tile_images = {"default_lava.png"},
1027 paramtype = "light",
1028 light_source = LIGHT_MAX - 1,
1032 buildable_to = true,
1033 liquidtype = "flowing",
1034 liquid_alternative_flowing = "default:lava_flowing",
1035 liquid_alternative_source = "default:lava_source",
1036 liquid_viscosity = LAVA_VISC,
1037 damage_per_second = 4*2,
1038 post_effect_color = {a=192, r=255, g=64, b=0},
1039 special_materials = {
1040 {image="default_lava.png", backface_culling=false},
1041 {image="default_lava.png", backface_culling=true},
1043 groups = {lava=3, liquid=2, hot=3},
1046 minetest.register_node("default:lava_source", {
1047 description = "Lava",
1048 inventory_image = minetest.inventorycube("default_lava.png"),
1049 drawtype = "liquid",
1050 tile_images = {"default_lava.png"},
1051 paramtype = "light",
1052 light_source = LIGHT_MAX - 1,
1056 buildable_to = true,
1057 liquidtype = "source",
1058 liquid_alternative_flowing = "default:lava_flowing",
1059 liquid_alternative_source = "default:lava_source",
1060 liquid_viscosity = LAVA_VISC,
1061 damage_per_second = 4*2,
1062 post_effect_color = {a=192, r=255, g=64, b=0},
1063 special_materials = {
1064 -- New-style lava source material (mostly unused)
1065 {image="default_lava.png", backface_culling=false},
1067 groups = {lava=3, liquid=2, hot=3},
1070 minetest.register_node("default:torch", {
1071 description = "Torch",
1072 drawtype = "torchlike",
1073 tile_images = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
1074 inventory_image = "default_torch_on_floor.png",
1075 wield_image = "default_torch_on_floor.png",
1076 paramtype = "light",
1077 paramtype2 = "wallmounted",
1078 sunlight_propagates = true,
1080 light_source = LIGHT_MAX-1,
1082 type = "wallmounted",
1083 wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
1084 wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
1085 wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
1087 groups = {choppy=2,dig_immediate=3},
1088 legacy_wallmounted = true,
1089 sounds = default.node_sound_defaults(),
1092 minetest.register_node("default:sign_wall", {
1093 description = "Sign",
1094 drawtype = "signlike",
1095 tile_images = {"default_sign_wall.png"},
1096 inventory_image = "default_sign_wall.png",
1097 wield_image = "default_sign_wall.png",
1098 paramtype = "light",
1099 paramtype2 = "wallmounted",
1100 sunlight_propagates = true,
1102 metadata_name = "sign",
1104 type = "wallmounted",
1105 --wall_top = <default>
1106 --wall_bottom = <default>
1107 --wall_side = <default>
1109 groups = {choppy=2,dig_immediate=2},
1110 legacy_wallmounted = true,
1111 sounds = default.node_sound_defaults(),
1114 minetest.register_node("default:chest", {
1115 description = "Chest",
1116 tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
1117 "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
1118 paramtype2 = "facedir",
1119 metadata_name = "chest",
1120 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
1121 legacy_facedir_simple = true,
1122 sounds = default.node_sound_wood_defaults(),
1125 minetest.register_node("default:chest_locked", {
1126 description = "Locked Chest",
1127 tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
1128 "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
1129 paramtype2 = "facedir",
1130 metadata_name = "locked_chest",
1131 groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
1132 legacy_facedir_simple = true,
1133 sounds = default.node_sound_wood_defaults(),
1136 minetest.register_node("default:furnace", {
1137 description = "Furnace",
1138 tile_images = {"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
1139 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
1140 paramtype2 = "facedir",
1141 metadata_name = "furnace",
1142 groups = {cracky=2},
1143 legacy_facedir_simple = true,
1144 sounds = default.node_sound_stone_defaults(),
1147 minetest.register_node("default:cobble", {
1148 description = "Cobble",
1149 tile_images = {"default_cobble.png"},
1150 is_ground_content = true,
1151 groups = {cracky=3},
1152 sounds = default.node_sound_stone_defaults(),
1155 minetest.register_node("default:mossycobble", {
1156 description = "Mossy Cobble",
1157 tile_images = {"default_mossycobble.png"},
1158 is_ground_content = true,
1159 groups = {cracky=3},
1160 sounds = default.node_sound_stone_defaults(),
1163 minetest.register_node("default:steelblock", {
1164 description = "Steel Block",
1165 tile_images = {"default_steel_block.png"},
1166 is_ground_content = true,
1167 groups = {snappy=1,bendy=2},
1168 sounds = default.node_sound_stone_defaults(),
1171 minetest.register_node("default:nyancat", {
1172 description = "Nyancat",
1173 tile_images = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
1174 "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
1175 inventory_image = "default_nc_front.png",
1176 paramtype2 = "facedir",
1177 groups = {cracky=2},
1178 legacy_facedir_simple = true,
1179 sounds = default.node_sound_defaults(),
1182 minetest.register_node("default:nyancat_rainbow", {
1183 description = "Nyancat Rainbow",
1184 tile_images = {"default_nc_rb.png"},
1185 inventory_image = "default_nc_rb.png",
1186 groups = {cracky=2},
1187 sounds = default.node_sound_defaults(),
1190 minetest.register_node("default:sapling", {
1191 description = "Sapling",
1192 drawtype = "plantlike",
1194 tile_images = {"default_sapling.png"},
1195 inventory_image = "default_sapling.png",
1196 wield_image = "default_sapling.png",
1197 paramtype = "light",
1199 groups = {snappy=2,dig_immediate=3},
1200 sounds = default.node_sound_defaults(),
1203 minetest.register_node("default:apple", {
1204 description = "Apple",
1205 drawtype = "plantlike",
1207 tile_images = {"default_apple.png"},
1208 inventory_image = "default_apple.png",
1209 paramtype = "light",
1210 sunlight_propagates = true,
1212 groups = {fleshy=3,dig_immediate=3},
1213 on_use = minetest.item_eat(4),
1214 sounds = default.node_sound_defaults(),
1221 minetest.register_craftitem("default:stick", {
1222 description = "Stick",
1223 inventory_image = "default_stick.png",
1226 minetest.register_craftitem("default:paper", {
1227 description = "Paper",
1228 inventory_image = "default_paper.png",
1231 minetest.register_craftitem("default:book", {
1232 description = "Book",
1233 inventory_image = "default_book.png",
1236 minetest.register_craftitem("default:coal_lump", {
1237 description = "Lump of coal",
1238 inventory_image = "default_coal_lump.png",
1241 minetest.register_craftitem("default:iron_lump", {
1242 description = "Lump of iron",
1243 inventory_image = "default_iron_lump.png",
1246 minetest.register_craftitem("default:clay_lump", {
1247 description = "Lump of clay",
1248 inventory_image = "default_clay_lump.png",
1251 minetest.register_craftitem("default:steel_ingot", {
1252 description = "Steel ingot",
1253 inventory_image = "default_steel_ingot.png",
1256 minetest.register_craftitem("default:clay_brick", {
1257 description = "Clay brick",
1258 inventory_image = "default_steel_ingot.png",
1259 inventory_image = "default_clay_brick.png",
1262 minetest.register_craftitem("default:scorched_stuff", {
1263 description = "Scorched stuff",
1264 inventory_image = "default_scorched_stuff.png",
1268 -- Creative inventory
1271 minetest.add_to_creative_inventory('default:pick_mese')
1272 minetest.add_to_creative_inventory('default:pick_steel')
1273 minetest.add_to_creative_inventory('default:axe_steel')
1274 minetest.add_to_creative_inventory('default:shovel_steel')
1276 minetest.add_to_creative_inventory('default:torch')
1277 minetest.add_to_creative_inventory('default:cobble')
1278 minetest.add_to_creative_inventory('default:dirt')
1279 minetest.add_to_creative_inventory('default:stone')
1280 minetest.add_to_creative_inventory('default:sand')
1281 minetest.add_to_creative_inventory('default:sandstone')
1282 minetest.add_to_creative_inventory('default:clay')
1283 minetest.add_to_creative_inventory('default:brick')
1284 minetest.add_to_creative_inventory('default:tree')
1285 minetest.add_to_creative_inventory('default:wood')
1286 minetest.add_to_creative_inventory('default:leaves')
1287 minetest.add_to_creative_inventory('default:cactus')
1288 minetest.add_to_creative_inventory('default:papyrus')
1289 minetest.add_to_creative_inventory('default:bookshelf')
1290 minetest.add_to_creative_inventory('default:glass')
1291 minetest.add_to_creative_inventory('default:fence_wood')
1292 minetest.add_to_creative_inventory('default:rail')
1293 minetest.add_to_creative_inventory('default:mese')
1294 minetest.add_to_creative_inventory('default:chest')
1295 minetest.add_to_creative_inventory('default:furnace')
1296 minetest.add_to_creative_inventory('default:sign_wall')
1297 minetest.add_to_creative_inventory('default:water_source')
1298 minetest.add_to_creative_inventory('default:lava_source')
1299 minetest.add_to_creative_inventory('default:ladder')
1302 -- Aliases for map generator outputs
1303 -- (required at least by an in-development branch)
1306 minetest.register_alias("mapgen_air", "air")
1307 minetest.register_alias("mapgen_stone", "default:stone")
1308 minetest.register_alias("mapgen_tree", "default:tree")
1309 minetest.register_alias("mapgen_leaves", "default:leaves")
1310 minetest.register_alias("mapgen_apple", "default:apple")
1311 minetest.register_alias("mapgen_water_source", "default:water_source")
1312 minetest.register_alias("mapgen_dirt", "default:dirt")
1313 minetest.register_alias("mapgen_sand", "default:sand")
1314 minetest.register_alias("mapgen_gravel", "default:gravel")
1315 minetest.register_alias("mapgen_clay", "default:clay")
1316 minetest.register_alias("mapgen_lava_source", "default:lava_source")
1317 minetest.register_alias("mapgen_cobble", "default:cobble")
1318 minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
1319 minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
1320 minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
1321 minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
1322 minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
1323 minetest.register_alias("mapgen_mese", "default:mese")
1326 -- Some common functions
1329 default.falling_node_names = {}
1331 function nodeupdate_single(p)
1332 n = minetest.env:get_node(p)
1333 if default.falling_node_names[n.name] ~= nil then
1334 p_bottom = {x=p.x, y=p.y-1, z=p.z}
1335 n_bottom = minetest.env:get_node(p_bottom)
1336 if n_bottom.name == "air" then
1337 minetest.env:remove_node(p)
1338 minetest.env:add_entity(p, "default:falling_"..n.name)
1344 function nodeupdate(p)
1348 p2 = {x=p.x+x, y=p.y+y, z=p.z+z}
1349 nodeupdate_single(p2)
1359 function default.register_falling_node(nodename, texture)
1360 default.falling_node_names[nodename] = true
1361 -- Override naming conventions for stuff like :default:falling_default:sand
1362 minetest.register_entity(":default:falling_"..nodename, {
1363 -- Static definition
1365 collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
1367 textures = {texture,texture,texture,texture,texture,texture},
1370 on_step = function(self, dtime)
1372 self.object:setacceleration({x=0, y=-10, z=0})
1373 -- Turn to actual sand when collides to ground or just move
1374 local pos = self.object:getpos()
1375 local bcp = {x=pos.x, y=pos.y-0.7, z=pos.z} -- Position of bottom center point
1376 local bcn = minetest.env:get_node(bcp)
1377 if bcn.name ~= "air" then
1378 -- Turn to a sand node
1379 local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
1380 minetest.env:add_node(np, {name=nodename})
1381 self.object:remove()
1389 default.register_falling_node("default:sand", "default_sand.png")
1390 default.register_falling_node("default:gravel", "default_gravel.png")
1396 -- Global environment step function
1397 function on_step(dtime)
1400 minetest.register_globalstep(on_step)
1402 function on_placenode(p, node)
1403 --print("on_placenode")
1406 minetest.register_on_placenode(on_placenode)
1408 function on_dignode(p, node)
1409 --print("on_dignode")
1412 minetest.register_on_dignode(on_dignode)
1414 function on_punchnode(p, node)
1416 minetest.register_on_punchnode(on_punchnode)
1418 local function handle_give_command(cmd, giver, receiver, stackstring)
1419 if not minetest.get_player_privs(giver)["give"] then
1420 minetest.chat_send_player(giver, "error: you don't have permission to give")
1423 minetest.debug("DEBUG: "..cmd..' invoked, stackstring="'..stackstring..'"')
1424 minetest.log(cmd..' invoked, stackstring="'..stackstring..'"')
1425 local itemstack = ItemStack(stackstring)
1426 if itemstack:is_empty() then
1427 minetest.chat_send_player(giver, 'error: cannot give an empty item')
1429 elseif not itemstack:is_known() then
1430 minetest.chat_send_player(giver, 'error: cannot give an unknown item')
1433 local receiverref = minetest.env:get_player_by_name(receiver)
1434 if receiverref == nil then
1435 minetest.chat_send_player(giver, receiver..' is not a known player')
1438 local leftover = receiverref:get_inventory():add_item("main", itemstack)
1439 if leftover:is_empty() then
1441 elseif leftover:get_count() == itemstack:get_count() then
1442 partiality = "could not be "
1444 partiality = "partially "
1446 -- The actual item stack string may be different from what the "giver"
1447 -- entered (e.g. big numbers are always interpreted as 2^16-1).
1448 stackstring = itemstack:to_string()
1449 if giver == receiver then
1450 minetest.chat_send_player(giver, '"'..stackstring
1451 ..'" '..partiality..'added to inventory.');
1453 minetest.chat_send_player(giver, '"'..stackstring
1454 ..'" '..partiality..'added to '..receiver..'\'s inventory.');
1455 minetest.chat_send_player(receiver, '"'..stackstring
1456 ..'" '..partiality..'added to inventory.');
1460 minetest.register_on_chat_message(function(name, message)
1461 --print("default on_chat_message: name="..dump(name).." message="..dump(message))
1462 local cmd = "/giveme"
1463 if message:sub(0, #cmd) == cmd then
1464 local stackstring = string.match(message, cmd.." (.*)")
1465 if stackstring == nil then
1466 minetest.chat_send_player(name, 'usage: '..cmd..' stackstring')
1467 return true -- Handled chat message
1469 handle_give_command(cmd, name, name, stackstring)
1473 if message:sub(0, #cmd) == cmd then
1474 local receiver, stackstring = string.match(message, cmd.." ([%a%d_-]+) (.*)")
1475 if receiver == nil or stackstring == nil then
1476 minetest.chat_send_player(name, 'usage: '..cmd..' name stackstring')
1477 return true -- Handled chat message
1479 handle_give_command(cmd, name, receiver, stackstring)
1482 local cmd = "/spawnentity"
1483 if message:sub(0, #cmd) == cmd then
1484 if not minetest.get_player_privs(name)["give"] then
1485 minetest.chat_send_player(name, "you don't have permission to spawn (give)")
1486 return true -- Handled chat message
1488 if not minetest.get_player_privs(name)["interact"] then
1489 minetest.chat_send_player(name, "you don't have permission to interact")
1490 return true -- Handled chat message
1492 local entityname = string.match(message, cmd.." (.*)")
1493 if entityname == nil then
1494 minetest.chat_send_player(name, 'usage: '..cmd..' entityname')
1495 return true -- Handled chat message
1497 print(cmd..' invoked, entityname="'..entityname..'"')
1498 local player = minetest.env:get_player_by_name(name)
1499 if player == nil then
1500 print("Unable to spawn entity, player is nil")
1501 return true -- Handled chat message
1503 local p = player:getpos()
1505 minetest.env:add_entity(p, entityname)
1506 minetest.chat_send_player(name, '"'..entityname
1508 return true -- Handled chat message
1510 local cmd = "/pulverize"
1511 if message:sub(0, #cmd) == cmd then
1512 local player = minetest.env:get_player_by_name(name)
1513 if player == nil then
1514 print("Unable to pulverize, player is nil")
1515 return true -- Handled chat message
1517 if player:get_wielded_item():is_empty() then
1518 minetest.chat_send_player(name, 'Unable to pulverize, no item in hand.')
1520 player:set_wielded_item(nil)
1521 minetest.chat_send_player(name, 'An item was pulverized.')
1528 -- Done, print some random stuff
1531 --print("minetest.registered_entities:")
1532 --dump2(minetest.registered_entities)