pineapple.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. local S = farming.intllib
  2. -- pineapple top
  3. minetest.register_craftitem("farming:pineapple_top", {
  4. description = S("Pineapple Top"),
  5. inventory_image = "farming_pineapple_top.png",
  6. groups = {seed = 2, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1")
  9. end
  10. })
  11. -- pineapple
  12. minetest.register_node("farming:pineapple", {
  13. description = S("Pineapple"),
  14. drawtype = "plantlike",
  15. tiles = {"farming_pineapple.png"},
  16. inventory_image = "farming_pineapple.png",
  17. wield_image = "farming_pineapple.png",
  18. paramtype = "light",
  19. sunlight_propagates = true,
  20. walkable = false,
  21. selection_box = {
  22. type = "fixed",
  23. fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27}
  24. },
  25. groups = {food_pineapple = 1, fleshy = 3, dig_immediate = 3, flammable = 2}
  26. })
  27. -- pineapple
  28. minetest.register_craftitem("farming:pineapple_ring", {
  29. description = S("Pineapple Ring"),
  30. inventory_image = "farming_pineapple_ring.png",
  31. groups = {food_pineapple_ring = 1, flammable = 2},
  32. on_use = minetest.item_eat(1)
  33. })
  34. minetest.register_craft( {
  35. output = "farming:pineapple_ring 5",
  36. recipe = {{"group:food_pineapple"}},
  37. replacements = {{"farming:pineapple", "farming:pineapple_top"}}
  38. })
  39. -- pineapple juice
  40. minetest.register_craftitem("farming:pineapple_juice", {
  41. description = S("Pineapple Juice"),
  42. inventory_image = "farming_pineapple_juice.png",
  43. on_use = minetest.item_eat(4, "vessels:drinking_glass"),
  44. groups = {vessel = 1, drink = 1}
  45. })
  46. minetest.register_craft({
  47. output = "farming:pineapple_juice",
  48. recipe = {
  49. {"group:food_pineapple_ring", "group:food_pineapple_ring",
  50. "group:food_pineapple_ring"},
  51. {"", "farming:juicer", ""},
  52. {"", "vessels:drinking_glass", ""}
  53. },
  54. replacements = {
  55. {"group:food_juicer", "farming:juicer"}
  56. }
  57. })
  58. minetest.register_craft({
  59. output = "farming:pineapple_juice 2",
  60. recipe = {
  61. {"group:food_pineapple", ""},
  62. {"farming:juicer", ""},
  63. {"vessels:drinking_glass", "vessels:drinking_glass"}
  64. },
  65. replacements = {
  66. {"group:food_juicer", "farming:juicer"}
  67. }
  68. })
  69. -- crop definition
  70. local def = {
  71. drawtype = "plantlike",
  72. visual_scale = 1.5,
  73. tiles = {"farming_pineapple_1.png"},
  74. paramtype = "light",
  75. sunlight_propagates = true,
  76. walkable = false,
  77. buildable_to = true,
  78. drop = "",
  79. selection_box = farming.select,
  80. groups = {
  81. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  82. not_in_creative_inventory = 1, growing = 1
  83. },
  84. sounds = default.node_sound_leaves_defaults()
  85. }
  86. -- stage 1
  87. minetest.register_node("farming:pineapple_1", table.copy(def))
  88. -- stage 2
  89. def.tiles = {"farming_pineapple_2.png"}
  90. minetest.register_node("farming:pineapple_2", table.copy(def))
  91. -- stage 3
  92. def.tiles = {"farming_pineapple_3.png"}
  93. minetest.register_node("farming:pineapple_3", table.copy(def))
  94. -- stage 4
  95. def.tiles = {"farming_pineapple_4.png"}
  96. minetest.register_node("farming:pineapple_4", table.copy(def))
  97. -- stage 5
  98. def.tiles = {"farming_pineapple_5.png"}
  99. minetest.register_node("farming:pineapple_5", table.copy(def))
  100. -- stage 6
  101. def.tiles = {"farming_pineapple_6.png"}
  102. minetest.register_node("farming:pineapple_6", table.copy(def))
  103. -- stage 7
  104. def.tiles = {"farming_pineapple_7.png"}
  105. minetest.register_node("farming:pineapple_7", table.copy(def))
  106. -- stage 8 (final)
  107. def.tiles = {"farming_pineapple_8.png"}
  108. def.groups.growing = nil
  109. def.drop = {
  110. items = {
  111. {items = {"farming:pineapple"}, rarity = 1},
  112. {items = {"farming:pineapple"}, rarity = 10}
  113. }
  114. }
  115. minetest.register_node("farming:pineapple_8", table.copy(def))
  116. -- add to registered_plants
  117. farming.registered_plants["farming:pineapple"] = {
  118. crop = "farming:pineapple",
  119. seed = "farming:pineapple_top",
  120. minlight = farming.min_light,
  121. maxlight = farming.max_light,
  122. steps = 8
  123. }