Advertisement
Guest User

Untitled

a guest
Dec 6th, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. minetest.register_node("farming_plus:cocoa_sapling", {
  2. description = "Cocoa Tree Sapling",
  3. drawtype = "plantlike",
  4. tiles = {"farming_cocoa_sapling.png"},
  5. inventory_image = "farming_cocoa_sapling.png",
  6. wield_image = "farming_cocoa_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("farming_plus:cocoa_leaves", {
  14. drawtype = "allfaces_optional",
  15. tiles = {"farming_banana_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 = {'farming_plus:cocoa_sapling'},
  23. rarity = 20,
  24. },
  25. }
  26. },
  27. sounds = default.node_sound_leaves_defaults(),
  28. })
  29.  
  30. minetest.register_abm({
  31. nodenames = {"farming_plus:cocoa_sapling"},
  32. interval = 60,
  33. chance = 20,
  34. action = function(pos, node)
  35. farming:generate_tree(pos, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=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:desert_sand"})
  45. if pos ~= nil then
  46. farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=20})
  47. end
  48. end)
  49.  
  50. minetest.register_node("farming_plus:cocoa", {
  51. description = "Cocoa",
  52. tiles = {"farming_cocoa.png"},
  53. visual_scale = 0.5,
  54. inventory_image = "farming_cocoa.png",
  55. wield_image = "farming_cocoa.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. })
  63.  
  64. minetest.register_craftitem("farming_plus:cocoa_bean", {
  65. description = "Cocoa Bean",
  66. inventory_image = "farming_cocoa_bean.png",
  67. })
  68.  
  69. minetest.register_craft({
  70. output = "farming_plus:cocoa_bean 10",
  71. type = "shapeless",
  72. recipe = {"farming_plus:cocoa"},
  73. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement