carrot.lua 3.0 KB

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