asparagus.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. local S = farming.translate
  2. -- asparagus
  3. minetest.register_craftitem("farming:asparagus", {
  4. description = S("Asparagus"),
  5. inventory_image = "farming_asparagus.png",
  6. groups = {compostability = 48, seed = 2, food_asparagus = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:asparagus_1")
  9. end,
  10. on_use = minetest.item_eat(1)
  11. })
  12. -- asparagus definition
  13. local def = {
  14. drawtype = "plantlike",
  15. tiles = {"farming_asparagus_1.png"},
  16. paramtype = "light",
  17. paramtype2 = "meshoptions",
  18. place_param2 = 3,
  19. sunlight_propagates = true,
  20. walkable = false,
  21. buildable_to = true,
  22. drop = "",
  23. waving = 1,
  24. selection_box = farming.select,
  25. groups = {
  26. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  27. not_in_creative_inventory = 1, growing = 1
  28. },
  29. sounds = farming.sounds.node_sound_leaves_defaults()
  30. }
  31. -- stage 1
  32. minetest.register_node("farming:asparagus_1", table.copy(def))
  33. -- stage 2
  34. def.tiles = {"farming_asparagus_2.png"}
  35. minetest.register_node("farming:asparagus_2", table.copy(def))
  36. -- stage 3
  37. def.tiles = {"farming_asparagus_3.png"}
  38. minetest.register_node("farming:asparagus_3", table.copy(def))
  39. -- stage 4
  40. def.tiles = {"farming_asparagus_4.png"}
  41. def.drop = {
  42. items = {
  43. {items = {"farming:asparagus"}, rarity = 2}
  44. }
  45. }
  46. minetest.register_node("farming:asparagus_4", table.copy(def))
  47. -- stage 5
  48. def.tiles = {"farming_asparagus_5.png"}
  49. def.groups.growing = nil
  50. def.selection_box = farming.select_final
  51. def.drop = {
  52. items = {
  53. {items = {"farming:asparagus"}, rarity = 1},
  54. {items = {"farming:asparagus 2"}, rarity = 2}
  55. }
  56. }
  57. minetest.register_node("farming:asparagus_5", table.copy(def))
  58. -- add to registered_plants
  59. farming.registered_plants["farming:asparagus"] = {
  60. crop = "farming:asparagus",
  61. seed = "farming:asparagus",
  62. minlight = 7,
  63. maxlight = farming.max_light,
  64. steps = 5
  65. }
  66. -- mapgen
  67. minetest.register_decoration({
  68. name = "farming:asparagus_5",
  69. deco_type = "simple",
  70. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  71. sidelen = 16,
  72. noise_params = {
  73. offset = -0.1,
  74. scale = farming.asparagus,
  75. spread = {x = 100, y = 100, z = 100},
  76. seed = 234,
  77. octaves = 3,
  78. persist = 0.6
  79. },
  80. y_min = 8,
  81. y_max = 32,
  82. decoration = "farming:asparagus_5",
  83. param2 = 3
  84. })