melon.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 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(def))
  43. -- stage 2
  44. def.tiles = {"farming_melon_2.png"}
  45. minetest.register_node("farming:melon_2", table.copy(def))
  46. -- stage 3
  47. def.tiles = {"farming_melon_3.png"}
  48. minetest.register_node("farming:melon_3", table.copy(def))
  49. -- stage 4
  50. def.tiles = {"farming_melon_4.png"}
  51. minetest.register_node("farming:melon_4", table.copy(def))
  52. -- stage 5
  53. def.tiles = {"farming_melon_5.png"}
  54. minetest.register_node("farming:melon_5", table.copy(def))
  55. -- stage 6
  56. def.tiles = {"farming_melon_6.png"}
  57. minetest.register_node("farming:melon_6", table.copy(def))
  58. -- stage 7
  59. def.tiles = {"farming_melon_7.png"}
  60. minetest.register_node("farming:melon_7", table.copy(def))
  61. -- stage 8 (final)
  62. def.drawtype = "nodebox"
  63. def.description = S("Melon")
  64. def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}
  65. def.selection_box = {-.5, -.5, -.5, .5, .5, .5}
  66. def.walkable = true
  67. def.groups = {
  68. food_melon = 1, snappy = 2, oddly_breakable_by_hand = 1,
  69. flammable = 2, plant = 1
  70. }
  71. def.drop = "farming:melon_8"
  72. minetest.register_node("farming:melon_8", table.copy(def))
  73. -- add to registered_plants
  74. farming.registered_plants["farming:melon"] = {
  75. crop = "farming:melon",
  76. seed = "farming:melon_slice",
  77. minlight = farming.min_light,
  78. maxlight = farming.max_light,
  79. steps = 8
  80. }