carrot.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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},
  22. })
  23. minetest.register_craft({
  24. output = "farming:carrot_juice",
  25. type = "shapeless",
  26. recipe = {
  27. "vessels:drinking_glass", "group:food_carrot", "farming:juicer"
  28. },
  29. replacements = {
  30. {"group:food_juicer", "farming:juicer"},
  31. },
  32. })
  33. -- golden carrot
  34. minetest.register_craftitem("farming:carrot_gold", {
  35. description = S("Golden Carrot"),
  36. inventory_image = "farming_carrot_gold.png",
  37. on_use = minetest.item_eat(6),
  38. })
  39. minetest.register_craft({
  40. output = "farming:carrot_gold",
  41. recipe = {
  42. {"", "default:gold_lump", ""},
  43. {"default:gold_lump", "group:food_carrot", "default:gold_lump"},
  44. {"", "default:gold_lump", ""},
  45. }
  46. })
  47. -- carrot definition
  48. local crop_def = {
  49. drawtype = "plantlike",
  50. tiles = {"farming_carrot_1.png"},
  51. paramtype = "light",
  52. sunlight_propagates = true,
  53. walkable = false,
  54. buildable_to = true,
  55. drop = "",
  56. selection_box = farming.select,
  57. groups = {
  58. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  59. not_in_creative_inventory = 1, growing = 1
  60. },
  61. sounds = default.node_sound_leaves_defaults()
  62. }
  63. -- stage 1
  64. minetest.register_node("farming:carrot_1", table.copy(crop_def))
  65. -- stage 2
  66. crop_def.tiles = {"farming_carrot_2.png"}
  67. minetest.register_node("farming:carrot_2", table.copy(crop_def))
  68. -- stage 3
  69. crop_def.tiles = {"farming_carrot_3.png"}
  70. minetest.register_node("farming:carrot_3", table.copy(crop_def))
  71. -- stage 4
  72. crop_def.tiles = {"farming_carrot_4.png"}
  73. minetest.register_node("farming:carrot_4", table.copy(crop_def))
  74. -- stage 5
  75. crop_def.tiles = {"farming_carrot_5.png"}
  76. minetest.register_node("farming:carrot_5", table.copy(crop_def))
  77. -- stage 6
  78. crop_def.tiles = {"farming_carrot_6.png"}
  79. minetest.register_node("farming:carrot_6", table.copy(crop_def))
  80. -- stage 7
  81. crop_def.tiles = {"farming_carrot_7.png"}
  82. crop_def.drop = {
  83. items = {
  84. {items = {"farming:carrot"}, rarity = 1},
  85. {items = {"farming:carrot 2"}, rarity = 3},
  86. }
  87. }
  88. minetest.register_node("farming:carrot_7", table.copy(crop_def))
  89. -- stage 8 (final)
  90. crop_def.tiles = {"farming_carrot_8.png"}
  91. crop_def.groups.growing = 0
  92. crop_def.drop = {
  93. items = {
  94. {items = {"farming:carrot 2"}, rarity = 1},
  95. {items = {"farming:carrot 3"}, rarity = 2},
  96. }
  97. }
  98. minetest.register_node("farming:carrot_8", table.copy(crop_def))
  99. -- add to registered_plants
  100. farming.registered_plants["farming:carrot"] = {
  101. crop = "farming:carrot",
  102. seed = "farming:carrot",
  103. minlight = 13,
  104. maxlight = 15,
  105. steps = 8
  106. }