pumpkin.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. --[[
  2. Big thanks to PainterlyPack.net for allowing me to use these textures
  3. ]]
  4. local S = farming.intllib
  5. -- pumpkin slice
  6. minetest.register_craftitem("farming:pumpkin_slice", {
  7. description = S("Pumpkin Slice"),
  8. inventory_image = "farming_pumpkin_slice.png",
  9. groups = {seed = 2, food_pumpkin_slice = 1, flammable = 2},
  10. on_place = function(itemstack, placer, pointed_thing)
  11. return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
  12. end,
  13. on_use = minetest.item_eat(2),
  14. })
  15. minetest.register_craft({
  16. output = "farming:pumpkin",
  17. recipe = {
  18. {"farming:pumpkin_slice", "farming:pumpkin_slice"},
  19. {"farming:pumpkin_slice", "farming:pumpkin_slice"},
  20. }
  21. })
  22. minetest.register_craft({
  23. type = "shapeless",
  24. output = "farming:pumpkin_slice 4",
  25. recipe = {"farming:pumpkin", "farming:cutting_board"},
  26. replacements = {{"farming:cutting_board", "farming:cutting_board"}},
  27. })
  28. -- jack 'o lantern
  29. minetest.register_node("farming:jackolantern", {
  30. description = S("Jack 'O Lantern (punch to turn on and off)"),
  31. tiles = {
  32. "farming_pumpkin_top.png",
  33. "farming_pumpkin_top.png",
  34. "farming_pumpkin_side.png",
  35. "farming_pumpkin_side.png",
  36. "farming_pumpkin_side.png",
  37. "farming_pumpkin_face_off.png"
  38. },
  39. paramtype2 = "facedir",
  40. groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
  41. sounds = default.node_sound_wood_defaults(),
  42. on_punch = function(pos, node, puncher)
  43. local name = puncher:get_player_name() or ""
  44. if minetest.is_protected(pos, name) then return end
  45. node.name = "farming:jackolantern_on"
  46. minetest.swap_node(pos, node)
  47. end,
  48. })
  49. minetest.register_node("farming:jackolantern_on", {
  50. tiles = {
  51. "farming_pumpkin_top.png",
  52. "farming_pumpkin_top.png",
  53. "farming_pumpkin_side.png",
  54. "farming_pumpkin_side.png",
  55. "farming_pumpkin_side.png",
  56. "farming_pumpkin_face_on.png"
  57. },
  58. light_source = default.LIGHT_MAX - 1,
  59. paramtype2 = "facedir",
  60. groups = {
  61. choppy = 1, oddly_breakable_by_hand = 1, flammable = 2,
  62. not_in_creative_inventory = 1
  63. },
  64. sounds = default.node_sound_wood_defaults(),
  65. drop = "farming:jackolantern",
  66. on_punch = function(pos, node, puncher)
  67. local name = puncher:get_player_name() or ""
  68. if minetest.is_protected(pos, name) then return end
  69. node.name = "farming:jackolantern"
  70. minetest.swap_node(pos, node)
  71. end,
  72. })
  73. minetest.register_craft({
  74. output = "farming:jackolantern",
  75. recipe = {
  76. {"default:torch"},
  77. {"group:food_pumpkin"},
  78. }
  79. })
  80. --- wooden scarecrow base
  81. minetest.register_node("farming:scarecrow_bottom", {
  82. paramtype = "light",
  83. sunlight_propagates = true,
  84. paramtype2 = "facedir",
  85. tiles = {"default_wood.png"},
  86. drawtype = "nodebox",
  87. node_box = {
  88. type = "fixed",
  89. fixed = {
  90. {-1/16, -8/16, -1/16, 1/16, 8/16, 1/16},
  91. {-12/16, 4/16, -1/16, 12/16, 2/16, 1/16},
  92. },
  93. },
  94. groups = {snappy = 3, flammable = 2},
  95. })
  96. minetest.register_craft({
  97. output = "farming:scarecrow_bottom",
  98. recipe = {
  99. {"", "group:stick", "",},
  100. {"group:stick", "group:stick", "group:stick",},
  101. {"", "group:stick", "",}
  102. }
  103. })
  104. -- pumpkin bread
  105. minetest.register_craftitem("farming:pumpkin_bread", {
  106. description = S("Pumpkin Bread"),
  107. inventory_image = "farming_pumpkin_bread.png",
  108. on_use = minetest.item_eat(8),
  109. groups = {food_bread = 1, flammable = 2},
  110. })
  111. minetest.register_craftitem("farming:pumpkin_dough", {
  112. description = S("Pumpkin Dough"),
  113. inventory_image = "farming_pumpkin_dough.png",
  114. })
  115. minetest.register_craft({
  116. output = "farming:pumpkin_dough",
  117. type = "shapeless",
  118. recipe = {"group:food_flour", "group:food_pumpkin_slice", "group:food_pumpkin_slice"}
  119. })
  120. minetest.register_craft({
  121. type = "cooking",
  122. output = "farming:pumpkin_bread",
  123. recipe = "farming:pumpkin_dough",
  124. cooktime = 10
  125. })
  126. -- pumpkin definition
  127. local crop_def = {
  128. drawtype = "plantlike",
  129. tiles = {"farming_pumpkin_1.png"},
  130. paramtype = "light",
  131. sunlight_propagates = true,
  132. waving = 1,
  133. walkable = false,
  134. buildable_to = true,
  135. drop = "",
  136. selection_box = farming.select,
  137. groups = {
  138. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  139. not_in_creative_inventory = 1, growing = 1
  140. },
  141. sounds = default.node_sound_leaves_defaults()
  142. }
  143. -- stage 1
  144. minetest.register_node("farming:pumpkin_1", table.copy(crop_def))
  145. -- stage 2
  146. crop_def.tiles = {"farming_pumpkin_2.png"}
  147. minetest.register_node("farming:pumpkin_2", table.copy(crop_def))
  148. -- stage 3
  149. crop_def.tiles = {"farming_pumpkin_3.png"}
  150. minetest.register_node("farming:pumpkin_3", table.copy(crop_def))
  151. -- stage 4
  152. crop_def.tiles = {"farming_pumpkin_4.png"}
  153. minetest.register_node("farming:pumpkin_4", table.copy(crop_def))
  154. -- stage 5
  155. crop_def.tiles = {"farming_pumpkin_5.png"}
  156. minetest.register_node("farming:pumpkin_5", table.copy(crop_def))
  157. -- stage 6
  158. crop_def.tiles = {"farming_pumpkin_6.png"}
  159. minetest.register_node("farming:pumpkin_6", table.copy(crop_def))
  160. -- stage 7
  161. crop_def.tiles = {"farming_pumpkin_7.png"}
  162. minetest.register_node("farming:pumpkin_7", table.copy(crop_def))
  163. -- stage 8 (final)
  164. --[[
  165. crop_def.tiles = {"farming_pumpkin_8.png"}
  166. crop_def.groups.growing = 0
  167. crop_def.drop = {
  168. items = {
  169. {items = {"farming:pumpkin_slice 9"}, rarity = 1},
  170. }
  171. }
  172. minetest.register_node("farming:pumpkin_8", table.copy(crop_def))
  173. ]]
  174. minetest.register_node("farming:pumpkin_8", {
  175. description = S("Pumpkin"),
  176. tiles = {
  177. "farming_pumpkin_top.png",
  178. "farming_pumpkin_top.png",
  179. "farming_pumpkin_side.png"
  180. },
  181. groups = {
  182. food_pumpkin = 1, choppy = 1, oddly_breakable_by_hand = 1,
  183. flammable = 2, plant = 1
  184. },
  185. drop = "farming:pumpkin_8",
  186. sounds = default.node_sound_wood_defaults(),
  187. })
  188. minetest.register_alias("farming:pumpkin", "farming:pumpkin_8")
  189. -- add to registered_plants
  190. farming.registered_plants["farming:pumpkin"] = {
  191. crop = "farming:pumpkin",
  192. seed = "farming:pumpkin_slice",
  193. minlight = 13,
  194. maxlight = 15,
  195. steps = 8
  196. }