melon.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. type = "shapeless",
  21. output = "farming:melon_slice 4",
  22. recipe = {"farming:melon_8", "farming:cutting_board"},
  23. replacements = {{"farming:cutting_board", "farming:cutting_board"}},
  24. })
  25. -- melon definition
  26. local crop_def = {
  27. drawtype = "plantlike",
  28. tiles = {"farming_melon_1.png"},
  29. paramtype = "light",
  30. sunlight_propagates = true,
  31. walkable = false,
  32. buildable_to = true,
  33. drop = "",
  34. selection_box = farming.select,
  35. groups = {
  36. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  37. not_in_creative_inventory = 1, growing = 1
  38. },
  39. sounds = default.node_sound_leaves_defaults()
  40. }
  41. -- stage 1
  42. minetest.register_node("farming:melon_1", table.copy(crop_def))
  43. -- stage 2
  44. crop_def.tiles = {"farming_melon_2.png"}
  45. minetest.register_node("farming:melon_2", table.copy(crop_def))
  46. -- stage 3
  47. crop_def.tiles = {"farming_melon_3.png"}
  48. minetest.register_node("farming:melon_3", table.copy(crop_def))
  49. -- stage 4
  50. crop_def.tiles = {"farming_melon_4.png"}
  51. minetest.register_node("farming:melon_4", table.copy(crop_def))
  52. -- stage 5
  53. crop_def.tiles = {"farming_melon_5.png"}
  54. minetest.register_node("farming:melon_5", table.copy(crop_def))
  55. -- stage 6
  56. crop_def.tiles = {"farming_melon_6.png"}
  57. minetest.register_node("farming:melon_6", table.copy(crop_def))
  58. -- stage 7
  59. crop_def.tiles = {"farming_melon_7.png"}
  60. minetest.register_node("farming:melon_7", table.copy(crop_def))
  61. -- stage 8 (final)
  62. crop_def.drawtype = "nodebox"
  63. crop_def.description = S("Melon")
  64. crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}
  65. crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5}
  66. crop_def.walkable = true
  67. crop_def.groups = {
  68. food_melon = 1, snappy = 1, oddly_breakable_by_hand = 1,
  69. flammable = 2, plant = 1
  70. }
  71. --crop_def.drop = "farming:melon_slice 9"
  72. crop_def.drop = "farming:melon_8"
  73. minetest.register_node("farming:melon_8", table.copy(crop_def))
  74. -- add to registered_plants
  75. farming.registered_plants["farming:melon"] = {
  76. crop = "farming:melon",
  77. seed = "farming:melon_slice",
  78. minlight = 13,
  79. maxlight = 15,
  80. steps = 8
  81. }