strawberry.lua 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. local S = farming.translate
  2. -- Strawberry (can also be planted as seed)
  3. minetest.register_craftitem(":ethereal:strawberry", {
  4. description = S("Strawberry"),
  5. inventory_image = "ethereal_strawberry.png",
  6. groups = {
  7. compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1, flammable = 2
  8. },
  9. on_place = function(itemstack, placer, pointed_thing)
  10. return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1")
  11. end,
  12. on_use = minetest.item_eat(1)
  13. })
  14. -- Define Strawberry Bush growth stages
  15. local def = {
  16. drawtype = "plantlike",
  17. tiles = {"ethereal_strawberry_1.png"},
  18. paramtype = "light",
  19. sunlight_propagates = true,
  20. waving = 1,
  21. walkable = false,
  22. buildable_to = true,
  23. drop = "",
  24. selection_box = {
  25. type = "fixed",
  26. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  27. },
  28. groups = {
  29. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  30. not_in_creative_inventory = 1, growing = 1
  31. },
  32. sounds = farming.sounds.node_sound_leaves_defaults()
  33. }
  34. --stage 1
  35. minetest.register_node(":ethereal:strawberry_1", table.copy(def))
  36. -- stage 2
  37. def.tiles = {"ethereal_strawberry_2.png"}
  38. minetest.register_node(":ethereal:strawberry_2", table.copy(def))
  39. -- stage 3
  40. def.tiles = {"ethereal_strawberry_3.png"}
  41. minetest.register_node(":ethereal:strawberry_3", table.copy(def))
  42. -- stage 4
  43. def.tiles = {"ethereal_strawberry_4.png"}
  44. minetest.register_node(":ethereal:strawberry_4", table.copy(def))
  45. -- stage 5
  46. def.tiles = {"ethereal_strawberry_5.png"}
  47. minetest.register_node(":ethereal:strawberry_5", table.copy(def))
  48. -- stage 6
  49. def.tiles = {"ethereal_strawberry_6.png"}
  50. def.drop = {
  51. items = {
  52. {items = {"ethereal:strawberry 1"}, rarity = 2},
  53. {items = {"ethereal:strawberry 2"}, rarity = 3}
  54. }
  55. }
  56. minetest.register_node(":ethereal:strawberry_6", table.copy(def))
  57. -- stage 7
  58. def.tiles = {"ethereal_strawberry_7.png"}
  59. def.drop = {
  60. items = {
  61. {items = {"ethereal:strawberry 1"}, rarity = 1},
  62. {items = {"ethereal:strawberry 2"}, rarity = 3}
  63. }
  64. }
  65. minetest.register_node(":ethereal:strawberry_7", table.copy(def))
  66. -- stage 8
  67. def.tiles = {"ethereal_strawberry_8.png"}
  68. def.groups.growing = nil
  69. def.selection_box = farming.select_final
  70. def.drop = {
  71. items = {
  72. {items = {"ethereal:strawberry 2"}, rarity = 1},
  73. {items = {"ethereal:strawberry 3"}, rarity = 3}
  74. }
  75. }
  76. minetest.register_node(":ethereal:strawberry_8", table.copy(def))
  77. -- add to registered_plants
  78. farming.registered_plants["ethereal:strawberry"] = {
  79. crop = "ethereal:strawberry",
  80. seed = "ethereal:strawberry",
  81. minlight = farming.min_light,
  82. maxlight = farming.max_light,
  83. steps = 8
  84. }
  85. -- mapgen
  86. minetest.register_decoration({
  87. deco_type = "simple",
  88. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  89. sidelen = 16,
  90. noise_params = {
  91. offset = 0,
  92. scale = farming.strawberry,
  93. spread = {x = 100, y = 100, z = 100},
  94. seed = 143,
  95. octaves = 3,
  96. persist = 0.6
  97. },
  98. y_min = 20,
  99. y_max = 55,
  100. decoration = "ethereal:strawberry_7"
  101. })