pineapple.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. type = "shapeless",
  37. recipe = {"group:food_pineapple"},
  38. replacements = {{"farming:pineapple", "farming:pineapple_top"}}
  39. })
  40. -- pineapple juice
  41. minetest.register_craftitem("farming:pineapple_juice", {
  42. description = S("Pineapple Juice"),
  43. inventory_image = "farming_pineapple_juice.png",
  44. on_use = minetest.item_eat(4, "vessels:drinking_glass"),
  45. groups = {vessel = 1},
  46. })
  47. minetest.register_craft({
  48. output = "farming:pineapple_juice",
  49. type = "shapeless",
  50. recipe = {"vessels:drinking_glass", "group:food_pineapple_ring",
  51. "group:food_pineapple_ring", "group:food_pineapple_ring",
  52. "farming:juicer"},
  53. replacements = {
  54. {"group:food_juicer", "farming:juicer"},
  55. },
  56. })
  57. minetest.register_craft({
  58. output = "farming:pineapple_juice 2",
  59. type = "shapeless",
  60. recipe = {
  61. "vessels:drinking_glass", "vessels:drinking_glass",
  62. "group:food_pineapple", "farming:juicer"
  63. },
  64. replacements = {
  65. {"group:food_juicer", "farming:juicer"},
  66. },
  67. })
  68. -- crop definition
  69. local crop_def = {
  70. drawtype = "plantlike",
  71. visual_scale = 1.5,
  72. tiles = {"farming_pineapple_1.png"},
  73. paramtype = "light",
  74. sunlight_propagates = true,
  75. walkable = false,
  76. buildable_to = true,
  77. drop = "",
  78. selection_box = farming.select,
  79. groups = {
  80. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  81. not_in_creative_inventory = 1, growing = 1
  82. },
  83. sounds = default.node_sound_leaves_defaults()
  84. }
  85. -- stage 1
  86. minetest.register_node("farming:pineapple_1", table.copy(crop_def))
  87. -- stage 2
  88. crop_def.tiles = {"farming_pineapple_2.png"}
  89. minetest.register_node("farming:pineapple_2", table.copy(crop_def))
  90. -- stage 3
  91. crop_def.tiles = {"farming_pineapple_3.png"}
  92. minetest.register_node("farming:pineapple_3", table.copy(crop_def))
  93. -- stage 4
  94. crop_def.tiles = {"farming_pineapple_4.png"}
  95. minetest.register_node("farming:pineapple_4", table.copy(crop_def))
  96. -- stage 5
  97. crop_def.tiles = {"farming_pineapple_5.png"}
  98. minetest.register_node("farming:pineapple_5", table.copy(crop_def))
  99. -- stage 6
  100. crop_def.tiles = {"farming_pineapple_6.png"}
  101. minetest.register_node("farming:pineapple_6", table.copy(crop_def))
  102. -- stage 7
  103. crop_def.tiles = {"farming_pineapple_7.png"}
  104. minetest.register_node("farming:pineapple_7", table.copy(crop_def))
  105. -- stage 8 (final)
  106. crop_def.tiles = {"farming_pineapple_8.png"}
  107. crop_def.groups.growing = 0
  108. crop_def.drop = {
  109. items = {
  110. {items = {"farming:pineapple"}, rarity = 1},
  111. {items = {"farming:pineapple"}, rarity = 15},
  112. }
  113. }
  114. minetest.register_node("farming:pineapple_8", table.copy(crop_def))
  115. -- add to registered_plants
  116. farming.registered_plants["farming:pineapple"] = {
  117. crop = "farming:pineapple",
  118. seed = "farming:pineapple_top",
  119. minlight = 13,
  120. maxlight = 15,
  121. steps = 8
  122. }