peas.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. local S = farming.translate
  2. -- Textures for Pea crop and Peas were done by Andrey01
  3. -- pea pod
  4. minetest.register_craftitem("farming:pea_pod", {
  5. description = S("Pea Pod"),
  6. inventory_image = "farming_pea_pod.png",
  7. groups = {
  8. compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2
  9. },
  10. on_place = function(itemstack, placer, pointed_thing)
  11. return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
  12. end,
  13. on_use = minetest.item_eat(1)
  14. })
  15. -- replacement for separate peas item that was removed
  16. minetest.register_alias("farming:peas", "farming:pea_pod")
  17. -- pea soup
  18. minetest.register_craftitem("farming:pea_soup", {
  19. description = S("Pea Soup"),
  20. inventory_image = "farming_pea_soup.png",
  21. groups = {flammable = 2, compostability = 45},
  22. on_use = minetest.item_eat(4, "farming:bowl")
  23. })
  24. minetest.register_craft({
  25. output = "farming:pea_soup",
  26. recipe = {
  27. {"group:food_peas"},
  28. {"group:food_peas"},
  29. {"group:food_bowl"}
  30. }
  31. })
  32. local def = {
  33. drawtype = "plantlike",
  34. tiles = {"farming_pea_1.png"},
  35. paramtype = "light",
  36. paramtype2 = "meshoptions",
  37. place_param2 = 3,
  38. sunlight_propagates = true,
  39. waving = 1,
  40. walkable = false,
  41. buildable_to = true,
  42. drop = "",
  43. selection_box = farming.select,
  44. groups = {
  45. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  46. not_in_creative_inventory = 1, growing = 1
  47. },
  48. sounds = farming.sounds.node_sound_leaves_defaults()
  49. }
  50. -- stage 1
  51. minetest.register_node("farming:pea_1", table.copy(def))
  52. -- stage 2
  53. def.tiles = {"farming_pea_2.png"}
  54. minetest.register_node("farming:pea_2", table.copy(def))
  55. -- stage 3
  56. def.tiles = {"farming_pea_3.png"}
  57. minetest.register_node("farming:pea_3", table.copy(def))
  58. -- stage 4
  59. def.tiles = {"farming_pea_4.png"}
  60. minetest.register_node("farming:pea_4", table.copy(def))
  61. -- stage 5
  62. def.tiles = {"farming_pea_5.png"}
  63. def.groups.growing = nil
  64. def.selection_box = farming.select_final
  65. def.drop = {
  66. max_items = 5, items = {
  67. {items = {"farming:pea_pod"}, rarity = 1},
  68. {items = {"farming:pea_pod"}, rarity = 2},
  69. {items = {"farming:pea_pod"}, rarity = 3},
  70. {items = {"farming:pea_pod"}, rarity = 5}
  71. }
  72. }
  73. minetest.register_node("farming:pea_5", table.copy(def))
  74. -- add to registered_plants
  75. farming.registered_plants["farming:pea_pod"] = {
  76. crop = "farming:pea",
  77. seed = "farming:pea_pod",
  78. minlight = farming.min_light,
  79. maxlight = farming.max_light,
  80. steps = 5
  81. }
  82. -- mapgen
  83. minetest.register_decoration({
  84. deco_type = "simple",
  85. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  86. sidelen = 16,
  87. noise_params = {
  88. offset = 0,
  89. scale = farming.peas,
  90. spread = {x = 100, y = 100, z = 100},
  91. seed = 132,
  92. octaves = 3,
  93. persist = 0.6
  94. },
  95. y_min = 25,
  96. y_max = 55,
  97. decoration = "farming:pea_5"
  98. })