init.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. dofile(minetest.get_modpath("lottplants").."/nodes.lua")
  2. dofile(minetest.get_modpath("lottplants").."/wild_food.lua")
  3. dofile(minetest.get_modpath("lottplants").."/flowers.lua")
  4. dofile(minetest.get_modpath("lottplants").."/functions.lua")
  5. minetest.register_node("lottplants:brambles_of_mordor", {
  6. description = "Brambles Of Mordor",
  7. drawtype = "plantlike",
  8. tiles = { "lottplants_brambles_of_mordor.png" },
  9. inventory_image = "lottplants_brambles_of_mordor.png",
  10. wield_image = "lottplants_brambles_of_mordor.png",
  11. sunlight_propagates = true,
  12. paramtype = "light",
  13. paramtype2 = "meshoptions",
  14. place_param2 = 42,
  15. walkable = false,
  16. waving = 1,
  17. buildable_to = true,
  18. groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_grey=1},
  19. sounds = default.node_sound_leaves_defaults(),
  20. selection_box = {
  21. type = "fixed",
  22. fixed = { -0.5, -0.5, -0.5, 0.5, -0.3, 0.5 },
  23. },
  24. })
  25. minetest.register_node("lottplants:pilinehtar", {
  26. description = "Pilinehtar",
  27. drawtype = "plantlike",
  28. tiles = { "lottplants_pilinehtar.png" },
  29. inventory_image = "lottplants_pilinehtar.png",
  30. wield_image = "lottplants_pilinehtar.png",
  31. sunlight_propagates = true,
  32. paramtype = "light",
  33. paramtype2 = "meshoptions",
  34. place_param2 = 2,
  35. walkable = false,
  36. buildable_to = true,
  37. waving = 1,
  38. groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_green=1},
  39. sounds = default.node_sound_leaves_defaults(),
  40. selection_box = {
  41. type = "fixed",
  42. fixed = { -0.3, -0.5, -0.3, 0.3, 0.27, 0.3 },
  43. },
  44. })
  45. minetest.register_alias("lottplants:brambles_of_mordor_fake", "lottplants:brambles_of_mordor")
  46. minetest.register_alias("lottplants:pilinehtar_fake", "lottplants:pilinehtar")
  47. minetest.register_abm({
  48. nodenames = {"group:flora"},
  49. neighbors = {"default:dirt_with_grass", "default:desert_sand"},
  50. interval = 50,
  51. chance = 25,
  52. action = function(pos, node)
  53. pos.y = pos.y - 1
  54. local under = minetest.get_node(pos)
  55. pos.y = pos.y + 1
  56. if under.name == "default:desert_sand" then
  57. minetest.set_node(pos, {name="lottplants:brambles_of_mordor"})
  58. elseif under.name ~= "default:dirt_with_grass" then
  59. return
  60. end
  61. local light = minetest.get_node_light(pos)
  62. if not light or light < 13 then
  63. return
  64. end
  65. local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4}
  66. local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4}
  67. if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
  68. return
  69. end
  70. local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora")
  71. if #flowers > 3 then
  72. return
  73. end
  74. local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
  75. if #seedling > 0 then
  76. seedling = seedling[math.random(#seedling)]
  77. seedling.y = seedling.y + 1
  78. light = minetest.get_node_light(seedling)
  79. if not light or light < 13 then
  80. return
  81. end
  82. if minetest.get_node(seedling).name == "air" then
  83. minetest.set_node(seedling, {name=node.name})
  84. end
  85. end
  86. end,
  87. })
  88. minetest.register_craftitem("lottplants:honey", {
  89. description = "Honey",
  90. inventory_image = "lottplants_honey.png",
  91. on_use = minetest.item_eat(1),
  92. })