garlic.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. use_texture_alpha = "clip",
  43. paramtype = "light",
  44. paramtype2 = "facedir",
  45. tiles = {
  46. "crops_garlic_braid_side.png","crops_garlic_braid.png",
  47. "crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png",
  48. "crops_garlic_braid.png","crops_garlic_braid.png"
  49. },
  50. groups = {vessel = 1, dig_immediate = 3, flammable = 3},
  51. sounds = default.node_sound_leaves_defaults(),
  52. node_box = {
  53. type = "fixed",
  54. fixed = {
  55. {-0.13, -0.45, 0.5, 0.13, 0.45, 0.24}
  56. }
  57. }
  58. })
  59. minetest.register_craft({
  60. output = "farming:garlic_braid",
  61. recipe = {
  62. {"farming:garlic", "farming:garlic", "farming:garlic"},
  63. {"farming:garlic", "farming:garlic", "farming:garlic"},
  64. {"farming:garlic", "farming:garlic", "farming:garlic"}
  65. }
  66. })
  67. minetest.register_craft({
  68. type = "shapeless",
  69. output = "farming:garlic 9",
  70. recipe = {"farming:garlic_braid"}
  71. })
  72. -- crop definition
  73. local def = {
  74. drawtype = "plantlike",
  75. tiles = {"crops_garlic_plant_1.png"},
  76. paramtype = "light",
  77. paramtype2 = "meshoptions",
  78. place_param2 = 3,
  79. sunlight_propagates = true,
  80. waving = 1,
  81. walkable = false,
  82. buildable_to = true,
  83. drop = "",
  84. selection_box = farming.select,
  85. groups = {
  86. snappy = 3, flammable = 3, plant = 1, attached_node = 1,
  87. not_in_creative_inventory = 1, growing = 1
  88. },
  89. sounds = default.node_sound_leaves_defaults()
  90. }
  91. -- stage 1
  92. minetest.register_node("farming:garlic_1", table.copy(def))
  93. -- stage 2
  94. def.tiles = {"crops_garlic_plant_2.png"}
  95. minetest.register_node("farming:garlic_2", table.copy(def))
  96. -- stage 3
  97. def.tiles = {"crops_garlic_plant_3.png"}
  98. minetest.register_node("farming:garlic_3", table.copy(def))
  99. -- stage 4
  100. def.tiles = {"crops_garlic_plant_4.png"}
  101. minetest.register_node("farming:garlic_4", table.copy(def))
  102. -- stage 5
  103. def.tiles = {"crops_garlic_plant_5.png"}
  104. def.groups.growing = nil
  105. def.drop = {
  106. items = {
  107. {items = {"farming:garlic 3"}, rarity = 1},
  108. {items = {"farming:garlic"}, rarity = 2},
  109. {items = {"farming:garlic"}, rarity = 5}
  110. }
  111. }
  112. minetest.register_node("farming:garlic_5", table.copy(def))
  113. -- add to registered_plants
  114. farming.registered_plants["farming:garlic"] = {
  115. crop = "farming:garlic",
  116. seed = "farming:garlic_clove",
  117. minlight = farming.min_light,
  118. maxlight = farming.max_light,
  119. steps = 5
  120. }