peas.lua 2.4 KB

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