carrot.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. --[[
  2. Original textures from PixelBox texture pack
  3. https://forum.minetest.net/viewtopic.php?id=4990
  4. ]]
  5. local S = farming.intllib
  6. -- carrot
  7. minetest.register_craftitem("farming:carrot", {
  8. description = S("Carrot"),
  9. inventory_image = "farming_carrot.png",
  10. groups = {seed = 2, food_carrot = 1, flammable = 2},
  11. on_place = function(itemstack, placer, pointed_thing)
  12. return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
  13. end,
  14. on_use = minetest.item_eat(4)
  15. })
  16. -- carrot juice
  17. minetest.register_craftitem("farming:carrot_juice", {
  18. description = S("Carrot Juice"),
  19. inventory_image = "farming_carrot_juice.png",
  20. on_use = minetest.item_eat(4, "vessels:drinking_glass"),
  21. groups = {vessel = 1, drink = 1}
  22. })
  23. minetest.register_craft({
  24. output = "farming:carrot_juice",
  25. recipe = {
  26. {"group:food_carrot"},
  27. {"farming:juicer"},
  28. {"vessels:drinking_glass"}
  29. },
  30. replacements = {
  31. {"group:food_juicer", "farming:juicer"}
  32. }
  33. })
  34. -- golden carrot
  35. minetest.register_craftitem("farming:carrot_gold", {
  36. description = S("Golden Carrot"),
  37. inventory_image = "farming_carrot_gold.png",
  38. on_use = minetest.item_eat(10)
  39. })
  40. minetest.register_craft({
  41. output = "farming:carrot_gold",
  42. recipe = {
  43. {"", "default:gold_lump", ""},
  44. {"default:gold_lump", "group:food_carrot", "default:gold_lump"},
  45. {"", "default:gold_lump", ""}
  46. }
  47. })
  48. -- carrot definition
  49. local def = {
  50. drawtype = "plantlike",
  51. tiles = {"farming_carrot_1.png"},
  52. paramtype = "light",
  53. sunlight_propagates = true,
  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:carrot_1", table.copy(def))
  66. -- stage 2
  67. def.tiles = {"farming_carrot_2.png"}
  68. minetest.register_node("farming:carrot_2", table.copy(def))
  69. -- stage 3
  70. def.tiles = {"farming_carrot_3.png"}
  71. minetest.register_node("farming:carrot_3", table.copy(def))
  72. -- stage 4
  73. def.tiles = {"farming_carrot_4.png"}
  74. minetest.register_node("farming:carrot_4", table.copy(def))
  75. -- stage 5
  76. def.tiles = {"farming_carrot_5.png"}
  77. minetest.register_node("farming:carrot_5", table.copy(def))
  78. -- stage 6
  79. def.tiles = {"farming_carrot_6.png"}
  80. minetest.register_node("farming:carrot_6", table.copy(def))
  81. -- stage 7
  82. def.tiles = {"farming_carrot_7.png"}
  83. def.drop = {
  84. items = {
  85. {items = {"farming:carrot"}, rarity = 1},
  86. {items = {"farming:carrot 2"}, rarity = 3}
  87. }
  88. }
  89. minetest.register_node("farming:carrot_7", table.copy(def))
  90. -- stage 8 (final)
  91. def.tiles = {"farming_carrot_8.png"}
  92. def.groups.growing = nil
  93. def.drop = {
  94. items = {
  95. {items = {"farming:carrot 2"}, rarity = 1},
  96. {items = {"farming:carrot 3"}, rarity = 2}
  97. }
  98. }
  99. minetest.register_node("farming:carrot_8", table.copy(def))
  100. -- add to registered_plants
  101. farming.registered_plants["farming:carrot"] = {
  102. crop = "farming:carrot",
  103. seed = "farming:carrot",
  104. minlight = farming.min_light,
  105. maxlight = farming.max_light,
  106. steps = 8
  107. }