mint.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. local S = farming.intllib
  2. -- mint seed
  3. minetest.register_craftitem("farming:seed_mint", {
  4. description = S("Mint Seeds"),
  5. inventory_image = "farming_mint_seeds.png",
  6. groups = {seed = 2, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(
  9. itemstack, placer, pointed_thing, "farming:mint_1")
  10. end
  11. })
  12. -- mint leaf
  13. minetest.register_craftitem("farming:mint_leaf", {
  14. description = S("Mint Leaf"),
  15. inventory_image = "farming_mint_leaf.png",
  16. groups = {food_mint = 1, flammable = 4}
  17. })
  18. -- mint tea
  19. minetest.register_craftitem("farming:mint_tea", {
  20. description = S("Mint Tea"),
  21. inventory_image = "farming_mint_tea.png",
  22. on_use = minetest.item_eat(2, "vessels:drinking_glass"),
  23. groups = {flammable = 4}
  24. })
  25. minetest.register_craft({
  26. output = "farming:mint_tea",
  27. type = "shapeless",
  28. recipe = {
  29. "vessels:drinking_glass", "group:food_mint",
  30. "group:food_mint", "group:food_mint",
  31. "farming:juicer", "group:water_bucket"
  32. },
  33. replacements = {
  34. {"group:food_juicer", "farming:juicer"},
  35. {"group:water_bucket", "bucket:bucket_empty"}
  36. }
  37. })
  38. if minetest.get_modpath("bucket_wooden") then
  39. minetest.register_craft({
  40. output = "farming:mint_tea",
  41. type = "shapeless",
  42. recipe = {
  43. "vessels:drinking_glass", "group:food_mint",
  44. "group:food_mint", "group:food_mint",
  45. "farming:juicer", "group:water_bucket_wooden"
  46. },
  47. replacements = {
  48. {"group:food_juicer", "farming:juicer"},
  49. {"group:water_bucket_wooden", "bucket_wooden:bucket_empty"}
  50. }
  51. })
  52. end
  53. -- mint definition
  54. local def = {
  55. drawtype = "plantlike",
  56. tiles = {"farming_mint_1.png"},
  57. paramtype = "light",
  58. walkable = false,
  59. buildable_to = true,
  60. drop = "",
  61. selection_box = farming.select,
  62. groups = {
  63. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  64. not_in_creative_inventory = 1, growing = 1
  65. },
  66. sounds = default.node_sound_leaves_defaults()
  67. }
  68. -- stage 1
  69. minetest.register_node("farming:mint_1", table.copy(def))
  70. -- stage 2
  71. def.tiles = {"farming_mint_2.png"}
  72. minetest.register_node("farming:mint_2", table.copy(def))
  73. -- stage 3
  74. def.tiles = {"farming_mint_3.png"}
  75. minetest.register_node("farming:mint_3", table.copy(def))
  76. -- stage 4 (final)
  77. def.tiles = {"farming_mint_4.png"}
  78. def.groups.growing = nil
  79. def.drop = {
  80. items = {
  81. {items = {"farming:mint_leaf 2"}, rarity = 1},
  82. {items = {"farming:mint_leaf 2"}, rarity = 2},
  83. {items = {"farming:seed_mint 1"}, rarity = 1},
  84. {items = {"farming:seed_mint 2"}, rarity = 2},
  85. }
  86. }
  87. minetest.register_node("farming:mint_4", table.copy(def))
  88. -- add to registered_plants
  89. farming.registered_plants["farming:mint"] = {
  90. crop = "farming:mint",
  91. seed = "farming:seed_mint",
  92. minlight = farming.min_light,
  93. maxlight = farming.max_light,
  94. steps = 4
  95. }