mint.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. recipe = {
  28. {"group:food_mint", "group:food_mint", "group:food_mint"},
  29. {"group:water_bucket", "farming:juicer", "vessels:drinking_glass"}
  30. },
  31. replacements = {
  32. {"group:food_juicer", "farming:juicer"},
  33. {"group:water_bucket", "bucket:bucket_empty"}
  34. }
  35. })
  36. if minetest.get_modpath("bucket_wooden") then
  37. minetest.register_craft({
  38. output = "farming:mint_tea",
  39. recipe = {
  40. {"group:food_mint", "group:food_mint", "group:food_mint"},
  41. {"group:water_bucket_wooden", "farming:juicer", "vessels:drinking_glass"}
  42. },
  43. replacements = {
  44. {"group:food_juicer", "farming:juicer"},
  45. {"group:water_bucket_wooden", "bucket_wooden:bucket_empty"}
  46. }
  47. })
  48. end
  49. -- mint definition
  50. local def = {
  51. drawtype = "plantlike",
  52. tiles = {"farming_mint_1.png"},
  53. paramtype = "light",
  54. walkable = false,
  55. buildable_to = true,
  56. drop = "",
  57. selection_box = farming.select,
  58. groups = {
  59. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  60. not_in_creative_inventory = 1, growing = 1
  61. },
  62. sounds = default.node_sound_leaves_defaults()
  63. }
  64. -- stage 1
  65. minetest.register_node("farming:mint_1", table.copy(def))
  66. -- stage 2
  67. def.tiles = {"farming_mint_2.png"}
  68. minetest.register_node("farming:mint_2", table.copy(def))
  69. -- stage 3
  70. def.tiles = {"farming_mint_3.png"}
  71. minetest.register_node("farming:mint_3", table.copy(def))
  72. -- stage 4 (final)
  73. def.tiles = {"farming_mint_4.png"}
  74. def.groups.growing = nil
  75. def.drop = {
  76. items = {
  77. {items = {"farming:mint_leaf 2"}, rarity = 1},
  78. {items = {"farming:mint_leaf 2"}, rarity = 2},
  79. {items = {"farming:seed_mint 1"}, rarity = 1},
  80. {items = {"farming:seed_mint 2"}, rarity = 2}
  81. }
  82. }
  83. minetest.register_node("farming:mint_4", table.copy(def))
  84. -- add to registered_plants
  85. farming.registered_plants["farming:mint"] = {
  86. crop = "farming:mint",
  87. seed = "farming:seed_mint",
  88. minlight = farming.min_light,
  89. maxlight = farming.max_light,
  90. steps = 4
  91. }