init.lua 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. --[[
  2. Big thanks to PainterlyPack.net for allowing me to use these textures
  3. ]]
  4. -- Pumpkin Seed
  5. minetest.register_node("pumpkin:seed", {
  6. description = "Pumpkin Seed",
  7. tiles = {"farming_pumpkin_seed.png"},
  8. wield_image = "farming_pumpkin_seed.png",
  9. inventory_image = "farming_pumpkin_seed.png",
  10. drawtype = "signlike",
  11. paramtype = "light",
  12. paramtype2 = "wallmounted",
  13. walkable = false,
  14. sunlight_propagates = true,
  15. selection_box = {
  16. type = "fixed",
  17. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  18. },
  19. groups = utility.dig_groups("seeds", {seed = 1, attached_node = 1, flammable = 2, notify_destruct = 1}),
  20. on_place = function(itemstack, placer, pointed_thing)
  21. return farming.place_seed(itemstack, placer, pointed_thing, "pumpkin:seed")
  22. end,
  23. on_timer = farming.grow_plant,
  24. minlight = 13,
  25. maxlight = 15,
  26. next_plant = "pumpkin:plant_1",
  27. fertility = {"grassland"},
  28. sounds = default.node_sound_dirt_defaults({
  29. dug = {name = "default_grass_footstep", gain = 0.2},
  30. place = {name = "default_place_node", gain = 0.25},
  31. }),
  32. })
  33. -- Pumpkin
  34. minetest.register_node("pumpkin:pumpkin", {
  35. description = "Pumpkin",
  36. tiles = {
  37. "farming_pumpkin_top.png",
  38. "farming_pumpkin_top.png",
  39. "farming_pumpkin_side.png"
  40. },
  41. paramtype2 = "facedir",
  42. groups = utility.dig_groups("bigitem", {
  43. flammable = 2, plant = 1
  44. }),
  45. sounds = default.node_sound_wood_defaults(),
  46. })
  47. -- Pumpkin Slice
  48. minetest.register_craftitem("pumpkin:slice", {
  49. description = "Pumpkin Slice",
  50. inventory_image = "farming_pumpkin_slice.png",
  51. on_use = minetest.item_eat(2),
  52. groups = {foodrot=1},
  53. })
  54. -- One pumpkin makes slightly more than enough to make 1 loaf of bread.
  55. minetest.register_craft({
  56. type = "shapeless",
  57. output = "pumpkin:slice 3",
  58. recipe = {"pumpkin:pumpkin"},
  59. })
  60. minetest.register_craft({
  61. type = "shapeless",
  62. output = "pumpkin:slice 4", -- use a cutting board to get slightly more
  63. recipe = {"pumpkin:pumpkin", "farming:cutting_board"},
  64. replacements = {{"farming:cutting_board", "farming:cutting_board"}},
  65. })
  66. -- Jack 'O Lantern
  67. minetest.register_node("pumpkin:lantern", {
  68. description = "Jack 'O Lantern",
  69. tiles = {
  70. "farming_pumpkin_top.png",
  71. "farming_pumpkin_top.png",
  72. "farming_pumpkin_side.png",
  73. "farming_pumpkin_side.png",
  74. "farming_pumpkin_side.png",
  75. "farming_pumpkin_face_off.png"
  76. },
  77. paramtype2 = "facedir",
  78. groups = utility.dig_groups("bigitem", {flammable = 2}),
  79. sounds = default.node_sound_wood_defaults(),
  80. on_punch = function(pos, node, puncher)
  81. node.name = "pumpkin:lantern_on"
  82. minetest.swap_node(pos, node)
  83. end,
  84. })
  85. minetest.register_node("pumpkin:lantern_on", {
  86. tiles = {
  87. "farming_pumpkin_top.png",
  88. "farming_pumpkin_top.png",
  89. "farming_pumpkin_side.png",
  90. "farming_pumpkin_side.png",
  91. "farming_pumpkin_side.png",
  92. "farming_pumpkin_face_on.png"
  93. },
  94. light_source = 12,
  95. paramtype2 = "facedir",
  96. groups = utility.dig_groups("bigitem", {
  97. flammable = 2,
  98. not_in_creative_inventory = 1
  99. }),
  100. sounds = default.node_sound_wood_defaults(),
  101. drop = "pumpkin:lantern",
  102. on_punch = function(pos, node, puncher)
  103. node.name = "pumpkin:lantern"
  104. minetest.swap_node(pos, node)
  105. end,
  106. })
  107. minetest.register_craft({
  108. type = "shapeless",
  109. output = "pumpkin:lantern",
  110. recipe = {"xdecor:candle", "pumpkin:pumpkin"},
  111. })
  112. -- Pumpkin Bread
  113. minetest.register_craftitem("pumpkin:bread", {
  114. description = "Pumpkin Bread",
  115. inventory_image = "farming_pumpkin_bread.png",
  116. on_use = minetest.item_eat(6),
  117. groups = {foodrot=1},
  118. })
  119. minetest.register_craftitem("pumpkin:dough", {
  120. description = "Pumpkin Dough",
  121. inventory_image = "farming_pumpkin_dough.png",
  122. groups = {foodrot=1},
  123. })
  124. minetest.register_craft({
  125. type = "shapeless",
  126. output = "pumpkin:dough",
  127. recipe = {"farming:flour", "pumpkin:slice", "pumpkin:slice"}
  128. })
  129. minetest.register_craft({
  130. type = "cooking",
  131. output = "pumpkin:bread",
  132. recipe = "pumpkin:dough",
  133. cooktime = 10,
  134. })
  135. -- Pumpkin plant definition.
  136. local crop_def = {
  137. drawtype = "plantlike",
  138. tiles = {"farming_pumpkin_1.png"},
  139. paramtype = "light",
  140. sunlight_propagates = true,
  141. waving = 1,
  142. walkable = false,
  143. buildable_to = true,
  144. drop = "",
  145. selection_box = {
  146. type = "fixed",
  147. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  148. },
  149. groups = utility.dig_groups("crop", {
  150. flammable = 2, plant = 1, attached_node = 1,
  151. not_in_creative_inventory = 1, notify_destruct = 1,
  152. }),
  153. sounds = default.node_sound_leaves_defaults(),
  154. on_timer = farming.grow_plant,
  155. minlight = 13,
  156. maxlight = default.LIGHT_MAX,
  157. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  158. }
  159. -- Stage 1.
  160. crop_def.next_plant = "pumpkin:plant_2"
  161. minetest.register_node("pumpkin:plant_1", table.copy(crop_def))
  162. -- Stage 2.
  163. crop_def.next_plant = "pumpkin:plant_3"
  164. crop_def.tiles = {"farming_pumpkin_2.png"}
  165. minetest.register_node("pumpkin:plant_2", table.copy(crop_def))
  166. -- Stage 3.
  167. crop_def.next_plant = "pumpkin:plant_4"
  168. crop_def.tiles = {"farming_pumpkin_3.png"}
  169. minetest.register_node("pumpkin:plant_3", table.copy(crop_def))
  170. -- Stage 4.
  171. crop_def.next_plant = "pumpkin:plant_5"
  172. crop_def.tiles = {"farming_pumpkin_4.png"}
  173. minetest.register_node("pumpkin:plant_4", table.copy(crop_def))
  174. -- Stage 5.
  175. crop_def.next_plant = "pumpkin:plant_6"
  176. crop_def.tiles = {"farming_pumpkin_5.png"}
  177. minetest.register_node("pumpkin:plant_5", table.copy(crop_def))
  178. -- Stage 6.
  179. crop_def.next_plant = "pumpkin:plant_7"
  180. crop_def.tiles = {"farming_pumpkin_6.png"}
  181. minetest.register_node("pumpkin:plant_6", table.copy(crop_def))
  182. -- Stage 7.
  183. crop_def.next_plant = "pumpkin:plant_8"
  184. crop_def.tiles = {"farming_pumpkin_7.png"}
  185. minetest.register_node("pumpkin:plant_7", table.copy(crop_def))
  186. -- Stage 8 (final).
  187. crop_def.tiles = {"farming_pumpkin_8.png"}
  188. crop_def.drop = {
  189. items = {
  190. {items = {"pumpkin:pumpkin"}, rarity = 1},
  191. {items = {"pumpkin:seed"}, rarity = 2},
  192. {items = {"pumpkin:seed"}, rarity = 2},
  193. {items = {"pumpkin:seed"}, rarity = 2},
  194. }
  195. }
  196. crop_def.next_plant = nil
  197. minetest.register_node("pumpkin:plant_8", table.copy(crop_def))