pepper.lua 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. 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
  53. },
  54. sounds = default.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. minetest.register_craft( {
  61. output = "farming:pepper_ground",
  62. recipe = {
  63. {"group:food_peppercorn"},
  64. {"farming:mortar_pestle"},
  65. {"vessels:glass_bottle"}
  66. },
  67. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  68. })
  69. -- crop definition
  70. local def = {
  71. drawtype = "plantlike",
  72. tiles = {"crops_pepper_plant_1.png"},
  73. paramtype = "light",
  74. paramtype2 = "meshoptions",
  75. place_param2 = 1,
  76. sunlight_propagates = true,
  77. waving = 1,
  78. walkable = false,
  79. buildable_to = true,
  80. drop = "",
  81. selection_box = farming.select,
  82. groups = {
  83. snappy = 3, flammable = 3, plant = 1, attached_node = 1,
  84. not_in_creative_inventory = 1, growing = 1
  85. },
  86. sounds = default.node_sound_leaves_defaults()
  87. }
  88. -- stage 1
  89. minetest.register_node("farming:pepper_1", table.copy(def))
  90. -- stage 2
  91. def.tiles = {"crops_pepper_plant_2.png"}
  92. minetest.register_node("farming:pepper_2", table.copy(def))
  93. -- stage 3
  94. def.tiles = {"crops_pepper_plant_3.png"}
  95. minetest.register_node("farming:pepper_3", table.copy(def))
  96. -- stage 4
  97. def.tiles = {"crops_pepper_plant_4.png"}
  98. minetest.register_node("farming:pepper_4", table.copy(def))
  99. -- stage 5 (green pepper)
  100. def.tiles = {"crops_pepper_plant_5.png"}
  101. def.drop = {
  102. max_items = 2, items = {
  103. {items = {"farming:pepper 2"}, rarity = 1},
  104. {items = {"farming:pepper"}, rarity = 2},
  105. {items = {"farming:pepper"}, rarity = 3}
  106. }
  107. }
  108. minetest.register_node("farming:pepper_5", table.copy(def))
  109. -- stage 6 (yellow pepper)
  110. def.tiles = {"crops_pepper_plant_6.png"}
  111. def.drop = {
  112. max_items = 2, items = {
  113. {items = {"farming:pepper_yellow 2"}, rarity = 1},
  114. {items = {"farming:pepper_yellow"}, rarity = 2},
  115. {items = {"farming:pepper_yellow"}, rarity = 3}
  116. }
  117. }
  118. minetest.register_node("farming:pepper_6", table.copy(def))
  119. -- stage 7 (red pepper)
  120. def.tiles = {"crops_pepper_plant_7.png"}
  121. def.groups.growing = nil
  122. def.drop = {
  123. max_items = 2, items = {
  124. {items = {"farming:pepper_red 2"}, rarity = 1},
  125. {items = {"farming:pepper_red"}, rarity = 2},
  126. {items = {"farming:pepper_red"}, rarity = 3}
  127. }
  128. }
  129. minetest.register_node("farming:pepper_7", table.copy(def))
  130. -- add to registered_plants
  131. farming.registered_plants["farming:pepper"] = {
  132. crop = "farming:pepper",
  133. seed = "farming:peppercorn",
  134. minlight = farming.min_light,
  135. maxlight = farming.max_light,
  136. steps = 5
  137. }