chili.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. local S = farming.translate
  2. -- chili pepper
  3. minetest.register_craftitem("farming:chili_pepper", {
  4. description = S("Chili Pepper"),
  5. inventory_image = "farming_chili_pepper.png",
  6. groups = {compostability = 48, 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. groups = {compostability = 65}
  18. })
  19. minetest.register_craft({
  20. output = "farming:chili_bowl",
  21. recipe = {
  22. {"group:food_chili_pepper", "group:food_rice", "group:food_tomato"},
  23. {"group:food_beans", "group:food_bowl", ""}
  24. }
  25. })
  26. -- chili can be used for red dye
  27. minetest.register_craft({
  28. output = farming.mcl and "mcl_dye:red" or "dye:red",
  29. recipe = {{"farming:chili_pepper"}}
  30. })
  31. -- chili powder
  32. minetest.register_craftitem("farming:chili_powder", {
  33. description = S("Chili Powder"),
  34. on_use = minetest.item_eat(-1),
  35. inventory_image = "farming_chili_powder.png",
  36. groups = {compostability = 45}
  37. })
  38. local tmp = farming.use_utensils and "farming:mortar_pestle" or ""
  39. minetest.register_craft({
  40. output = "farming:chili_powder",
  41. recipe = {
  42. {"farming:chili_pepper", tmp}
  43. },
  44. replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}
  45. })
  46. -- chili definition
  47. local def = {
  48. drawtype = "plantlike",
  49. tiles = {"farming_chili_1.png"},
  50. paramtype = "light",
  51. sunlight_propagates = true,
  52. walkable = false,
  53. buildable_to = true,
  54. drop = "",
  55. waving = 1,
  56. selection_box = farming.select,
  57. groups = {
  58. handy = 1, snappy = 3, flammable = 4, plant = 1, attached_node = 1,
  59. not_in_creative_inventory = 1, growing = 1
  60. },
  61. sounds = farming.sounds.node_sound_leaves_defaults()
  62. }
  63. -- stage 1
  64. minetest.register_node("farming:chili_1", table.copy(def))
  65. -- stage 2
  66. def.tiles = {"farming_chili_2.png"}
  67. minetest.register_node("farming:chili_2", table.copy(def))
  68. -- stage 3
  69. def.tiles = {"farming_chili_3.png"}
  70. minetest.register_node("farming:chili_3", table.copy(def))
  71. -- stage 4
  72. def.tiles = {"farming_chili_4.png"}
  73. minetest.register_node("farming:chili_4", table.copy(def))
  74. -- stage 5
  75. def.tiles = {"farming_chili_5.png"}
  76. minetest.register_node("farming:chili_5", table.copy(def))
  77. -- stage 6
  78. def.tiles = {"farming_chili_6.png"}
  79. minetest.register_node("farming:chili_6", table.copy(def))
  80. -- stage 7
  81. def.tiles = {"farming_chili_7.png"}
  82. minetest.register_node("farming:chili_7", table.copy(def))
  83. -- stage 8 (final)
  84. def.tiles = {"farming_chili_8.png"}
  85. def.groups.growing = nil
  86. def.selection_box = farming.select_final
  87. def.drop = {
  88. items = {
  89. {items = {"farming:chili_pepper 3"}, rarity = 1},
  90. {items = {"farming:chili_pepper 2"}, rarity = 2}
  91. }
  92. }
  93. minetest.register_node("farming:chili_8", table.copy(def))
  94. -- add to registered_plants
  95. farming.registered_plants["farming:chili_pepper"] = {
  96. crop = "farming:chili",
  97. seed = "farming:chili_pepper",
  98. minlight = farming.min_light,
  99. maxlight = farming.max_light,
  100. steps = 8
  101. }
  102. -- mapgen
  103. minetest.register_decoration({
  104. deco_type = "simple",
  105. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
  106. sidelen = 16,
  107. noise_params = {
  108. offset = 0,
  109. scale = farming.chili,
  110. spread = {x = 100, y = 100, z = 100},
  111. seed = 901,
  112. octaves = 3,
  113. persist = 0.6
  114. },
  115. y_min = 5,
  116. y_max = 35,
  117. decoration = {"farming:chili_8"},
  118. spawn_by = "group:tree",
  119. num_spawn_by = 1
  120. })