Guest User

Untitled

a guest
Oct 6th, 2013
44
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function remove_leaves (pos,oldnode)
  2.         local node1 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})
  3.         local node2 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})
  4.         local node3 = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
  5.         local node4 = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
  6.         local node5 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})
  7.         local node6 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})
  8.         if node1.name == "default:leaves" or node1.name == "default:jungleleaves" then
  9.             minetest.remove_node({x=pos.x-1,y=pos.y,z=pos.z})
  10.         end
  11.         if node2.name == "default:leaves" or node2.name == "default:jungleleaves" then
  12.             minetest.remove_node({x=pos.x+1,y=pos.y,z=pos.z})
  13.         end
  14.         if node3.name == "default:leaves" or node3.name == "default:jungleleaves" then
  15.             minetest.remove_node({x=pos.x,y=pos.y-1,z=pos.z})
  16.         end
  17.         if node4.name == "default:leaves" or node4.name == "default:jungleleaves" then
  18.             minetest.remove_node({x=pos.x,y=pos.y+1,z=pos.z})
  19.         end
  20.         if node5.name == "default:leaves" or node5.name == "default:jungleleaves" then
  21.             minetest.remove_node({x=pos.x,y=pos.y,z=pos.z-1})
  22.         end
  23.         if node6.name == "default:leaves" or node6.name == "default:jungleleaves" then
  24.             minetest.remove_node({x=pos.x,y=pos.y,z=pos.z+1})
  25.         end
  26. end
  27.  
  28. minetest.register_node(":default:tree", {
  29.     description = "Tree",
  30.     tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
  31.     groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
  32.     sounds = default.node_sound_wood_defaults(),
  33. })
  34.  
  35. minetest.register_node(":default:leaves", {
  36.     description = "Leaves",
  37.     drawtype = "allfaces_optional",
  38.     visual_scale = 1.3,
  39.     tiles = {"default_leaves.png"},
  40.     paramtype = "light",
  41.     groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
  42.     drop = {
  43.         max_items = 1,
  44.         items = {
  45.             {
  46.                 -- player will get sapling with 1/20 chance
  47.                 items = {'default:sapling'},
  48.                 rarity = 20,
  49.             },
  50.             {
  51.                 -- player will get leaves only if he get no saplings,
  52.                 -- this is because max_items is 1
  53.                 items = {'default:leaves'},
  54.             }
  55.         }
  56.     },
  57.     sounds = default.node_sound_leaves_defaults(),
  58.     after_destruct = function(remove_leaves)
  59.     end,
  60. })
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×