Advertisement
Icalasari

Untitled

Aug 21st, 2022 (edited)
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. for name,def in pairs(mindeca.melon) do
  2. minetest.register_node("mindeca:fruit_"..def.elonname, {
  3. description = def.elondesc.."\n\nMindeca",
  4. tiles = {
  5. "mindeca_fruit_"..def.elonname.."_top.png",
  6. "mindeca_fruit_"..def.elonname.."_bot.png",
  7. "mindeca_fruit_"..def.elonname..".png"
  8. },
  9. groups = {snappy = 3, flammable = 2, melon = 1},
  10. drop = "mindeca:fruit_"..def.elonname,
  11. sounds = default.node_sound_leaves_defaults()
  12. })
  13.  
  14. minetest.register_node("mindeca:vine_"..def.elonname, {
  15. description = def.vinedesc.."\n\nMindeca",
  16. tiles = {
  17. "mindeca_vine_"..def.elonname..".png"
  18. },
  19. paramtype = "light",
  20. paramtype2 = "facedir",
  21. groups = {snappy = 3, flammable = 2, melon = 1},
  22. drop = "mindeca:fruit_"..def.elonname,
  23. node_placement_prediction = "mindeca:vine_"..def.elonname,
  24. after_place_node = function(pos, placer, itemstack, pointed_thing)
  25. minetest.get_node_timer(pos):start(math.random(5, 5))
  26. end,
  27.  
  28. on_timer = function(pos, elapsed)
  29. if not mindeca.can_grow_fullsun(pos) then
  30. minetest.get_node_timer(pos):start(math.random(5, 5))
  31. end
  32. return
  33.  
  34. local melrot = minetest.get_node(pos).param2
  35. if melrot = 0 then
  36. minetest.set_node(
  37. {x = pos.x-1, y = pos.y, z = pos.z},
  38. {name = "mindeca:fruit_"..def.elonname}
  39. )
  40. elseif melrot = 1 then
  41. minetest.set_node(
  42. {x = pos.x, y = pos.y, z = pos.z},
  43. {name = "mindeca:fruit_"..def.elonname}
  44. )
  45. elseif melrot = 2 then
  46. minetest.set_node(
  47. {x = pos.x, y = pos.y, z = pos.z},
  48. {name = "mindeca:fruit_"..def.elonname}
  49. )
  50. elseif melrot = 3 then
  51. minetest.set_node(
  52. {x = pos.x, y = pos.y, z = pos.z},
  53. {name = "mindeca:fruit_"..def.elonname}
  54. )
  55. elseif melrot = nil then return
  56. end
  57. end
  58. })
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement