melon.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. local S = farming.intllib
  2. -- melon
  3. minetest.register_craftitem("farming:melon_slice", {
  4. description = S("Melon Slice"),
  5. inventory_image = "farming_melon_slice.png",
  6. groups = {seed = 2, food_melon_slice = 1, flammable = 3},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
  9. end,
  10. on_use = minetest.item_eat(2)
  11. })
  12. minetest.register_craft({
  13. output = "farming:melon_8",
  14. recipe = {
  15. {"farming:melon_slice", "farming:melon_slice"},
  16. {"farming:melon_slice", "farming:melon_slice"}
  17. }
  18. })
  19. minetest.register_craft({
  20. output = "farming:melon_slice 4",
  21. recipe = {{"farming:cutting_board", "farming:melon_8"}},
  22. replacements = {{"farming:cutting_board", "farming:cutting_board"}}
  23. })
  24. -- melon definition
  25. local def = {
  26. drawtype = "plantlike",
  27. tiles = {"farming_melon_1.png"},
  28. paramtype = "light",
  29. sunlight_propagates = true,
  30. walkable = false,
  31. buildable_to = true,
  32. drop = "",
  33. selection_box = farming.select,
  34. groups = {
  35. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  36. not_in_creative_inventory = 1, growing = 1
  37. },
  38. sounds = default.node_sound_leaves_defaults()
  39. }
  40. -- stage 1
  41. minetest.register_node("farming:melon_1", table.copy(def))
  42. -- stage 2
  43. def.tiles = {"farming_melon_2.png"}
  44. minetest.register_node("farming:melon_2", table.copy(def))
  45. -- stage 3
  46. def.tiles = {"farming_melon_3.png"}
  47. minetest.register_node("farming:melon_3", table.copy(def))
  48. -- stage 4
  49. def.tiles = {"farming_melon_4.png"}
  50. minetest.register_node("farming:melon_4", table.copy(def))
  51. -- stage 5
  52. def.tiles = {"farming_melon_5.png"}
  53. minetest.register_node("farming:melon_5", table.copy(def))
  54. -- stage 6
  55. def.tiles = {"farming_melon_6.png"}
  56. minetest.register_node("farming:melon_6", table.copy(def))
  57. -- stage 7
  58. def.tiles = {"farming_melon_7.png"}
  59. minetest.register_node("farming:melon_7", table.copy(def))
  60. -- stage 8 (final)
  61. minetest.register_node("farming:melon_8", {
  62. description = S("Melon"),
  63. tiles = {
  64. "farming_melon_top.png",
  65. "farming_melon_bottom.png",
  66. "farming_melon_side.png"
  67. },
  68. groups = {
  69. food_melon = 1, snappy = 2, oddly_breakable_by_hand = 1,
  70. flammable = 2, plant = 1
  71. },
  72. drop = "farming:melon_8",
  73. sounds = default.node_sound_wood_defaults(),
  74. paramtype2 = "facedir",
  75. on_place = minetest.rotate_node
  76. })
  77. -- add to registered_plants
  78. farming.registered_plants["farming:melon"] = {
  79. crop = "farming:melon",
  80. seed = "farming:melon_slice",
  81. minlight = farming.min_light,
  82. maxlight = farming.max_light,
  83. steps = 8
  84. }