mint.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. local S = farming.translate
  2. -- mint seed
  3. minetest.register_node("farming:seed_mint", {
  4. description = S("Mint Seeds"),
  5. tiles = {"farming_mint_seeds.png"},
  6. inventory_image = "farming_mint_seeds.png",
  7. wield_image = "farming_mint_seeds.png",
  8. drawtype = "signlike",
  9. groups = {
  10. compostability = 48, seed = 1, snappy = 3, attached_node = 1, growing = 1,
  11. flammable = 2
  12. },
  13. paramtype = "light",
  14. paramtype2 = "wallmounted",
  15. walkable = false,
  16. sunlight_propagates = true,
  17. selection_box = farming.select,
  18. next_plant = "farming:mint_1",
  19. on_place = function(itemstack, placer, pointed_thing)
  20. return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_mint")
  21. end
  22. })
  23. -- mint leaf
  24. minetest.register_craftitem("farming:mint_leaf", {
  25. description = S("Mint Leaf"),
  26. inventory_image = "farming_mint_leaf.png",
  27. groups = {compostability = 65, food_mint = 1, flammable = 4}
  28. })
  29. -- mint tea
  30. minetest.register_craftitem("farming:mint_tea", {
  31. description = S("Mint Tea"),
  32. inventory_image = "farming_mint_tea.png",
  33. on_use = minetest.item_eat(2, "vessels:drinking_glass"),
  34. groups = {flammable = 4}
  35. })
  36. local tmp = farming.use_utensils and "farming:juicer" or ""
  37. minetest.register_craft({
  38. output = "farming:mint_tea",
  39. recipe = {
  40. {"group:food_mint", "group:food_mint", "group:food_mint"},
  41. {"group:food_water_glass", tmp, ""}
  42. },
  43. replacements = {
  44. {"group:food_juicer", "farming:juicer"}
  45. }
  46. })
  47. -- mint definition
  48. local def = {
  49. drawtype = "plantlike",
  50. tiles = {"farming_mint_1.png"},
  51. paramtype = "light",
  52. walkable = false,
  53. buildable_to = true,
  54. drop = "",
  55. waving = 1,
  56. selection_box = farming.select,
  57. groups = {
  58. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  59. not_in_creative_inventory = 1, growing = 1
  60. },
  61. sounds = farming.sounds.node_sound_leaves_defaults()
  62. }
  63. -- stage 1
  64. minetest.register_node("farming:mint_1", table.copy(def))
  65. -- stage 2
  66. def.tiles = {"farming_mint_2.png"}
  67. minetest.register_node("farming:mint_2", table.copy(def))
  68. -- stage 3
  69. def.tiles = {"farming_mint_3.png"}
  70. minetest.register_node("farming:mint_3", table.copy(def))
  71. -- stage 4 (final)
  72. def.tiles = {"farming_mint_4.png"}
  73. def.groups.growing = nil
  74. def.selection_box = farming.select_final
  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. }
  92. -- mapgen
  93. minetest.register_decoration({
  94. deco_type = "simple",
  95. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass", "default:dirt_with_coniferous_litter"},
  96. sidelen = 16,
  97. noise_params = {
  98. offset = 0,
  99. scale = farming.mint,
  100. spread = {x = 100, y = 100, z = 100},
  101. seed = 801,
  102. octaves = 3,
  103. persist = 0.6
  104. },
  105. y_min = 0,
  106. y_max = 75,
  107. decoration = "farming:mint_4",
  108. spawn_by = {"group:water", "group:sand"},
  109. num_spawn_by = 1
  110. })