pipeweed.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. minetest.register_craftitem("lottfarming:pipeweed_seed", {
  2. description = "Pipeweed Seeds",
  3. inventory_image = "lottfarming_pipeweed_seed.png",
  4. on_place = function(itemstack, placer, pointed_thing)
  5. return place_seed(itemstack, placer, pointed_thing, "lottfarming:pipeweed_1", 34)
  6. end,
  7. })
  8. minetest.register_node("lottfarming:pipeweed_1", {
  9. paramtype = "light",
  10. paramtype2 = "meshoptions",
  11. walkable = false,
  12. drawtype = "plantlike",
  13. drop = "",
  14. tiles = {"lottfarming_pipeweed_1.png"},
  15. waving = 1,
  16. selection_box = {
  17. type = "fixed",
  18. fixed = {
  19. {-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5}
  20. },
  21. },
  22. groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
  23. sounds = default.node_sound_leaves_defaults(),
  24. })
  25. minetest.register_node("lottfarming:pipeweed_2", {
  26. paramtype = "light",
  27. paramtype2 = "meshoptions",
  28. walkable = false,
  29. drawtype = "plantlike",
  30. drop = "",
  31. tiles = {"lottfarming_pipeweed_2.png"},
  32. waving = 1,
  33. selection_box = {
  34. type = "fixed",
  35. fixed = {
  36. {-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5}
  37. },
  38. },
  39. groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
  40. sounds = default.node_sound_leaves_defaults(),
  41. })
  42. minetest.register_node("lottfarming:pipeweed_3", {
  43. paramtype = "light",
  44. paramtype2 = "meshoptions",
  45. walkable = false,
  46. drawtype = "plantlike",
  47. drop = "",
  48. tiles = {"lottfarming_pipeweed_3.png"},
  49. waving = 1,
  50. selection_box = {
  51. type = "fixed",
  52. fixed = {
  53. {-0.5, -0.5, -0.5, 0.5, -0.5+13/16, 0.5}
  54. },
  55. },
  56. groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
  57. sounds = default.node_sound_leaves_defaults(),
  58. })
  59. minetest.register_node("lottfarming:pipeweed_4", {
  60. paramtype = "light",
  61. paramtype2 = "meshoptions",
  62. walkable = false,
  63. drawtype = "plantlike",
  64. tiles = {"lottfarming_pipeweed_4.png"},
  65. waving = 1,
  66. drop = {
  67. max_items = 6,
  68. items = {
  69. { items = {'lottfarming:pipeweed_seed'} },
  70. { items = {'lottfarming:pipeweed_seed'}, rarity = 2},
  71. { items = {'lottfarming:pipeweed_seed'}, rarity = 5},
  72. { items = {'lottfarming:pipeweed'} },
  73. { items = {'lottfarming:pipeweed'}, rarity = 2 },
  74. { items = {'lottfarming:pipeweed'}, rarity = 5 }
  75. }
  76. },
  77. groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
  78. sounds = default.node_sound_leaves_defaults(),
  79. })
  80. minetest.register_craftitem("lottfarming:pipeweed", {
  81. description = "Pipeweed",
  82. inventory_image = "lottfarming_pipeweed.png",
  83. })
  84. farming:add_plant("lottfarming:pipeweed_4", {"lottfarming:pipeweed_1", "lottfarming:pipeweed_2", "lottfarming:pipeweed_3"}, 50, 20, 34)
  85. minetest.register_craft({
  86. type = "cooking",
  87. cooktime = 15,
  88. output = "lottfarming:pipeweed_cooked",
  89. recipe = "lottfarming:pipeweed"
  90. })
  91. minetest.register_craftitem("lottfarming:pipeweed_cooked", {
  92. description = "Cooked Pipeweed",
  93. inventory_image = "lottfarming_pipeweed_cooked.png",
  94. })
  95. minetest.register_craft({
  96. output = 'lottfarming:pipe',
  97. recipe = {
  98. {'', '', 'group:stick'},
  99. {'group:wood', 'group:stick', ''},
  100. {'group:stick', '', ''},
  101. }
  102. })
  103. pipeweed = {
  104. {"lottfarming:pipeweed_cooked"},
  105. }
  106. minetest.register_tool("lottfarming:pipe", {
  107. description = "Pipe",
  108. inventory_image = "lottfarming_pipe.png",
  109. on_use = function(itemstack, player)
  110. for _,arrow in ipairs(pipeweed) do
  111. if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
  112. player:set_hp(player:get_hp()+2)
  113. if not minetest.setting_getbool("creative_mode") then
  114. player:get_inventory():remove_item("main", arrow[1])
  115. end
  116. local pos = player:getpos()
  117. local dir = player:get_look_dir()
  118. minetest.add_particle({
  119. pos = {x=pos.x,y=pos.y+1.5,z=pos.z},
  120. vel = {x=dir.x*.3, y=.2, z=dir.z*.3},
  121. acc = {x=dir.x*.01, y=.1, z=dir.z*.01},
  122. expirationtime = 5,
  123. size = .75,
  124. collisiondetection = false,
  125. vertical = false,
  126. texture = "lottfarming_smoke_ring.png",
  127. })
  128. lottachievements.unlock(player:get_player_name(), "smoke_rings")
  129. end
  130. end
  131. end})