chili.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. local S = farming.intllib
  2. -- chili pepper
  3. minetest.register_craftitem("farming:chili_pepper", {
  4. description = S("Chili Pepper"),
  5. inventory_image = "farming_chili_pepper.png",
  6. groups = {seed = 2, food_chili_pepper = 1, flammable = 4},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1")
  9. end,
  10. on_use = minetest.item_eat(2),
  11. })
  12. -- bowl of chili
  13. minetest.register_craftitem("farming:chili_bowl", {
  14. description = S("Bowl of Chili"),
  15. inventory_image = "farming_chili_bowl.png",
  16. on_use = minetest.item_eat(8, "farming:bowl"),
  17. })
  18. minetest.register_craft({
  19. type = "shapeless",
  20. output = "farming:chili_bowl",
  21. recipe = {
  22. "group:food_chili_pepper", "group:food_barley", "group:food_pepper",
  23. "group:food_tomato", "group:food_onion", "group:food_bowl"
  24. },
  25. })
  26. -- chili can be used for red dye
  27. minetest.register_craft({
  28. output = "dye:red",
  29. recipe = {
  30. {"farming:chili_pepper"},
  31. }
  32. })
  33. -- chili definition
  34. local crop_def = {
  35. drawtype = "plantlike",
  36. tiles = {"farming_chili_1.png"},
  37. paramtype = "light",
  38. sunlight_propagates = true,
  39. walkable = false,
  40. buildable_to = true,
  41. drop = "",
  42. selection_box = farming.select,
  43. groups = {
  44. snappy = 3, flammable = 4, plant = 1, attached_node = 1,
  45. not_in_creative_inventory = 1, growing = 1
  46. },
  47. sounds = default.node_sound_leaves_defaults()
  48. }
  49. -- stage 1
  50. minetest.register_node("farming:chili_1", table.copy(crop_def))
  51. -- stage 2
  52. crop_def.tiles = {"farming_chili_2.png"}
  53. minetest.register_node("farming:chili_2", table.copy(crop_def))
  54. -- stage 3
  55. crop_def.tiles = {"farming_chili_3.png"}
  56. minetest.register_node("farming:chili_3", table.copy(crop_def))
  57. -- stage 4
  58. crop_def.tiles = {"farming_chili_4.png"}
  59. minetest.register_node("farming:chili_4", table.copy(crop_def))
  60. -- stage 5
  61. crop_def.tiles = {"farming_chili_5.png"}
  62. minetest.register_node("farming:chili_5", table.copy(crop_def))
  63. -- stage 6
  64. crop_def.tiles = {"farming_chili_6.png"}
  65. minetest.register_node("farming:chili_6", table.copy(crop_def))
  66. -- stage 7
  67. crop_def.tiles = {"farming_chili_7.png"}
  68. minetest.register_node("farming:chili_7", table.copy(crop_def))
  69. -- stage 8 (final)
  70. crop_def.tiles = {"farming_chili_8.png"}
  71. crop_def.groups.growing = 0
  72. crop_def.drop = {
  73. items = {
  74. {items = {"farming:chili_pepper 3"}, rarity = 1},
  75. {items = {"farming:chili_pepper 2"}, rarity = 2},
  76. }
  77. }
  78. minetest.register_node("farming:chili_8", table.copy(crop_def))
  79. -- add to registered_plants
  80. farming.registered_plants["farming:chili_pepper"] = {
  81. crop = "farming:chili",
  82. seed = "farming:chili_pepper",
  83. minlight = 13,
  84. maxlight = 15,
  85. steps = 8
  86. }