garlic.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. --[[
  2. Original textures from Crops Plus mod
  3. Copyright (C) 2018 Grizzly Adam
  4. https://forum.minetest.net/viewtopic.php?f=9&t=19488
  5. ]]
  6. local S = farming.intllib
  7. -- potato
  8. minetest.register_craftitem("farming:garlic_clove", {
  9. description = S("Garlic clove"),
  10. inventory_image = "crops_garlic_clove.png",
  11. groups = {seed = 2, food_garlic_clove = 1, flammable = 3},
  12. on_place = function(itemstack, placer, pointed_thing)
  13. return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1")
  14. end,
  15. })
  16. -- garlic bulb
  17. minetest.register_craftitem("farming:garlic", {
  18. description = S("Garlic"),
  19. inventory_image = "crops_garlic.png",
  20. on_use = minetest.item_eat(1),
  21. groups = {food_garlic = 1, flammable = 3},
  22. })
  23. minetest.register_craft({
  24. type = "shapeless",
  25. output = "farming:garlic_clove 8",
  26. recipe = { "farming:garlic" }
  27. })
  28. minetest.register_craft({
  29. output = "farming:garlic",
  30. recipe = {
  31. {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"},
  32. {"farming:garlic_clove", "", "farming:garlic_clove"},
  33. {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}
  34. }
  35. })
  36. -- garlic braid
  37. minetest.register_node("farming:garlic_braid", {
  38. description = S("Garlic Braid"),
  39. inventory_image = "crops_garlic_braid.png",
  40. wield_image = "crops_garlic_braid.png",
  41. drawtype = "nodebox",
  42. paramtype = "light",
  43. paramtype2 = "facedir",
  44. tiles = {
  45. "crops_garlic_braid_side.png","crops_garlic_braid.png",
  46. "crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png",
  47. "crops_garlic_braid.png","crops_garlic_braid.png"
  48. },
  49. groups = {vessel = 1, dig_immediate = 3, flammable = 3},
  50. sounds = default.node_sound_leaves_defaults(),
  51. node_box = {
  52. type = "fixed",
  53. fixed = {
  54. {-0.13, -0.45, 0.5, 0.13, 0.45, 0.24},
  55. },
  56. }
  57. })
  58. minetest.register_craft({
  59. output = "farming:garlic_braid",
  60. recipe = {
  61. {"farming:garlic", "farming:garlic", "farming:garlic"},
  62. {"farming:garlic", "farming:garlic", "farming:garlic"},
  63. {"farming:garlic", "farming:garlic", "farming:garlic"}
  64. }
  65. })
  66. minetest.register_craft({
  67. type = "shapeless",
  68. output = "farming:garlic 9",
  69. recipe = { "farming:garlic_braid" }
  70. })
  71. -- crop definition
  72. local crop_def = {
  73. drawtype = "plantlike",
  74. tiles = {"crops_garlic_plant_1.png"},
  75. paramtype = "light",
  76. paramtype2 = "meshoptions",
  77. place_param2 = 3,
  78. sunlight_propagates = true,
  79. waving = 1,
  80. walkable = false,
  81. buildable_to = true,
  82. drop = "",
  83. selection_box = farming.select,
  84. groups = {
  85. snappy = 3, flammable = 3, plant = 1, attached_node = 1,
  86. not_in_creative_inventory = 1, growing = 1
  87. },
  88. sounds = default.node_sound_leaves_defaults()
  89. }
  90. -- stage 1
  91. minetest.register_node("farming:garlic_1", table.copy(crop_def))
  92. -- stage 2
  93. crop_def.tiles = {"crops_garlic_plant_2.png"}
  94. minetest.register_node("farming:garlic_2", table.copy(crop_def))
  95. -- stage 3
  96. crop_def.tiles = {"crops_garlic_plant_3.png"}
  97. minetest.register_node("farming:garlic_3", table.copy(crop_def))
  98. -- stage 4
  99. crop_def.tiles = {"crops_garlic_plant_4.png"}
  100. minetest.register_node("farming:garlic_4", table.copy(crop_def))
  101. -- stage 5
  102. crop_def.tiles = {"crops_garlic_plant_5.png"}
  103. crop_def.groups.growing = 0
  104. crop_def.drop = {
  105. max_items = 5, items = {
  106. {items = {"farming:garlic"}, rarity = 1},
  107. {items = {"farming:garlic"}, rarity = 1},
  108. {items = {"farming:garlic"}, rarity = 1},
  109. {items = {"farming:garlic"}, rarity = 2},
  110. {items = {"farming:garlic"}, rarity = 5},
  111. }
  112. }
  113. minetest.register_node("farming:garlic_5", table.copy(crop_def))
  114. -- add to registered_plants
  115. farming.registered_plants["farming:garlic"] = {
  116. crop = "farming:garlic",
  117. seed = "farming:garlic_clove",
  118. minlight = 13,
  119. maxlight = 15,
  120. steps = 5
  121. }