pumpkin.lua 5.4 KB

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