peas.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. local S = farming.intllib
  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 = {seed = 2, food_pea_pod = 1, flammable = 2},
  8. on_place = function(itemstack, placer, pointed_thing)
  9. return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
  10. end
  11. })
  12. minetest.register_craftitem("farming:peas", {
  13. description = S("Peas"),
  14. inventory_image = "farming_pea_peas.png",
  15. groups = {food_peas = 1, flammable = 2},
  16. on_use = minetest.item_eat(1)
  17. })
  18. minetest.register_craft({
  19. output = "farming:peas",
  20. recipe = {{"farming:pea_pod"}}
  21. })
  22. -- pea soup
  23. minetest.register_craftitem("farming:pea_soup", {
  24. description = S("Pea Soup"),
  25. inventory_image = "farming_pea_soup.png",
  26. groups = {flammable = 2},
  27. on_use = minetest.item_eat(4, "farming:bowl")
  28. })
  29. minetest.register_craft({
  30. output = "farming:pea_soup",
  31. recipe = {
  32. {"group:food_peas"},
  33. {"group:food_peas"},
  34. {"group:food_bowl"}
  35. }
  36. })
  37. local def = {
  38. drawtype = "plantlike",
  39. tiles = {"farming_pea_1.png"},
  40. paramtype = "light",
  41. paramtype2 = "meshoptions",
  42. place_param2 = 3,
  43. sunlight_propagates = true,
  44. waving = 1,
  45. walkable = false,
  46. buildable_to = true,
  47. drop = "",
  48. selection_box = farming.select,
  49. groups = {
  50. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  51. not_in_creative_inventory = 1, growing = 1
  52. },
  53. sounds = default.node_sound_leaves_defaults()
  54. }
  55. -- stage 1
  56. minetest.register_node("farming:pea_1", table.copy(def))
  57. -- stage 2
  58. def.tiles = {"farming_pea_2.png"}
  59. minetest.register_node("farming:pea_2", table.copy(def))
  60. -- stage 3
  61. def.tiles = {"farming_pea_3.png"}
  62. minetest.register_node("farming:pea_3", table.copy(def))
  63. -- stage 4
  64. def.tiles = {"farming_pea_4.png"}
  65. minetest.register_node("farming:pea_4", table.copy(def))
  66. -- stage 5
  67. def.tiles = {"farming_pea_5.png"}
  68. def.groups.growing = nil
  69. def.drop = {
  70. max_items = 5, items = {
  71. {items = {"farming:pea_pod"}, rarity = 1},
  72. {items = {"farming:pea_pod"}, rarity = 2},
  73. {items = {"farming:pea_pod"}, rarity = 3},
  74. {items = {"farming:pea_pod"}, rarity = 5}
  75. }
  76. }
  77. minetest.register_node("farming:pea_5", table.copy(def))
  78. -- add to registered_plants
  79. farming.registered_plants["farming:pea_pod"] = {
  80. crop = "farming:pea",
  81. seed = "farming:pea_pod",
  82. minlight = farming.min_light,
  83. maxlight = farming.max_light,
  84. steps = 5
  85. }