Advertisement
Guest User

Untitled

a guest
Dec 6th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. minetest.register_node("palmtree:palm_sapling", {
  2. description = "Palm Tree Sapling",
  3. drawtype = "plantlike",
  4. tiles = {"palm_sapling.png"},
  5. inventory_image = "palm_sapling.png",
  6. wield_image = "palm_sapling.png",
  7. paramtype = "light",
  8. walkable = false,
  9. groups = {dig_immediate=3,flammable=2},
  10. sounds = default.node_sound_defaults(),
  11. })
  12.  
  13. minetest.register_node("palmtree:palm_leaves", {
  14. drawtype = "allfaces_optional",
  15. tiles = {"palm_leaves.png"},
  16. paramtype = "light",
  17. groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
  18. drop = {
  19. max_items = 1,
  20. items = {
  21. {
  22. items = {'palmtree:palm_sapling'},
  23. rarity = 20,
  24. },
  25. }
  26. },
  27. sounds = default.node_sound_leaves_defaults(),
  28. })
  29.  
  30. minetest.register_abm({
  31. nodenames = {"palmtree:palm_sapling"},
  32. interval = 60,
  33. chance = 20,
  34. action = function(pos, node)
  35. palmtree:palm_trunk(pos, "palmtree:palm_trunk", "palmtree:palm_leaves", {"default:sand"}, {["palmtree:palm_coconut"]=20})
  36. end
  37. })
  38.  
  39. minetest.register_on_generated(function(minp, maxp, blockseed)
  40. if math.random(1, 100) > 5 then
  41. return
  42. end
  43. local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
  44. local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:sand"})
  45. if pos ~= nil then
  46. palmtree:palm_trunk({x=pos.x, y=pos.y+1, z=pos.z}, "palmtree:palm_trunk", "palmtree:palm_leaves", {"default:sand"}, {["palmtree:palm_coconut"]=20})
  47. end
  48. end)
  49.  
  50. minetest.register_node("palmtree:palm_coconut", {
  51. description = "Coconut",
  52. tiles = {"palm_coconut.png"},
  53. visual_scale = 0.5,
  54. inventory_image = "palm_coconut.png",
  55. wield_image = "palm_coconut.png",
  56. drawtype = "torchlike",
  57. paramtype = "light",
  58. sunlight_propagates = true,
  59. walkable = false,
  60. groups = {fleshy=3,dig_immediate=3,flammable=2},
  61. sounds = default.node_sound_defaults(),
  62. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement