pepper.lua 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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.intllib
  7. -- peppercorn (seed)
  8. minetest.register_craftitem("farming:peppercorn", {
  9. description = S("Peppercorn"),
  10. inventory_image = "crops_peppercorn.png",
  11. groups = {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}
  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},
  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},
  36. })
  37. minetest.register_craft({
  38. type = "shapeless",
  39. output = "farming:peppercorn",
  40. recipe = {"group:food_pepper"}
  41. })
  42. -- ground pepper
  43. minetest.register_node("farming:pepper_ground", {
  44. description = S("Ground Pepper"),
  45. inventory_image = "crops_pepper_ground.png",
  46. wield_image = "crops_pepper_ground.png",
  47. drawtype = "plantlike",
  48. visual_scale = 0.8,
  49. paramtype = "light",
  50. tiles = {"crops_pepper_ground.png"},
  51. groups = {
  52. vessel = 1, food_pepper_ground = 1,
  53. dig_immediate = 3, attached_node = 1
  54. },
  55. sounds = default.node_sound_defaults(),
  56. selection_box = {
  57. type = "fixed",
  58. fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
  59. }
  60. })
  61. minetest.register_craft( {
  62. output = "farming:pepper_ground",
  63. type = "shapeless",
  64. recipe = {"group:food_peppercorn", "vessels:glass_bottle", "farming:mortar_pestle"},
  65. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  66. })
  67. -- crop definition
  68. local def = {
  69. drawtype = "plantlike",
  70. tiles = {"crops_pepper_plant_1.png"},
  71. paramtype = "light",
  72. paramtype2 = "meshoptions",
  73. place_param2 = 1,
  74. sunlight_propagates = true,
  75. waving = 1,
  76. walkable = false,
  77. buildable_to = true,
  78. drop = "",
  79. selection_box = farming.select,
  80. groups = {
  81. snappy = 3, flammable = 3, plant = 1, attached_node = 1,
  82. not_in_creative_inventory = 1, growing = 1
  83. },
  84. sounds = default.node_sound_leaves_defaults()
  85. }
  86. -- stage 1
  87. minetest.register_node("farming:pepper_1", table.copy(def))
  88. -- stage 2
  89. def.tiles = {"crops_pepper_plant_2.png"}
  90. minetest.register_node("farming:pepper_2", table.copy(def))
  91. -- stage 3
  92. def.tiles = {"crops_pepper_plant_3.png"}
  93. minetest.register_node("farming:pepper_3", table.copy(def))
  94. -- stage 4
  95. def.tiles = {"crops_pepper_plant_4.png"}
  96. minetest.register_node("farming:pepper_4", table.copy(def))
  97. -- stage 5 (green pepper)
  98. def.tiles = {"crops_pepper_plant_5.png"}
  99. def.drop = {
  100. max_items = 2, items = {
  101. {items = {"farming:pepper 2"}, rarity = 1},
  102. {items = {"farming:pepper"}, rarity = 2},
  103. {items = {"farming:pepper"}, rarity = 3}
  104. }
  105. }
  106. minetest.register_node("farming:pepper_5", table.copy(def))
  107. -- stage 6 (yellow pepper)
  108. def.tiles = {"crops_pepper_plant_6.png"}
  109. def.drop = {
  110. max_items = 2, items = {
  111. {items = {'farming:pepper_yellow 2'}, rarity = 1},
  112. {items = {'farming:pepper_yellow'}, rarity = 2},
  113. {items = {'farming:pepper_yellow'}, rarity = 3},
  114. }
  115. }
  116. minetest.register_node("farming:pepper_6", table.copy(def))
  117. -- stage 7 (red pepper)
  118. def.tiles = {"crops_pepper_plant_7.png"}
  119. def.groups.growing = nil
  120. def.drop = {
  121. max_items = 2, items = {
  122. {items = {'farming:pepper_red 2'}, rarity = 1},
  123. {items = {'farming:pepper_red'}, rarity = 2},
  124. {items = {'farming:pepper_red'}, rarity = 3},
  125. }
  126. }
  127. minetest.register_node("farming:pepper_7", table.copy(def))
  128. -- add to registered_plants
  129. farming.registered_plants["farming:pepper"] = {
  130. crop = "farming:pepper",
  131. seed = "farming:peppercorn",
  132. minlight = farming.min_light,
  133. maxlight = farming.max_light,
  134. steps = 5
  135. }