pineapple.lua 3.7 KB

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