pepper.lua 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. --[[
  2. Original textures from Crops Plus mod
  3. Copyright (C) 2018 Grizzly Adam
  4. https://forum.minetest.net/viewtopic.php?f=9&t=19488
  5. ]]
  6. local S = farming.translate
  7. -- peppercorn (seed)
  8. minetest.register_craftitem("farming:peppercorn", {
  9. description = S("Peppercorn"),
  10. inventory_image = "crops_peppercorn.png",
  11. groups = {compostability = 48, seed = 1, food_peppercorn = 1, flammable = 3},
  12. on_place = function(itemstack, placer, pointed_thing)
  13. return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1")
  14. end
  15. })
  16. -- green pepper
  17. minetest.register_craftitem("farming:pepper", {
  18. description = S("Green Pepper"),
  19. inventory_image = "crops_pepper.png",
  20. on_use = minetest.item_eat(2),
  21. groups = {food_pepper = 1, flammable = 3, compostability = 55}
  22. })
  23. -- yellow pepper
  24. minetest.register_craftitem("farming:pepper_yellow", {
  25. description = S("Yellow Pepper"),
  26. inventory_image = "crops_pepper_yellow.png",
  27. on_use = minetest.item_eat(3),
  28. groups = {food_pepper = 1, flammable = 3, compostability = 55}
  29. })
  30. -- red pepper
  31. minetest.register_craftitem("farming:pepper_red", {
  32. description = S("Red Pepper"),
  33. inventory_image = "crops_pepper_red.png",
  34. on_use = minetest.item_eat(4),
  35. groups = {food_pepper = 1, flammable = 3, compostability = 55}
  36. })
  37. minetest.register_craft({
  38. output = "farming:peppercorn",
  39. recipe = {{"group:food_pepper"}}
  40. })
  41. -- ground pepper
  42. minetest.register_node("farming:pepper_ground", {
  43. description = S("Ground Pepper"),
  44. inventory_image = "crops_pepper_ground.png",
  45. wield_image = "crops_pepper_ground.png",
  46. drawtype = "plantlike",
  47. visual_scale = 0.8,
  48. paramtype = "light",
  49. tiles = {"crops_pepper_ground.png"},
  50. groups = {
  51. vessel = 1, food_pepper_ground = 1,
  52. dig_immediate = 3, attached_node = 1, compostability = 30
  53. },
  54. sounds = farming.sounds.node_sound_defaults(),
  55. selection_box = {
  56. type = "fixed",
  57. fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
  58. }
  59. })
  60. local tmp = farming.use_utensils and "farming:mortar_pestle" or ""
  61. minetest.register_craft( {
  62. output = "farming:pepper_ground",
  63. recipe = {
  64. {"group:food_peppercorn"},
  65. {"vessels:glass_bottle"},
  66. {tmp}
  67. },
  68. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  69. })
  70. -- crop definition
  71. local def = {
  72. drawtype = "plantlike",
  73. tiles = {"crops_pepper_plant_1.png"},
  74. paramtype = "light",
  75. paramtype2 = "meshoptions",
  76. place_param2 = 1,
  77. sunlight_propagates = true,
  78. waving = 1,
  79. walkable = false,
  80. buildable_to = true,
  81. drop = "",
  82. selection_box = farming.select,
  83. groups = {
  84. handy = 1, snappy = 3, flammable = 3, plant = 1, attached_node = 1,
  85. not_in_creative_inventory = 1, growing = 1
  86. },
  87. sounds = farming.sounds.node_sound_leaves_defaults()
  88. }
  89. -- stage 1
  90. minetest.register_node("farming:pepper_1", table.copy(def))
  91. -- stage 2
  92. def.tiles = {"crops_pepper_plant_2.png"}
  93. minetest.register_node("farming:pepper_2", table.copy(def))
  94. -- stage 3
  95. def.tiles = {"crops_pepper_plant_3.png"}
  96. minetest.register_node("farming:pepper_3", table.copy(def))
  97. -- stage 4
  98. def.tiles = {"crops_pepper_plant_4.png"}
  99. minetest.register_node("farming:pepper_4", table.copy(def))
  100. -- stage 5 (green pepper)
  101. def.tiles = {"crops_pepper_plant_5.png"}
  102. def.selection_box = farming.select_final
  103. def.drop = {
  104. max_items = 2, items = {
  105. {items = {"farming:pepper 2"}, rarity = 1},
  106. {items = {"farming:pepper"}, rarity = 2},
  107. {items = {"farming:pepper"}, rarity = 3}
  108. }
  109. }
  110. minetest.register_node("farming:pepper_5", table.copy(def))
  111. -- stage 6 (yellow pepper)
  112. def.tiles = {"crops_pepper_plant_6.png"}
  113. def.drop = {
  114. max_items = 2, items = {
  115. {items = {"farming:pepper_yellow 2"}, rarity = 1},
  116. {items = {"farming:pepper_yellow"}, rarity = 2},
  117. {items = {"farming:pepper_yellow"}, rarity = 3}
  118. }
  119. }
  120. minetest.register_node("farming:pepper_6", table.copy(def))
  121. -- stage 7 (red pepper)
  122. def.tiles = {"crops_pepper_plant_7.png"}
  123. def.groups.growing = nil
  124. def.drop = {
  125. max_items = 2, items = {
  126. {items = {"farming:pepper_red 2"}, rarity = 1},
  127. {items = {"farming:pepper_red"}, rarity = 2},
  128. {items = {"farming:pepper_red"}, rarity = 3}
  129. }
  130. }
  131. minetest.register_node("farming:pepper_7", table.copy(def))
  132. -- add to registered_plants
  133. farming.registered_plants["farming:pepper"] = {
  134. crop = "farming:pepper",
  135. seed = "farming:peppercorn",
  136. minlight = farming.min_light,
  137. maxlight = farming.max_light,
  138. steps = 5
  139. }
  140. -- mapgen
  141. local mg = farming.mapgen == "v6"
  142. def = {
  143. grow_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_rainforest_litter"}
  144. }
  145. minetest.register_decoration({
  146. deco_type = "simple",
  147. place_on = def.grow_on,
  148. sidelen = 16,
  149. noise_params = {
  150. offset = 0,
  151. scale = farming.pepper,
  152. spread = {x = 100, y = 100, z = 100},
  153. seed = 243,
  154. octaves = 3,
  155. persist = 0.6
  156. },
  157. y_min = 5,
  158. y_max = 35,
  159. decoration = {"farming:pepper_5", "farming:pepper_6", "farming:pepper_7"},
  160. spawn_by = "group:tree",
  161. num_spawn_by = 1
  162. })