beetroot.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. local S = farming.translate
  2. -- beetroot
  3. minetest.register_craftitem("farming:beetroot", {
  4. description = S("Beetroot"),
  5. inventory_image = "farming_beetroot.png",
  6. groups = {compostability = 48, seed = 2, food_beetroot = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1")
  9. end,
  10. on_use = minetest.item_eat(1)
  11. })
  12. -- beetroot soup
  13. minetest.register_craftitem("farming:beetroot_soup", {
  14. description = S("Beetroot Soup"),
  15. inventory_image = "farming_beetroot_soup.png",
  16. groups = {flammable = 2},
  17. on_use = minetest.item_eat(6, "farming:bowl")
  18. })
  19. minetest.register_craft({
  20. output = "farming:beetroot_soup",
  21. recipe = {
  22. {"group:food_beetroot", "group:food_beetroot", "group:food_beetroot"},
  23. {"group:food_beetroot", "group:food_bowl", "group:food_beetroot"}
  24. }
  25. })
  26. -- red dye
  27. minetest.register_craft({
  28. output = "dye:red",
  29. recipe = {{"group:food_beetroot"}}
  30. })
  31. local def = {
  32. drawtype = "plantlike",
  33. tiles = {"farming_beetroot_1.png"},
  34. paramtype = "light",
  35. sunlight_propagates = true,
  36. waving = 1,
  37. walkable = false,
  38. buildable_to = true,
  39. drop = "",
  40. selection_box = farming.select,
  41. groups = {
  42. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  43. not_in_creative_inventory = 1, growing = 1
  44. },
  45. sounds = farming.sounds.node_sound_leaves_defaults()
  46. }
  47. -- stage 1
  48. minetest.register_node("farming:beetroot_1", table.copy(def))
  49. -- stage 2
  50. def.tiles = {"farming_beetroot_2.png"}
  51. minetest.register_node("farming:beetroot_2", table.copy(def))
  52. -- stage 3
  53. def.tiles = {"farming_beetroot_3.png"}
  54. minetest.register_node("farming:beetroot_3", table.copy(def))
  55. -- stage 4
  56. def.tiles = {"farming_beetroot_4.png"}
  57. minetest.register_node("farming:beetroot_4", table.copy(def))
  58. -- stage 5
  59. def.tiles = {"farming_beetroot_5.png"}
  60. def.groups.growing = nil
  61. def.selection_box = farming.select_final
  62. def.drop = {
  63. max_items = 4, items = {
  64. {items = {"farming:beetroot"}, rarity = 1},
  65. {items = {"farming:beetroot"}, rarity = 2},
  66. {items = {"farming:beetroot"}, rarity = 3},
  67. {items = {"farming:beetroot"}, rarity = 4}
  68. }
  69. }
  70. minetest.register_node("farming:beetroot_5", table.copy(def))
  71. -- add to registered_plants
  72. farming.registered_plants["farming:beetroot"] = {
  73. crop = "farming:beetroot",
  74. seed = "farming:beetroot",
  75. minlight = farming.min_light,
  76. maxlight = farming.max_light,
  77. steps = 5
  78. }
  79. -- mapgen
  80. minetest.register_decoration({
  81. deco_type = "simple",
  82. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  83. sidelen = 16,
  84. noise_params = {
  85. offset = 0,
  86. scale = farming.beetroot,
  87. spread = {x = 100, y = 100, z = 100},
  88. seed = 456,
  89. octaves = 3,
  90. persist = 0.6
  91. },
  92. y_min = 1,
  93. y_max = 20,
  94. decoration = "farming:beetroot_5"
  95. })