pumpkin.lua 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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 = {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. node.name = "farming:jackolantern_on"
  44. minetest.swap_node(pos, node)
  45. end,
  46. })
  47. minetest.register_node("farming:jackolantern_on", {
  48. tiles = {
  49. "farming_pumpkin_top.png",
  50. "farming_pumpkin_top.png",
  51. "farming_pumpkin_side.png",
  52. "farming_pumpkin_side.png",
  53. "farming_pumpkin_side.png",
  54. "farming_pumpkin_face_on.png"
  55. },
  56. light_source = default.LIGHT_MAX - 1,
  57. paramtype2 = "facedir",
  58. groups = {
  59. choppy = 1, oddly_breakable_by_hand = 1, flammable = 2,
  60. not_in_creative_inventory = 1
  61. },
  62. sounds = default.node_sound_wood_defaults(),
  63. drop = "farming:jackolantern",
  64. on_punch = function(pos, node, puncher)
  65. node.name = "farming:jackolantern"
  66. minetest.swap_node(pos, node)
  67. end,
  68. })
  69. minetest.register_craft({
  70. output = "farming:jackolantern",
  71. recipe = {
  72. {"default:torch"},
  73. {"group:food_pumpkin"},
  74. }
  75. })
  76. --- wooden scarecrow base
  77. minetest.register_node("farming:scarecrow_bottom", {
  78. paramtype = "light",
  79. sunlight_propagates = true,
  80. paramtype2 = "facedir",
  81. tiles = {"default_wood.png"},
  82. drawtype = "nodebox",
  83. node_box = {
  84. type = "fixed",
  85. fixed = {
  86. {-1/16, -8/16, -1/16, 1/16, 8/16, 1/16},
  87. {-12/16, 4/16, -1/16, 12/16, 2/16, 1/16},
  88. },
  89. },
  90. groups = {snappy = 3, flammable = 2},
  91. })
  92. minetest.register_craft({
  93. output = "farming:scarecrow_bottom",
  94. recipe = {
  95. {"", "group:stick", "",},
  96. {"group:stick", "group:stick", "group:stick",},
  97. {"", "group:stick", "",}
  98. }
  99. })
  100. -- pumpkin bread
  101. minetest.register_craftitem("farming:pumpkin_bread", {
  102. description = S("Pumpkin Bread"),
  103. inventory_image = "farming_pumpkin_bread.png",
  104. on_use = minetest.item_eat(8),
  105. groups = {food_bread = 1, flammable = 2},
  106. })
  107. minetest.register_craftitem("farming:pumpkin_dough", {
  108. description = S("Pumpkin Dough"),
  109. inventory_image = "farming_pumpkin_dough.png",
  110. })
  111. minetest.register_craft({
  112. output = "farming:pumpkin_dough",
  113. type = "shapeless",
  114. recipe = {"group:food_flour", "group:food_pumpkin_slice", "group:food_pumpkin_slice"}
  115. })
  116. minetest.register_craft({
  117. type = "cooking",
  118. output = "farming:pumpkin_bread",
  119. recipe = "farming:pumpkin_dough",
  120. cooktime = 10
  121. })
  122. -- pumpkin definition
  123. local crop_def = {
  124. drawtype = "plantlike",
  125. tiles = {"farming_pumpkin_1.png"},
  126. paramtype = "light",
  127. sunlight_propagates = true,
  128. waving = 1,
  129. walkable = false,
  130. buildable_to = true,
  131. drop = "",
  132. selection_box = farming.select,
  133. groups = {
  134. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  135. not_in_creative_inventory = 1, growing = 1
  136. },
  137. sounds = default.node_sound_leaves_defaults()
  138. }
  139. -- stage 1
  140. minetest.register_node("farming:pumpkin_1", table.copy(crop_def))
  141. -- stage 2
  142. crop_def.tiles = {"farming_pumpkin_2.png"}
  143. minetest.register_node("farming:pumpkin_2", table.copy(crop_def))
  144. -- stage 3
  145. crop_def.tiles = {"farming_pumpkin_3.png"}
  146. minetest.register_node("farming:pumpkin_3", table.copy(crop_def))
  147. -- stage 4
  148. crop_def.tiles = {"farming_pumpkin_4.png"}
  149. minetest.register_node("farming:pumpkin_4", table.copy(crop_def))
  150. -- stage 5
  151. crop_def.tiles = {"farming_pumpkin_5.png"}
  152. minetest.register_node("farming:pumpkin_5", table.copy(crop_def))
  153. -- stage 6
  154. crop_def.tiles = {"farming_pumpkin_6.png"}
  155. minetest.register_node("farming:pumpkin_6", table.copy(crop_def))
  156. -- stage 7
  157. crop_def.tiles = {"farming_pumpkin_7.png"}
  158. minetest.register_node("farming:pumpkin_7", table.copy(crop_def))
  159. -- stage 8 (final)
  160. --[[
  161. crop_def.tiles = {"farming_pumpkin_8.png"}
  162. crop_def.groups.growing = 0
  163. crop_def.drop = {
  164. items = {
  165. {items = {'farming:pumpkin_slice 9'}, rarity = 1},
  166. }
  167. }
  168. minetest.register_node("farming:pumpkin_8", table.copy(crop_def))
  169. ]]
  170. minetest.register_node("farming:pumpkin_8", {
  171. description = S("Pumpkin"),
  172. tiles = {
  173. "farming_pumpkin_top.png",
  174. "farming_pumpkin_top.png",
  175. "farming_pumpkin_side.png"
  176. },
  177. groups = {
  178. food_pumpkin = 1, choppy = 1, oddly_breakable_by_hand = 1,
  179. flammable = 2, plant = 1
  180. },
  181. sounds = default.node_sound_wood_defaults(),
  182. })
  183. minetest.register_alias("farming:pumpkin", "farming:pumpkin_8")
  184. -- add to registered_plants
  185. farming.registered_plants["farming:pumpkin"] = {
  186. crop = "farming:pumpkin",
  187. seed = "farming:pumpkin_slice",
  188. minlight = 13,
  189. maxlight = 15,
  190. steps = 8
  191. }